Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Posts
    30

    Question Unanswered: Time Format (HH:MM:SS AM/PM)

    Following is the SQL for Time format.

    db2 -v "select char(date(current timestamp),USA)|| ' ' || char(time(current timestamp))||' '||SUBSTR((char(time(current timest
    amp),USA)),7,2) from sysibm.sysdummy1"

    The above work well, but please see below...

    The above SQL when run ..shows as below.. in the 24 hour format
    09/08/2005 20.04.20 PM

    Instead of the 12 hour format.
    09/08/2005 08:04:20 PM

    Can this be achieved in DB2 ?????
    Tried all the functions.

    Please let me know.

    Thank You
    Bollin99

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    See if CHAR scalar function helps

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    See if CHAR scalar function helps

    Refer documentation for details

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  4. #4
    Join Date
    Aug 2003
    Posts
    106
    select char(date(current timestamp),USA)|| ' ' || char(time(current timestamp),USA) from sysibm.sysdummy1

    This works! gives time as 02/09/2006 07:54 PM

    You are the creator of your own destiny!

Posting Permissions

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