If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Date into time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-26-10, 02:57
donraja_ht donraja_ht is offline
Registered User
 
Join Date: Sep 2007
Posts: 56
Date into time

Hello,

can anyone let me know how to convert date into time in oracle Query, the date format is as follows 1/1/1900 9:00:00 AM out of this i just need the time 9:00 as the output

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-26-10, 03:03
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by donraja_ht View Post
the date format is as follows 1/1/1900 9:00:00 AM
A "date" does not have a format. It is only formatted when it is displayed to the end-user (or are you really storing a date in a VARCHAR column?

Quote:
out of this i just need the time 9:00 as the output
See the manual for to_date()
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/functions180.htm#i1009324
Reply With Quote
  #3 (permalink)  
Old 07-26-10, 03:43
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
Actually, it is the TO_CHAR this time (as he'd like to display "time" value).

Something like
Code:
SQL> select sysdate,
  2         to_char(sysdate, 'hh24:mi:ss') just_time
  3  from dual;

SYSDATE             JUST_TIM
------------------- --------
26.07.2010 09:42:03 09:42:03

SQL>
Reply With Quote
  #4 (permalink)  
Old 07-26-10, 03:49
donraja_ht donraja_ht is offline
Registered User
 
Join Date: Sep 2007
Posts: 56
yes that is true Littlefoot i wanted something like this but i have modefied it cause i don't want seconds also is it possible to display AM PM as the unit
Reply With Quote
  #5 (permalink)  
Old 07-26-10, 04:23
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by Littlefoot View Post
Actually, it is the TO_CHAR this time (as he'd like to display "time" value).
Sorry, yes of course.
Reply With Quote
  #6 (permalink)  
Old 07-26-10, 07:44
beilstwh beilstwh is offline
Lead Application Develope
 
Join Date: Jun 2004
Location: Liverpool, NY USA
Posts: 2,219
Quote:
Originally Posted by donraja_ht View Post
yes that is true Littlefoot i wanted something like this but i have modefied it cause i don't want seconds also is it possible to display AM PM as the unit
Of course, simply change the format mask. Instead of "hh24:mi.ss" use "hh:mi AM"
__________________
Bill
You do not need a parachute to skydive. You only need a parachute to skydive twice.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On