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 > About Date format in DB2 9.1.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-18-07, 13:51
francis01 francis01 is offline
Registered User
 
Join Date: Jul 2004
Posts: 65
About Date format in DB2 9.1.

Hi all:
I have db2 9.1 Express edition on Windows XP SP2. (Level DB2 v9.1.200.98)
My problem is that I work the dates in the "dd/mm/yyyy" format, which
I have defined in Regional Settings of the O.S.
DB2 has the format "mm/dd/yyyy", which gives me errors when
the date of some data is for example "13/01/2007" (month 13 doesn't exist).
My question is how can I change the date format in DB2 to match the one
selected in Regional Settings of the O.S. Any idea?
Thanks for your help..
Reply With Quote
  #2 (permalink)  
Old 03-19-07, 03:42
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
when you bind db2cli / db2ubind.lst you can specify dateformat (iso/eur...
have a look at bind command and rebind both lst files
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #3 (permalink)  
Old 03-20-07, 12:43
francis01 francis01 is offline
Registered User
 
Join Date: Jul 2004
Posts: 65
Thanks.
I have done the change, but none of the formats is useful for me.
(EUR, LOC, etc.). I need dd/mm/yyyy. Anyone knows how to do this change?.
Thanks...
Reply With Quote
  #4 (permalink)  
Old 03-21-07, 05:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Why do you need dd/mm/yyyy? That is really confusing because slashes usually indicate for the rest of the world that we are talking about a US date value, and there you have months first.

If you really want to use that format (preferred would be ISO because you can actually sort that way easily), then you need to apply functions to convert from/to something that DB2 understands.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 03-21-07, 11:54
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by stolze
Why do you need dd/mm/yyyy? That is really confusing because slashes usually indicate for the rest of the world that we are talking about a US date value, and there you have months first.

If you really want to use that format (preferred would be ISO because you can actually sort that way easily), then you need to apply functions to convert from/to something that DB2 understands.
I don't understand this thing about "sorting" (as also mentioned in your post on the newsgroup). DB2 can order by the date regardless of the format that it is returned to the application program. Why would anyone sort the date inside of an application program? DB2 always stores the date internally as YYYYMMDD packed into 4 bytes.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #6 (permalink)  
Old 03-22-07, 06:21
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Quote:
Originally Posted by Marcus_A
I don't understand this thing about "sorting" (as also mentioned in your post on the newsgroup). DB2 can order by the date regardless of the format that it is returned to the application program. Why would anyone sort the date inside of an application program? DB2 always stores the date internally as YYYYMMDD packed into 4 bytes.
True, DB2 sorts dates correctly. The only thing that differs is the external representation. But I wasn't talking about DB2 specifically but rather date comparisons in general. I can imagine that pretty every application has to manage dates and has to compare dates. There, the ISO format is very well suited because a simple string comparison is sufficient. Other formats require more involved logic. (And going to the DBMS just to compare two date values is surely not the best move in many situations.)
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #7 (permalink)  
Old 03-27-07, 10:39
martynhodgson martynhodgson is offline
Registered User
 
Join Date: Aug 2004
Posts: 4
I have the same issue with DB2 9.1 Express on RHEL 5. I appreciate that it's not yet a supported combination of DB2 and OS, but I'll send a support request to IBM as I suspect it's a problem for anyone working in the UK. I haven't tried converting an existing V8 database yet - still testing with a new one.

As for "Why do you need dd/mm/yyyy", well in the UK we just do and that's all there is to it.

The support for this date format for Territory Code 44 is stil documented in the V9.1 manuals.
Reply With Quote
  #8 (permalink)  
Old 03-27-07, 12:07
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by francis01
I work the dates in the "dd/mm/yyyy" format, which
I have defined in Regional Settings of the O.S.
There are two independent things here:
- The Regional Date/Time Settings, which determine how dates are displayed (as in SELECT datefield FROM mytable); and
- The input format for date constants (as in ... WHERE datefield = '2007-03-27')

For the second issue, there are only three formats:
- 'yyyy-mm-dd' (the ISO format)
- 'mm/dd/yyyy' (the USA format)
- 'dd.mm.yyyy' (the EUR format)
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
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