plsql - PL/SQL Adding hours to timestamp parameter -
i got parameter
:datefrom which gonna used argument in function timestamp. need add :datefrom + 7 hours, how can that?
if parameter not timestamp, use to_timestamp or to_date convert it:
to_timestamp(datefrom,'mm/dd/yyyy hh24:mi:ss') (substitute appropriate mask based on format of input parameter)
then add 7/24.
to_timestamp(datefrom,'mm/dd/yyyy hh24:mi:ss') + 7/24; adding 1 adds full day, adding 1/24 adds 1 hour.
this can done interval operator:
to_timestamp(datefrom,'mm/dd/yyyy hh24:mi:ss') + interval '7' hour
Comments
Post a Comment