ehdesign Posted August 9, 2007 Share Posted August 9, 2007 I am having trouble with the following. I want to enter a date into mySQL - 1999-02-26 (for example). Then I want to determine if the currnet date is 30 days (or whatever) from the MONTH AND DAY ONLY of the above date. So, if we use the above example, then I want the function to return TRUE on 1999-03-26 as well as return true on 2007-03-26, etc. So, I need to disregard the year and then find out if I am exactly x days from the date above. Any help? Link to comment https://forums.phpfreaks.com/topic/64134-date-problems/ Share on other sites More sharing options...
lemmin Posted August 9, 2007 Share Posted August 9, 2007 DATE_FORMAT(lastDate, '%M %D') as fDate Should return only the month and day. Link to comment https://forums.phpfreaks.com/topic/64134-date-problems/#findComment-319657 Share on other sites More sharing options...
Barand Posted August 9, 2007 Share Posted August 9, 2007 on the SQL side SELECT DATE_FORMAT (date, '%j') as day_of_year FROM mytablename On the PHP side $day_of_year = date('z', strtotime('2007-02-26')); Compare the two Link to comment https://forums.phpfreaks.com/topic/64134-date-problems/#findComment-319667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.