I-AM-OBODO Posted July 4, 2012 Share Posted July 4, 2012 Hi all. In my code I use MySQL curdate() and now() to insert the current date and time in my db. and to get the date and time output I used a calender script I found on internet. the calendar inputs date in the format 12/10/2020 and MySQL date and time format is different (which I believe that's why my script isnt working) I did a select * from table_name where user is boy and date between $start and $end but all I'm getting is blank page. I think I need to conver my form date to something MySQL will understand before I can get an output but I don't know how? how can I achive a result thanks Link to comment https://forums.phpfreaks.com/topic/265207-select-date-problem/ Share on other sites More sharing options...
Pikachu2000 Posted July 4, 2012 Share Posted July 4, 2012 Without knowing anything about the calendar application, and seeing the code you're using, that question is impossible to answer. Link to comment https://forums.phpfreaks.com/topic/265207-select-date-problem/#findComment-1359147 Share on other sites More sharing options...
Barand Posted July 4, 2012 Share Posted July 4, 2012 Mysql uses yyyy-mm-dd format. You need to convert your calendar dates to that for mat for comparisons $ymd = date('Y-m-d', strtotime($calendardate)); Link to comment https://forums.phpfreaks.com/topic/265207-select-date-problem/#findComment-1359154 Share on other sites More sharing options...
Barand Posted July 4, 2012 Share Posted July 4, 2012 PS if your 12/10/2020 date is US mm/dd/yyyy then it should work. Unfortunately, PHP does not consider the European dd/mm/yyyy to be a valid date format, so if you're from my side of the pond it won't work so easily. Link to comment https://forums.phpfreaks.com/topic/265207-select-date-problem/#findComment-1359171 Share on other sites More sharing options...
I-AM-OBODO Posted July 5, 2012 Author Share Posted July 5, 2012 Mysql uses yyyy-mm-dd format. You need to convert your calendar dates to that for mat for comparisons $ymd = date('Y-m-d', strtotime($calendardate)); Thanks. It's working now Link to comment https://forums.phpfreaks.com/topic/265207-select-date-problem/#findComment-1359232 Share on other sites More sharing options...
I-AM-OBODO Posted July 5, 2012 Author Share Posted July 5, 2012 Thanks guys. It now working Link to comment https://forums.phpfreaks.com/topic/265207-select-date-problem/#findComment-1359233 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.