jquery - What culture does the javascript Date object use? -
the language of os (windows) in danish, , language of browsers.
when trying parse date in danish format (dd-mm-yyyy) this:
var x = "18-08-1989" var date = new date(x);
i wrong date javascript (i want 18'th of august 1989). when transform string english, , parse it, returns correct date.
does format of date string have be: yyyy-mm-dd when using js date object??
in basic use without specifying locale, formatted string in default locale , default options returned.
var date = new date(date.utc(2012, 11, 12, 3, 0, 0)); // tolocalestring without arguments depends on implementation, // default locale, , default time zone date.tolocalestring(); // "12/11/2012, 7:00:00 pm" if run in en-us locale time zone america/los_angeles
using locales
var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // formats below assume local time zone of locale; // america/los_angeles // english uses month-day-year order alert(date.tolocalestring("en-us")); // "12/19/2012, 7:00:00 pm" // british english uses day-month-year order alert(date.tolocalestring("en-gb")); // "20/12/2012 03:00:00" // korean uses year-month-day order alert(date.tolocalestring("ko-kr")); // "2012. 12. 20. 오후 12:00:00"
Comments
Post a Comment