0

I was wondering how to store this date into the database:

Friday, August 28, 2015

and this time:

8:00PM

I have one field that collects the date and another for the time.. Im looking to store them in this format, 0000-00-00 00:00:00.. Is there some way to turn this date "Friday, August 28, 2015" into this "0000-00-00 00:00:00" so it will be inserted into the database using DATETIME??

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by buddylee17
0

Datetime is in the YYYY-MM-DD HH:MM:SS format so, Friday, August 28, 2015 at 8:00PM would be:
2015-08-28 20:00:00

0

Thanks.. I think I got it all good..

<?php
$d = 'Friday, August 28, 2015';
$t = '8:00PM';

echo  date ('Y-m-d H:i:s', strtotime ($d.' '.$t));
?>

That worked like a charm..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.