I am using the following jquery date & time picker on a diary page.
http://trentrichardson.com/examples/timepicker/#rest_examples
Its quick and easy to use and makes a date thats easy to read but the problem I am having is that im not sure how on earth to convert it to a standard mysql date format to save it to the database.
At the moment when I select a date and time it will add it to the timedate input box as something like this >>
Wed January 9, 2013 01:43 pm
If I then hit submit, it doesn’t get saved to the database.
Does anyone know how I can convert this into a format in the php that processes the posted data and save it as usual, as its driving me round the bend trying to work out a way of converting it ?.
The code im currently using for the jquery part is the following :
<script type="text/javascript">
$(function(){
$('#timedate').datetimepicker({
timeFormat: "hh:mm tt",
dateFormat: "D MM d, yy"
});});</script>
which creates a date like :
Wed January 9, 2013 01:43 pm
Use
DateTime::createFromFormat():Confirmed working