SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: < Now()

  1. #1
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    < Now()

    This query selects all entryes before and today. I need to select only the dates that are BEFORE, but not today. where are the comparison functions for these cases?

    Code:
    select 
        tareas_alias.id 
    from 
        tareas tareas_alias      
    where 
        STR_TO_DATE( fecha, '%d/%m/%Y' ) < NOW()

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There's no reason to format a date just to use it in the WHERE clause, right?

    Code:
    WHERE fecha < CURDATE()

  3. #3
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i was using strtodate 'cause it was a non-date field, but your post taught me there's a slight difference between CURDATE and NOW.

    Thanks!


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
  •