Date in regional format in different regions

A

Andrew Poulos

I'm updating a db in which I have a column of Date/Time data type. The
regional settings here for short date are:
day / month / full year
eg. 28/4/2005

It's easy enough for me to build a string with the appropriate date but
how do I handle different regional settings for short date, such as:
month / day / full year


Andrew Poulos
 
E

Evertjan.

Andrew Poulos wrote on 02 mei 2005 in comp.lang.javascript:
I'm updating a db in which I have a column of Date/Time data type. The
regional settings here for short date are:
day / month / full year
eg. 28/4/2005

It's easy enough for me to build a string with the appropriate date but
how do I handle different regional settings for short date, such as:
month / day / full year

You don't have to handle those, as the client settings will do it for you.

Perhaps however your idea of "handling" differs from mine.

Please be more explicit about that.
 
A

Andrew Poulos

Evertjan. said:
Andrew Poulos wrote on 02 mei 2005 in comp.lang.javascript:




You don't have to handle those, as the client settings will do it for you.

Perhaps however your idea of "handling" differs from mine.

Please be more explicit about that.

The db with the current regional settings expects the date in this
format dd/mm/yyyy. The best I can do with js is this:
theDate.getDate() +"/"+ (theDate.getMonth()+1) +"/"+ theDate.getFullYear

but that means that I've 'fixed' the format. How can I know what the
regional settings for date are? (The db may be installed on a system
with a differing regional setting to what I'm building for.)

toLocaleDateString() gives an output like
Monday, 2 May 2005

should I parse/massage this i.e. strip the leading day name comma and
space; replace the other spaces with forward slashes; and replace any
alphabetic characters with the current month number?


Andrew Poulos
 
E

Evertjan.

Andrew Poulos wrote on 02 mei 2005 in comp.lang.javascript:
The db with the current regional settings expects the date in this
format dd/mm/yyyy. The best I can do with js is this:
theDate.getDate() +"/"+ (theDate.getMonth()+1) +"/"+ theDate.getFullYear

You don't specify the db engine you use,
but common advice is to use yyyy/mm/dd
in SQL string litterals of the type date.

theDate.getFullYear+"/"+(theDate.getMonth()+1)+"/"+theDate.getDate()

I suppose we are now talking serverside ASP jscript?
What engine?
 
A

Andrew Poulos

Evertjan. said:
Andrew Poulos wrote on 02 mei 2005 in comp.lang.javascript:



You don't specify the db engine you use,
but common advice is to use yyyy/mm/dd
in SQL string litterals of the type date.
Ah, I get it (finally) I need to specifically nominate the date format
instead of simply choosing a preset.

Thanks
Andrew Poulos
 
E

Evertjan.

Andrew Poulos wrote on 02 mei 2005 in comp.lang.javascript:
Ah, I get it (finally) I need to specifically nominate the date format
instead of simply choosing a preset.

I think you don't.

If you format the date to be used in an sql string as yyyy/mm/dd it will
always be understood correctly by most database engines.

If you want more help please answer the quetions in my last posting:

1
 
D

Dr John Stockton

JRS: In article <4275ec23$0$12809$5a62ac22@per-qv1-newsreader-
01.iinet.net.au>, dated Mon, 2 May 2005 19:00:18, seen in
news:comp.lang.javascript said:
I'm updating a db in which I have a column of Date/Time data type. The
regional settings here for short date are:
day / month / full year
eg. 28/4/2005

It's easy enough for me to build a string with the appropriate date but
how do I handle different regional settings for short date, such as:
month / day / full year

In addition to what has been said : if you can arrange to read a known
date from the database, a date with Y M and D all different, then a
little logic will determine what format it outputs. The database can
probably read that format.

But use YYYY-MM-DD if you can, and as a second choice YYYY/MM/DD - wach
with fields padded to 4 2 2 with leading zeroes.




For those interested, with non-MSIE browsers : the core of the new part
of <URL:http://www.merlyn.demon.co.uk/js-boxes.htm> could do with a re-
check.

Depict, which used a form and a table around a textarea, is replaced by
a simpler Depikt, which uses CSS for the area surround.

The appearance on my system is perceptibly different, but still matches
the written description.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top