javascript - display date independent of system locale and as per the application language -
my web application supports 2 languages: english & french in date displayed in header of each page.
now, happening date displayed per the user system's locale.if end user system locale slovakia date displayed in slovakia.if english displayed in english. no matter in language web application running english or french. because using
datestring.tolocalestring()
below code:
var reg = new regexp("[,]+", "g"); var tableau = thedate.split(reg); var value = new date(tableau[0], (parseint(tableau[1], 10) - 1), tableau[2], tableau[3], tableau[4], tableau[5]); return value.tolocalestring();
where thedate comma separated string contains month, day, year, time(like 10.21,2012,51,50,32
)
now, concern want show date in format in application running. if running in french should displayed in french or if in english should displayed in english. independent of user system's locale.
current date format is(in english locale): thursday, april 25, 2013 5:28:59 pm
other locale, day , month convert accordingly.
if use value.tostring()
displayed in format
thu apr 25 2013 17:28:59 gmt+0530 (india standard time)
that not want. want display in current format per application language(en/fr).
please provide valuable suggestions.
pretty same answer gave here few hours ago: javascript - system short date format
there's no perfect solution want fix format declared you, i'd recommend either using toisostring()
if fits needs, or getutcdate()
, getutcmonth()
, getutcday()
, concatenate these guys string of choice.