Substract hour into a function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ApocalypSys
    New Member
    • May 2007
    • 2

    Substract hour into a function

    Hi, I need to substract a variable hour from a timestamp in PostgreSQL 8.2, I think I can use the following sentence

    Code:
    select '2007-05-14 12:36:47' + ('-5 hours'::reltime);
    I try that line in console and works fine for my purposes, but I'm having troubles turning the '-5' into a parameter for a plpgsql function.

    Do you have any recommendations about how this can be done?



    PS: This is my first post, I hope I accomplish all the posting guidelines, any comment is welcome.
  • michaelb
    Recognized Expert Contributor
    • Nov 2006
    • 534

    #2
    Welcome to the Forum!
    Let's start with the code you've developed so far for your function.
    Post it here; no matter how bad it can be at this point, we'll just use it as a launch pad.

    Comment

    Working...