I need to insert a string which looks like this:
"2014-11-25T14:13:35.000Z"
in a MySql database and using PHP in a TIMESTAMP
field.
How can I format the string for insertion using PHP?
I need to insert a string which looks like this:
"2014-11-25T14:13:35.000Z"
in a MySql database and using PHP in a TIMESTAMP
field.
How can I format the string for insertion using PHP?
You can also do this by using the function that Silvio has commented with the function date to format before inserting into the database:
$timestamp = date('Y-m-d H:i:s', strtotime("2014-11-25T14:13:35.000Z"));
You can use strtotime
$timestamp = strtotime("2014-11-25T14:13:35.000Z"); // 1416924815