Results 1 to 6 of 6

Thread: Date into time

  1. #1
    Join Date
    Sep 2007
    Posts
    56

    Unanswered: 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

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    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?

    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

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    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>

  4. #4
    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

  5. #5
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    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.

  6. #6
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •