Home » SQL & PL/SQL » SQL & PL/SQL » to_char doesn't work with date of 1/1/1900
to_char doesn't work with date of 1/1/1900 [message #247681] Tue, 26 June 2007 15:35 Go to next message
Duane
Messages: 452
Registered: December 2002
Senior Member
How to I correctly format a date when the field contains "1/1/1900 9:00:00 AM"?

Using Toad:

select meeting_time_start,
       meeting_time_end
  from ps_class_mtg_pat

OUTPUT
1/1/1900 9:00:00 AM 1/1/1900 9:50:00 AM

Using Toad:

select to_char(meeting_time_start, 'HH:MM'),
       to_char(meeting_time_end, 'HH:MM)
  from ps_class_mtg_pat

OUTPUT
9:01:00 AM 9:01:00 AM


So, how do I get a time of 9:00 and 9:50? I keep getting a time of 9:01 when doing a to_char().
Re: to_char doesn't work with date of 1/1/1900 [message #247682 is a reply to message #247681] Tue, 26 June 2007 15:48 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
"MM" is MONTH; "MI" is minutes!
Re: to_char doesn't work with date of 1/1/1900 [message #247684 is a reply to message #247681] Tue, 26 June 2007 15:59 Go to previous message
Duane
Messages: 452
Registered: December 2002
Senior Member
Good grief! You are so right. Ah, I copied and pasted the to_char() function and didn't update it correctly when overtyping the values.
Previous Topic: Writing Excel Document from PL/SQL
Next Topic: CLEARING TEMPORARY TABLE SPACES
Goto Forum:
  


Current Time: Thu Dec 08 22:26:25 CST 2016

Total time taken to generate the page: 0.05928 seconds