This API is written in Sinatra , for those who want to have real time date and time in their own applications. The project is open sources, and sources are available on Github . Also, there are some tests on github, please take a look at them to understand how this API works.
Returns current time of the server. Shows result in this format :
You need to give it a parameter, for example :
Then it returns difference between given zone and UTC.
Returns current gregorian day of the server in this format :
P.S : American format is more popular than other formats, and this is why I used it.
Returns current Jalali date of the server in this format :
This is regular format we use in Iran, Afghanistan, Tajikistan and other regions of the world which people use Jalali calendar.
This will convert given date and time to the current date and time of the server. For example :
And if server is located in Iran, it'll return:
It takes a gregorian date and converts it to Jalali. for examlpe :
It takes a Jalali date and converts it to Gregorian. for example :
It takes a timezone, and returns current time of that :
For more zones, you need to do this:
We use ruby programming language and "http" gem for writing tests. This is a very, very simplr test which returns current server's date:
Now, it's ready to use!