Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    73

    Unanswered: Fetch date from timestamp (DB2 Iseries)

    Hello guys,

    Is there any way to fetch only date in the format dd/MM/yyyy from a time stamp field in table from db2 through sql in (V5R4) ?

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    CHAR(DATE(timestamp_expression), USA) will return ’mm/dd/yyyy’.

    CHAR(DATE(timestamp_expression), EUR) will return ’dd.mm.yyyy’.

    REPLACE(CHAR(DATE(timestamp_expression), EUR), '.', '/') will return ’dd/mm/yyyy’.

    Please see "DB2 for i5/OS SQL Reference Version 5 Release 4" Chapter 3. Built-in functions.
    Last edited by tonkuma; 01-28-10 at 02:13. Reason: Added reference manual.

  3. #3
    Join Date
    Mar 2009
    Posts
    73

    Thumbs up Thanks

    Quote Originally Posted by tonkuma View Post
    CHAR(DATE(timestamp_expression), USA) will return ’mm/dd/yyyy’.

    CHAR(DATE(timestamp_expression), EUR) will return ’dd.mm.yyyy’.

    REPLACE(CHAR(DATE(timestamp_expression), EUR), '.', '/') will return ’dd/mm/yyyy’.

    Please see "DB2 for i5/OS SQL Reference Version 5 Release 4" Chapter 3. Built-in functions.
    Thanks for the reply tonkuma, I cant believe I actually did as you advised seems like I am catching up lol well thanks for the reference and all the help you do always.
    Cheers !

Posting Permissions

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