#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    101
    Rep Power
    11

    how do I filter the time field in oracle


    I have a table

    Schedule
    ------------
    id int
    mydate date
    starttime date
    endtime date

    What I actually required is the mydate (18-Jan-2004), starttime( 05:00 pm), endtime (06:00 pm).

    I am storing the data as follow:

    mydate 18-Jan-2004 12:00:00 AM
    starttime 18-Jan-2004 05:00:00 PM
    endtime 18-Jan-2004 06:00:00 PM

    Is there a better way to store these information?

    Say I current machine time (not the server time) is 04:00 PM and I would like to use this information to find id which starttime is later than 04:00 PM. Should I use to_date or is there a better way to construct the SQL statement?

    Thank you.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Have you tried using the `interval 'n' ` function?
    where current_date > sysdate + interval '4' hour;

IMN logo majestic logo threadwatch logo seochat tools logo