JosephMajaseSithole / datejs

Automatically exported from code.google.com/p/datejs
0 stars 0 forks source link

[FEATURE REQUEST] Should return unix timestamp #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I just wanted to point out that this library would be very useful if it
returned back unix timestamps and other date formats compatible with other
systems.

Thank you.

Original issue reported on code.google.com by jake.c...@gmail.com on 18 Feb 2008 at 8:33

GoogleCodeExporter commented 8 years ago
Hi Jake,

Can you provide a sample string of what you expect a unix timestamp would look 
like?
I did some research and there's differing opinion on what some consider a 
modern unix
timestamp.

If you mean ISO 8601 format, then the current library includes almost full 
support.
See http://datejs.com/test/date_and_time/ (scroll down to bottom). We also 
include
.toISOString(). Most of the ISO 8601 support was added to Datejs after the 
Alpha-1
release, so you'll need to grab the bits from SVN if you want the latest code.

If you mean unix timestamp to be the number of seconds from epoch, then you 
don't
really need Datejs because that functionality is included natively in 
JavaScript.
(new Date().getTime / 1000)

For my own reference, I'm adding the following links I used for research.

http://www.unixtimestamp.com/index.php
http://en.wikipedia.org/wiki/Unix_time
http://en.wikipedia.org/wiki/ISO_8601
http://www.esqsoft.com/javascript_examples/date-to-epoch.htm
http://soft.zoneo.net/Unixtime/index.php
http://www.timestampgenerator.com/ 

Original comment by geoff%co...@gtempaccount.com on 19 Feb 2008 at 9:18