predator Posted June 24, 2007 Share Posted June 24, 2007 Hi all i have a problem with my php and mysql i am trying to right a date into the mysql database but when i get the date from the html form and do strtotime on it it goes to an invalid date (by this i mean it is not the date i entered in the html form so for example 22-06-2007 changes to 28-11-2027). can anyone help me as this is really annoying and has been happening for like 3 to 4 days now and i just cannot work it out. i am calling the correct field so i dont no what is happening can anyone help please. Regards Mark Link to comment https://forums.phpfreaks.com/topic/56999-solved-date-problems/ Share on other sites More sharing options...
Barand Posted June 24, 2007 Share Posted June 24, 2007 strtotime doesn't recognise dd/mm/yyyy format. Reformat yourself with <?php $mydate = '22-06-2007'; list ($d, $m, $y) = explode ('-', $mydate); $dbdate = "$y-$m-$d"; Link to comment https://forums.phpfreaks.com/topic/56999-solved-date-problems/#findComment-281558 Share on other sites More sharing options...
predator Posted June 24, 2007 Author Share Posted June 24, 2007 i am entering the date in the format of 22-06-2007 Link to comment https://forums.phpfreaks.com/topic/56999-solved-date-problems/#findComment-281560 Share on other sites More sharing options...
Barand Posted June 24, 2007 Share Posted June 24, 2007 It doesn't recognise british dd mm yyy of any flavour. Link to comment https://forums.phpfreaks.com/topic/56999-solved-date-problems/#findComment-281565 Share on other sites More sharing options...
predator Posted June 24, 2007 Author Share Posted June 24, 2007 o right got ya tanks dude worked straight away after i changed it Regards Mark Link to comment https://forums.phpfreaks.com/topic/56999-solved-date-problems/#findComment-281568 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.