JRS: In article <Iq*****************@newsfe3-win.server.ntli.net>, seen
in news:comp.lang.javascript, Andrew Urquhart <re***@website.in.sig>
posted at Wed, 3 Mar 2004 21:51:10 :-
Ike wrote: If I have an integer, like :
1078349279
representing seconds since the "epoch" (jan 1, 1970) is there a means
in javascript to format that into the date and time? Thank you. Ike
var objDate = new Date(1078349279);
var strDate = objDate.toUTCString();
That does assume that *his* epoch is GMT, which is no more than very
probable. It also omits the factor of 1000 that is probably required.
new Date(1078349279) -> Tue Jan 13 11:32:29 UTC 1970
new Date(1078349279000) -> Wed Mar 3 21:27:59 UTC 2004
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.