473,563 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date in regional format in different regions

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
3 2800
Andrew Poulos wrote on 02 mei 2005 in comp.lang.javas cript:
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
Andrew Poulos wrote on 02 mei 2005 in comp.lang.javas cript:
Evertjan. wrote:
Andrew Poulos wrote on 02 mei 2005 in comp.lang.javas cript:
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.getD ate() +"/"+ (theDate.getMon th()+1) +"/"+ theDate.getFull Year

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
JRS: In article <4275ec23$0$128 09$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*****@hotmai l.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.demo n.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.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4833
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime before Windows 2000 Service Pack 4 and has remained through to Windows XP. I am looking for a solution that doesn't involve rewriting our application...
1
2261
by: Karl Irvin | last post by:
My regional setting is English(United States) My customers setting is French(Canada) When he runs my program using a typed in date, he gets a "date invalid" error. Do I need to do something to dates in Access when the regional settings are different? The error may not be coming from Access but from a purchased module that
2
5073
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings set to "en-UK" and date to
9
3217
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database and not the file itself. To do this I will need to have a File class property for Create time and date that will let me "set" the Create time...
5
5325
by: Ellis Yu | last post by:
Dear All I want to read the short date format pattern from the regional setting. I write a code as follow: 'Diff. machine may has different country setting, so I use blank here Dim a as new CultureInfo("") Dim shortDatePattern as String
9
6363
by: insomniux | last post by:
Hi, I am having a problem with formatting the default value of a date field. It has been discussed earlier in many topics, but still I cannot solve the problem. What's happening: I have various forms which are based on an ODBC-linked tables. In one of the forms, I have a control which shows the date of a date field in my database (storage...
16
11879
by: Mik | last post by:
I apologise if this post seems a little basic, but I am a newbie and have NO access knowledge. I have downloaded the Accounts Ledger from the Microsoft Website. It allows the user to review a report of transactions between a Start & End date. The Tables and forms i believe are UK format "dd/mm/yyyy", However, when I click on "Review...
10
5796
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a date format in the table design, such as: mm/dd/yyyy? What I've done for years is to store the date format in date fields, then on the forms, based...
30
5675
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the database I have a table with Date/time column. The database is located on a machine that is set to dd/mm/yyyy also. When I enter date 7/1/08 (as in...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.