Groups | Blog | Home
all groups > dotnet jscript > january 2004 >

dotnet jscript : toLocaleString



Sunil Thapliyal
1/20/2004 2:09:29 PM
Hello

I have a problem while globalizing where i need to display a date in german
and french according to the locale selected in the regional settings.. the
date is being formed by string concatenation
like day , month + day+ year
this has to be in german
example July will be written as Juli
moreover the format of date has to be
day , day + month + year

please tell how to achieve this with Jscript
Thanks

Martin Honnen
1/20/2004 2:54:53 PM


[quoted text, click to view]

Is this JScript in IE or Windows Script host?
When I try
new Date().toLocaleDateString()
with IE6 on Windows XP German edition I get
Dienstag, 20. Januar 2004
but as the ECMAScript standard only suggest that formatting has to take
the host locale into account you shouldn't rely on that in Web scripting
but would need to set up some arrays with the proper month names in the
languages you need.

If you are using JScript.NET then I think the .NET DateTime together
with the Globalization namespace should offer you support to parse and
format dates in different languages.
--

Martin Honnen
http://JavaScript.FAQTs.com/
AddThis Social Bookmark Button