1
I need to insert a string that is like:
"2014-11-25T14:13:35.000Z"
in a Mysql database and using PHP in a field TIMESTAMP
.
How can I format the string for insertion using PHP?
1
I need to insert a string that is like:
"2014-11-25T14:13:35.000Z"
in a Mysql database and using PHP in a field TIMESTAMP
.
How can I format the string for insertion using PHP?
1
You can also do so, using the function that Silvio 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"));
0
You can use the strtotime
$timestamp = strtotime("2014-11-25T14:13:35.000Z"); // 1416924815
Browser other questions tagged php mysql
You are not signed in. Login or sign up in order to post.
You can use the function
sprintf
http://php.net/manual/en/function.sprintf.php– MeuChapeu
If this were not a date -OR- it did not have the definition of Timezone (.000Z), yes. I wanted to know what it would look like with Datetime, but after what I suffered last time dealing with timezones with it, I won’t even try. : p
– Bruno Augusto