Reputation: 3411
Bootstrap time picker gives me Date in this format:
Mon Mar 16 2015 00:00:00 GMT-0500 (Central Daylight Time)
I would like to use it as a Date object in PHP.
I am attempting to use it like:
date("Y-m-d H:i:s" , strtotime("Mon Mar 16 2015 00:00:00 GMT-0500 (Central Daylight Time)"));
But that results in:
1969-12-31 18:00:00
Which I understand to be pretty close to EPOCH.
I'm thinking I'm either using the wrong function, or I formatted date() wrong.
I am using the TimePicker from here.
Upvotes: 0
Views: 434
Reputation: 515
strtotime only works on certain formats of which can be found here http://php.net/manual/en/datetime.formats.php
Mar 16 2015 00:00:00 GMT-0500
The above portion should return the right time value for you. Either change the way that the picker is outputting the date, without knowing which picker I will assume its this one http://bootstrap-datepicker.readthedocs.org/en/latest/options.html#format or do some string manipulation on the current date format from the picker (the first option would be simpler and easier to read).
Upvotes: 1