Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    25

    Question Unanswered: How to display date only on datetime field?

    Hi,

    When I run the following statement, it still returns the time in zero's. How do I just return the date only?

    SQL: SELECT trunc(s.recd_date,'DD') AS registration_date FROM test s

    Results are the following...
    2012-07-27 00:00:00.0
    2012-07-27 00:00:00.0
    2012-07-27 00:00:00.0
    2012-07-27 00:00:00.0

    Thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Code:
     1* select sysdate now, to_char(sysdate,'YYYY-MM-DD') short  FROM DUAL
    07:46:23 SQL> /
    
    NOW		    SHORT
    ------------------- ----------
    2012-07-29 07:46:26 2012-07-29
    Last edited by anacedent; 07-29-12 at 11:47.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    The trunc command throws away the time element for a date. If you want to see the time then use

    SELECT to_char(s.recd_date,'MM/DD/YYYY HH:MI AM') AS registration_date FROM test s
    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
  •