Jump to content

Days from date

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Nightracer

Nightracer

    Programmer

  • Members
  • PipPipPipPip
  • 131 posts
If I have a date in mysql say 9-20-2006, is there a query I can run that will get the days since then until today?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I believe you can use > and < in WHERE clauses on dates.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Void

Void

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 411 posts
Use the TO_DAYS() function of mysql.

Example:

SELECT TO_DAYS(CURDATE()) - TO_DAYS(my_field) FROM tbl;


Void