By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Date in regional format in different regions

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #2

P: n/a
Andrew Poulos wrote on 02 mei 2005 in comp.lang.javascript:
Evertjan. wrote:
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.

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 I suppose we are now talking serverside ASP jscript?
2 What database engine are you using?



--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #3

P: n/a
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, Andrew Poulos <ap*****@hotmail.com> posted :
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.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.