Results 1 to 3 of 3

Thread: Recent date() entry

  1. #1
    Join Date
    May 2010
    Location
    Sacramento, CA
    Posts
    91
    Thanks
    23
    Thanked 2 Times in 2 Posts

    Default Recent date() entry

    Does anyone know why this code isn't working today?!



    Code:
    $four_days_ago = strftime("d-M-y", strtotime("-4 days")); 
    
    $query2 = "SELECT * FROM bobo WHERE date_time >= '$four_days_ago' ORDER BY id";
    I have a bulletin board, and on the front page it shows the recent post's for the last 4 days.. if i set the date of a database entry to 30MAY10 it works just fine.. but if it get's set to 01JUN10 it doesn't show up..

    Any help/thought is appreciated!

    Cory

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I assume it'd be the operation.
    30-4 = 26
    1-4 = -3
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    use the timestamp for comparison, instead of the formatted "d-M-y".

Bookmarks

Posting Permissions

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