Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: sysdate problems
in the date/time format string, MM returns the two digit month, not minutes. use MI in the format to specify minutes.
without an AM/PM indicator, you probably want to return hours in 24-hour format. use HH24 to get hours 00 thru 23.
try using this as your format string:
'MM/DD/YYYY HH24:MI:SS'
HTH
"Sonja Barton" <sbarton_at_starband.net> wrote in message
news:XFZL6.47$ph3.35200029_at_twister2.starband.net...
> I use sysdate to insert the current date/time into a field in a table. I
> also use it in a log file heading.
>
> Using ALTER SESSION SET NLS_DATE_FORMAT = 'mm/dd/yyyy hh:mm:ss';
> ignores me and uses the dd-mon-yyyy format when I add the hh:mm:ss. Just
> setting the format to 'hh:mm" returns the time properly (almost - read
on).
>
> using to_char(sysdate, 'mm/dd/yyyy hh:mm:ss') works (almost - read on).
>
> However, no matter which form I use, sysdate always returns a time 5
minutes
> after the hour. 11:59 is reported as 11:05. 11:01 is reported as 11:05.
>
> Has anyone seen this before? If so, I surely appreciate a fix for it!
>
> Thanks,
> Sonja
>
>
>
Received on Mon May 14 2001 - 21:59:38 CDT