Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    58

    Unanswered: difference between dates

    Hi, a table has a date column of this form: 4/11/2004 10:47:46 PM. (DATE). Is there a way to select records in the past 24 hrs (including seconds)?

    Thanks in anticipation

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: difference between dates

    If the date/time now is 4/11/2004 10:47:46 PM, then

    WHERE datecol > SYSDATE-1

    will select all records dated later than 4/10/2004 10:47:46 PM

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    to go a bit further on what Tony stated:

    PHP Code:
    select from tablename
    where date_column 
    to_date('4/11/2004 22:47:46','MM/DD/YYYY HH24:MI:SS')
    and 
    date_column to_date('4/11/2004 22:47:46','MM/DD/YYYY HH24:MI:SS')+1
    so, if you know one date then all you need to do is add a day (+1) or
    subtract a day (-1).

    Have fun.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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