If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > American date format only?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-21-05, 22:08
MrBonk MrBonk is offline
Registered User
 
Join Date: Nov 2005
Location: Australia
Posts: 7
Question American date format only?

Greetings,
When I'm sending dates to my DB2 database, I notice it automatically assumes the dates are formatted in American format. Is this something that can be altered in DB2? I'd like to be able to send dates in dd/mm/yyyy format.
Reply With Quote
  #2 (permalink)  
Old 11-21-05, 22:54
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by MrBonk
When I'm sending dates to my DB2 database, I notice it automatically assumes the dates are formatted in American format.
Are you using United States Postal Service to send the dates? Try Canada Post or DHL...

Seriously though, it would be worth knowing what kind of application or query environment we're dealing with. In general, changing the client system's locale should help.
Reply With Quote
  #3 (permalink)  
Old 11-21-05, 23:01
MrBonk MrBonk is offline
Registered User
 
Join Date: Nov 2005
Location: Australia
Posts: 7
Ok. I'm running DB2 8 on a WinXP machine and I'm plugging into that using ColdFusion. The machine locale is Australia.

I'm getting a date from a user via a web form and I'm sending that date, along with some other associated data, to the database. The issue I'm having is that DB2 assumes the dates are mm/dd/yyyy, unless they can't be resolved as such. So, for eg. I enter 1/9/2005 (being 1st September) and DB2 interprets that as 9th Jan. However, if I enter 30/9/2005, it gets it right.
Reply With Quote
  #4 (permalink)  
Old 11-21-05, 23:17
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
The database must have been created with the US locale, which is the default.

Try using TO_DATE('your date','DD/MM/YYYY')
Reply With Quote
  #5 (permalink)  
Old 11-21-05, 23:48
MrBonk MrBonk is offline
Registered User
 
Join Date: Nov 2005
Location: Australia
Posts: 7
I've changed my query code to modify the dates to numerical values before I send them now, so it shouldn't matter what format the production database is (mine is only a test version).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On