Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Question Unanswered: operations on current timestamp

    Is there a way to do operations on the special register - current timestamp? The goal is to be able to use it as a criteria in a where clause . for e.g. lets say i have a table with createtimestamp as a column. In Oracle, I can fetch records created in the past 1 hour with a where clause of "createtimestamp > (sysdate - 1/24)" or for the past 1 day as "createtimestamp > (sysdate - 1)". In Db2, my understanding was that current timestamp was the equivalent of sysdate but I am not able to get operations such as subtraction to work on it.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Select * from table_name
    where createtimestamp + 1 hour > current timestamp
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: operations on current timestamp

    You should find this and many more datetime functions and operators you can use with current date in SQL Reference



    HTH

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

Posting Permissions

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