tomharto
09-12-2011, 11:10 PM
I need to convert a date in the format dd/mm/yyyy (date format got from jQuery datepicker) and i need to convert it to a timestamp.
I tried time($_POST['datepicker']);
but that didnt work, how would i do this?
BluePanther
09-12-2011, 11:16 PM
http://php.net/manual/en/function.strtotime.php
strtotime($_POST['datepicker']) should return a valid timestamp I think. I would check it though.
Easy way to check:
// Both should echo the same thing
echo $_POST['datepicker']."\n";
echo date("d/m/Y", strtotime($_POST['datepicker']));
tomharto
09-12-2011, 11:39 PM
Ahh, that worked, thank you :)
BluePanther
09-13-2011, 12:18 AM
No problem :). The manual has a full list of time/date formats strtotime will accept, just as an FYI :)