Thread: NOW() syntax

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    2
    Rep Power
    0

    NOW() syntax


    Hi all,

    I've just started using PostgreSQL in my new job having been using MySQL until now.

    I have a timestamp column, with the now() function attached to it.

    What I would like to do is now() + 2 hours. So I can make a "timeout" for sessions.

    What is the syntax for NOW() + 2 hours?

    (date(now() +2) adds 2 days to the time...

    Thanks in advance.

    mike
  2. #2
  3. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    now() + interval '2 hours'
    - Andreas Koepke

    Koepke Photography

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    2
    Rep Power
    0
    Thanks very much for your reply, that did the trick!

IMN logo majestic logo threadwatch logo seochat tools logo