dcsimg
Results 1 to 2 of 2

Thread: help with displaying date and time

  1. #1
    Join Date
    Aug 2011
    Posts
    1

    help with displaying date and time

    SQL> desc guide;
    Name Null? Type
    ----------------------------------------- -------- ----------
    GUIDE_ID NOT NULL NUMBER(20)
    CHANNEL_ID NOT NULL NUMBER(5)
    SHOW_DATETIME DATE


    select channel.channel_id AS "Channel", supplier_name AS "Supplier", program_name AS "Program", package_name,
    program.rating_code AS "Rating", To_DATE(show_datetime, 'DD-MON-YYYY hh12:mi AM') as "Show Time"
    from channel, supplier, program, package, rating, guide
    where channel.channel_id = program.channel_id
    and package.package_id = channel.package_id
    and rating.rating_code = program.rating_code
    and supplier.channel_id = channel.channel_id
    and channel.channel_id = guide.channel_id
    and guide.show_datetime BETWEEN TO_DATE('15-aug-2011') AND ('16-AUG-2011')
    order by channel.channel_id, guide.show_datetime;

    Here is the display:

    Channel Supplier Program PACKAGE_NAME Rating Show Time
    ---------- ------------------------------ -------------------------------------------------- -------------------- ------- ---------
    1 NBC C-3PO RETURNS Movies_Galore PG 15-AUG-11
    1 NBC BARETTA Movies_Galore M 15-AUG-11
    1 NBC ALASKAN WILD YONDER Movies_Galore PG 15-AUG-11
    1 NBC MANIC MONDAYS Movies_Galore R 15-AUG-11
    2 NBC WOODLAND FAIRIES Total_Watcher G 15-AUG-11
    2 NBC AMONG THE LAVENDAR FIELDS Total_Watcher MA 15-AUG-11
    2 NBC TOKYO HEIGHTS Total_Watcher M 15-AUG-11
    3 ABC TOP GLOBAL NEWS News_Globe G 15-AUG-11
    3 ABC US BUSINESS WORLD News_Globe G 15-AUG-11
    4 ABC CBS NEWS Total_Watcher G 15-AUG-11
    4 ABC ABC NEWS Total_Watcher G 15-AUG-11

    Channel Supplier Program PACKAGE_NAME Rating Show Time
    ---------- ------------------------------ -------------------------------------------------- -------------------- ------- ---------
    4 ABC NBC TONIGHT Total_Watcher G 15-AUG-11
    5 FOX HOME MAKEOVER Couch_Potato G 15-AUG-11
    5 FOX WWW.ONLINEBARGAINS.COM Couch_Potato G 15-AUG-11
    5 FOX COOKING WITH MARIO Couch_Potato G 15-AUG-11
    6 FOX FITNESS WAVE Movies_Galore G 15-AUG-11
    6 FOX ALL THAT GLITTERS Movies_Galore G 15-AUG-11
    6 FOX HOUSE OF OHM Movies_Galore G 15-AUG-11
    6 FOX SHOPPING NETWORK Movies_Galore G 15-AUG-11
    7 NBC GREATEST WORLD HISTORY Total_Watcher G 15-AUG-11
    7 NBC TRAVELING EUROPE Total_Watcher G 15-AUG-11
    7 NBC THE NATURAL WORLD Total_Watcher G 15-AUG-11

    Channel Supplier Program PACKAGE_NAME Rating Show Time
    ---------- ------------------------------ -------------------------------------------------- -------------------- ------- ---------
    10 WARNER HOOPS AND HOLLERS Total_Watcher G 15-AUG-11

    23 rows selected.


    when I run this query it only displays the date but no time. So can anyone help me out on how to display it with
    the date and time? Thanks in advance for all help.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,911
    Use TO_CHAR instead

    To_CHAR(show_datetime, 'DD-MON-YYYY hh12:mi AM')

Posting Permissions

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