Code Monkey home page Code Monkey logo

jsjdate's Introduction

JSJdate

Jalali (Shamsi) Date in Javascript

Really small (only 2KB) and accurate converter

Usage

without parameters : (returns Now)

JDate().toString()	//--> "1393/2/27"
JDate().getRooz()	//--> "جمعه"
JDate().getMah()	//--> "اردیبهشت"
JDate().getDate()	//--> 27
JDate().getMonth()	//--> 2
JDate().getYear()	//--> 1393

With a String Miladi Date:

JDate("2010/5/5").toString()	//--> "1389/2/15"

With a TimeStamp:

JDate(1273001400000).toString()	//--> "1389/2/15"

With a JSDate Object:

JDate(new Date("2010/5/5")).toString()	//--> "1389/2/15"

With a Relative date:

JDate('+5d').toString()	//--> "1393/3/1" (today + 5 days)
JDate('-5d').toString()	//--> "1393/2/22" (today - 5 days)

Include

to use with NodeJS just copy the object (19 lines) into your code to use in browser include the tarikh.js file in your page

 <script src="./tarikh.js"></script>

jsjdate's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.