How can I use "strtotime" to change a text date input field to a datetime value to store in db? Is there a function to insert in functions.php?
How can I use "strtotime" to change a text date input field to a datetime value to store in db? Is there a function to insert in functions.php?
Hi, monkeyproof,
Take a look at the code I added to this topic - http://www.gravityhelp.com/forums/topic/creating-publish-date-from-date-field . In that code, I took fields from the form for the date and time and combined them to save to the database. The line below is the final code used to format the string correctly to save to the db.
$post_date = date("Y-m-d H:i:s",strtotime($date_value . " " . $time_value));