Results 1 to 3 of 3

Thread: Help me

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    32

    Unhappy Help me

    Assuning that I have a table with time stamp as one of the filed...
    What would be the query to find the rows inserted with in the last 48 hours???
    Hope u can help me!!!

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Help me

    Assuming you're storing it in the database as a UNIX time stamp, this will find the last 48 hours in seconds, followed by a sample query.
    PHP Code:
    <?
      $twodays = time() - (3600 * 48) //3600 is the amount of seconds in an hour, multiplied by 48 = 48 hours
      $query = "SELECT * FROM tablename WHERE timestamp>=($twodays)";
      //do other stuff
    ?>
    Like Archer? Check out some Sterling Archer quotes.

  3. #3
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Re: Help me

    Mysql?
    From the manual here:
    http://dev.mysql.com/doc/refman/5.0/...functions.html

    Alter it to use two days:
    PHP Code:
    SELECT something FROM tbl_name
      WHERE DATE_SUB
    (CURDATE(),INTERVAL 2 DAY) <= date_col
    Good luck
    {yak}

Posting Permissions

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



Click Here to Expand Forum to Full Width