Results 1 to 5 of 5

Thread: date operator

  1. #1
    Join Date
    Sep 2003
    Posts
    9

    Unanswered: date operator

    hi,

    When I issued the SQL,


    SELECT DATE(02003082) FROM tab1

    inorder to display the date 2003-08-22,db2 gave me the date

    5485-04-02.

    I am not able to deduce how db2 is doing this conversion.
    Can someone tell me how exactly db2 gives me this answer?

    Thanks,
    K Rajkumar

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Do you mean:

    SELECT DATE(20030822) FROM tab1?

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If the argument is a number:
    The result is the date that is n-1 days after January 1, 0001, where n is
    the integral part of the number.

    So when you say SELECT DATE(02003082) FROM tab1
    it is 2,003,082 days or 5485 years after 01-01-001.

    Maybe you should select SELECT '2003-08-22' FROM tab1

  4. #4
    Join Date
    Sep 2003
    Posts
    9
    That was the actual intended statement.
    But since db2 gave an error saying that the date
    was not in the permissible range,I tried

    DATE(02003082) instead of DATE(20030822) .

    But I was not able to understand the conversion.


    regards,
    K Rajkumar

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    DB2 will not accept 'SELECT DATE(20030822) from Table1'
    becasue it is not Y10K ready (when the world will come to an end).

Posting Permissions

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