Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
92
rated 0 times [  93] [ 1]  / answers: 1 / hits: 32160  / 13 Years ago, wed, may 18, 2011, 12:00:00

Possible Duplicate:

How do I display a date/time in the user's locale format and time offset?






Hi - simple question - I just want to take this:



document.getElementById(time).innerHTML= new Date();


and format it into something legible, like this:



May 18, 2011 7:45 AM


making sure it is localized to whomever might be seeing it. Currently, it prints out as this:



Wed May 18 2011 07:46:25 GMT-0400 (EDT)


How do I do this?


More From » javascript

 Answers
77

Look up the reference for



  Date.toLocaleString()

Date.toLocaleDateString(), and

Date.toLocaleTimeString().

[#92181] Monday, May 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brooksb

Total Points: 480
Total Questions: 98
Total Answers: 106

Location: Somalia
Member since Mon, Feb 27, 2023
1 Year ago
;