Wednesday, 15 June 2011

localization - Localizing Dates and JavaScript -


I have a list of items I'm displaying on screen. The HTML template for each item looks like this:

  & lt; Div & gt; [Comments] & lt; / Div & gt; & Lt; Small & gt; Posted: [date] & lt; / Small>  

[comments] will be the actual string of text entered by a user. While the [date] is a JavaScript dated object, I want to display the date [date] with the month, day and year in the local date format. How can I do this as possible Java?

Thank you!

Use date method toLocaleFormat (formatString)

< Pre> var today = new date (); Today.toLocaleFormat ('% d% b% Y'); // 30-Dec-2011

No comments:

Post a Comment