Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2009
    Posts
    124

    Unanswered: datediff question

    I need to display the number of dayes left between today and July 27 2013.

    I think I want to use DATEDIFF but not sure how to format it!

    Nick

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what have you tried so far, and what results did you get?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2009
    Posts
    64

  4. #4
    Join Date
    Sep 2009
    Posts
    1
    Please use the below query:
    SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days
    FROM titles

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by paramananda
    Please use the below query:
    SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days
    FROM titles
    sorry, this will fail in mysql
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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