caliux Posted June 30, 2012 Share Posted June 30, 2012 Hello, I must make a search by date, last 5 days, last 15 days, how can make that, and also how should I insert in database the date, thank you, I have no ideea. Link to comment https://forums.phpfreaks.com/topic/265037-i-need-an-ideea-for-date/ Share on other sites More sharing options...
Pikachu2000 Posted June 30, 2012 Share Posted June 30, 2012 Use a DATE field, which takes the format YYYY-MM-DD. Then (if you're using MySQL) you can use MySQL's DATE_SUB() function to do the calculation. Link to comment https://forums.phpfreaks.com/topic/265037-i-need-an-ideea-for-date/#findComment-1358115 Share on other sites More sharing options...
Barand Posted June 30, 2012 Share Posted June 30, 2012 I always find WHERE mydatefield > CURDATE() - INTERVAL 15 DAY more intuitive than using DATE_SUB() Link to comment https://forums.phpfreaks.com/topic/265037-i-need-an-ideea-for-date/#findComment-1358144 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.