Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2005
    Location
    Australia
    Posts
    7

    Question Unanswered: 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.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    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.

  3. #3
    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.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    The database must have been created with the US locale, which is the default.

    Try using TO_DATE('your date','DD/MM/YYYY')

  5. #5
    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •