Thread: Date = today

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

    Join Date
    Jun 2012
    Posts
    17
    Rep Power
    0

    Date = today


    Hi

    How can I add a where clause that states that the field

    invoice_date (which is a datetime field)

    Is equal to the currentdate?

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,785
    Rep Power
    348
    Originally Posted by dibblejon
    invoice_date (which is a datetime field)
    Postgres does not have a "datetime" data type. Do you mean "timestamp"?

    Originally Posted by dibblejon
    Is equal to the currentdate?
    Something like this?
    Code:
    where cast(invoice_date as date) = current_date
    More details in the manual: http://www.postgresql.org/docs/current/static/functions-datetime.html
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    17
    Rep Power
    0

    Great Thanks



IMN logo majestic logo threadwatch logo seochat tools logo