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??

Recommended Answers

All 3 Replies

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

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..

Glad to hear

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.