var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: simple time formatting question
I'm sorry for asking such a simple question, but I've spent a half hour looking in the Oracle documentation and must be missing the key word to search on.
I need to format/extract an existing date in HH24:MI format.
I've tried cast and extract but I'm thinking there must be a different way to do this. I'm trying to do something similar to below:
select extract(hour from sysdate) from dual;
select to_timestamp(sysdate,'HH24:MI') from dual;
What function/command should I be looking for?
You are looking for to_char():
select to_char(sysdate, 'HH24:MI') from dual;
Details are here:
Thank you! My only concern is that the resulting value will also be in an ORDER BY clause. But after doing the test below, it looks like I'll be okay.
Thank you again for you help.
select * from (
select '1' as n from dual
select '2' as n from dual
select '0' as n from dual)
order by n
You can also use
select trunc(sysdate,'hh') from dual;
Which will extract the hour element from sysdate (or any other date).
You do not need a parachute to skydive. You only need a parachute to skydive twice.
Thanks. I'll take a look at that too.