-
How to select latest date
Hi,
How can I get to_date function to return the hours and minutes like to_char: HH24:MI. I'm only getting the date.
Thanks,
leo
leonard905
leonard905@yahoo.com
-
SELECT TO_CHAR
(SYSDATE, 'MM-DD-YYYY HH24:MI:SS')"NOW"
FROM DUAL;
http://download-west.oracle.com/docs...129a.htm#84850
I remember when this place was cool.
-
It's not easy when you have a date like:
31-OCT-2004 10:00 and 01-NOV-2004 13:00 and you want to get the latest date. ie. 01-NOV-2004 13:00.
How do you do this. My query below brings back only the date and not the timestamp.
select to_char(max(to_date(mod_date,'DD-MON-RR')), 'MON-DD-YYYY HH24:MI') from table1
leonard905
leonard905@yahoo.com
-
ah, the real question.
of course, you're truncating the date.
Jeff Hunter
-
Okay. So how should I do it. Any help is appreciated.
leonard905
leonard905@yahoo.com
-
1. Why do you have to convert to_date anyway?
2. example structure, data, please
Jeff Hunter
-
Thanks. I got it to work by adding a subquery:
select to_char(mod_date, 'MON-DD-YYYY HH24:MI') NewDate from Table1
where mod_date = (select max(mod_date) from Table1);
leonard905
leonard905@yahoo.com
-
Oh boy, what an SQL!
select to_char(MAX(mod_date), 'MON-DD-YYYY HH24:MI') NewDate from Table1;
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|