PDA

Click to See Complete Forum and Search --> : Javascript : Client date format?


crptcblade
Mar 23rd, 2005, 01:24 PM
Is there a way to get the date format of the client through javascript?

Psyrus
Mar 23rd, 2005, 07:19 PM
I don't know of any way to return the format used. I believe that Javascript only has methods to get and set date values, not to directly return the format. I suppose it wouldn't be too hard to write a function that does this yourself parsing the string returned from the toLocaleString() method and comparing it against the different formats that you are after.

Psyrus
Mar 23rd, 2005, 07:20 PM
On second thought, it might be kind of difficult...

:eek2:

mendhak
Mar 24th, 2005, 01:21 AM
toLocaleDateString();

Psyrus
Mar 24th, 2005, 05:23 AM
I thought that he was after the "mm/dd/yyyy" type kind of format returned as a string? Anyway, thanks for posting that version. It's a lot easier to use instead of parsing out the time, the way I originally was.

:)

crptcblade
Mar 24th, 2005, 06:14 AM
I thought that he was after the "mm/dd/yyyy" type kind of format returned as a string?
Exactly. What I'm trying to accomplish in the long run is sort of a mask edit box for date entry, so I need to be able to figure out the format in order to come up with the mask.

Unless someone can think of a better way.

:afrog:

mendhak
Mar 24th, 2005, 06:38 AM
Forget masking. Use 2 textboxes and a combobox like normal people.

crptcblade
Mar 24th, 2005, 06:42 AM
like normal people.
Have we met? :wave:

I'll probably settle for dropdown box approach, just trying to appease my audience.

mendhak
Mar 24th, 2005, 09:52 PM
Excellent choice. I'll have PeeWee Herman bring in the check.