In comp.lang.javascript message <11**********************@r3g2000prh.goo
glegroups.com>, Mon, 21 May 2007 09:02:37,
vu******@gmail.com posted:
>What is the best method to convert milliseconds (after midnight
January 1, 1970 GMT) to formatted time
Conventionally, midnight is the end of the day. You mean 1970-01-01
00:00:00 GMT.
>example:
972798180000 ==10/18/2000 14:08:11
That's not a sensible format for the Internet. The average American
will want 12-hour clock time, and the rest of the world won't want FFF
date field order. Convert it to YYYY-MM-DD hh:mm:ss, which is
comprehensible and unambiguous everywhere.
From that number, I get 20000-10-29 05:43:00. Your value is clearly
wrong, as an even multiple of 10 seconds from 1970.0 should give an even
multiple of 10 seconds in hh:mm:ss notation.
Then, of course, you must add UTC, GMT, or Z; or convert to local civil
time. The latter is only easy if there was no significant change in the
local Summer Time rules between the date/time in question and the
present moment, except possibly with a combination of Vista and a non-
compliant Javascript implementation.
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.