faqts : Computers : Programming : Languages : JavaScript : Language Core : Dates

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 6 people (17%) answered Yes
Recently 1 of 6 people (17%) answered Yes

Entry

How can I check if the server uses mm/dd/yyyy or dd/mm/yyyy for solution on American and British sys

Jun 14th, 2002 01:46
russel lindsay, Gareth Hay, Jean-Bernard Valentaten,


You don't really need to do so if you're using the Date() Object.
This Object has methods that allow you to extract the month, day etc. 
without needing to worry about the locales.
HTH
But I *do* really need to do this. The server is supplying data as a 
string, but there are 2 servers, one American and one British, and each 
supply the dates differently. I need to find out which way it is.
Gaz
this is just theory - i haven't tested it...
if you know the format of the server's date, then you can create a new 
date object - d = new Date(dateString). Then use this object to create 
a new date string in the same format as the server. then you could 
compare the strings, if they match, the date was american, otherwise it 
is british.
rus