Assuming you want a date rather than a varchar2, I'd use
trunc(sysdate) + interval '9' hour
trunc(sysdate) returns today at midnight and then interval '9' hour adds 9 hours to give you 9am. You can also add fractions of a day to a date so you could say
trunc(sysdate) + 9/24
I tend to find the interval notation more self-explanatory particularly if you're coming from a non-Oracle background.
1
EdwardKirk
On
You can use something like this:
SQL> alter session set NLS_DATE_FORMAT='YYYY-MM-DD';
Assuming you want a
date
rather than avarchar2
, I'd usetrunc(sysdate)
returns today at midnight and theninterval '9' hour
adds 9 hours to give you 9am. You can also add fractions of a day to adate
so you could sayI tend to find the
interval
notation more self-explanatory particularly if you're coming from a non-Oracle background.