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 Quote Link to comment 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"; Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.