Hello again guys,
I'm formating the date and time from a date picker to mySQL and ok with the date. How can I ad the time to this?
$ad_date = explode("-", $_POST['ad_date']); $formatDate = $ad_date[2]."-".$ad_date[1]."-".$ad_date[0];
Thanks
You need to give more details, e.g., where is the time coming from, how you want it formatted, etc.
Ooops,😃
I want to formatted to mySQL TIMESTAMP. 0000-00-00 00:00:00 and is coming from a javascript date picker from this place http://www.javascriptkit.com/script/script2/tengcalendar.shtml the one with 12 hrs time Thank you
You probably could use [man]strtotime/man with [man]date/man, e.g.,
$formatDate = date('Y-m-d H:m:s', strtotime($_POST['ad_date']));
Laserlight that's a fix
Thank you
You're welcome 🙂 Remember to mark this thread as resolved using the thread tools.
I thought I did?
Apparently not, otherwise there would be a [Resolved] tag in the thread title.
Laserlight I had to changed to this format because the other one was inserting the minute 04 no matter what I put. This way is working.
Thanks again
$formatDate = date('Y-m-d h:i:s', strtotime($_POST['ad_date']));
Oh yeah, that was a typo error on my part 🙂