I have the following MySQL timestamp: 2009-06-23 16:21:48 How can I convert it to a format like mktime()?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You could use the strtotime function.
ok, I was wrestling with this for a week (longer but i took a break from it).
I have two specific fields in tables
they were pulling out either dec 31 1969, or just nothing... annoying... very annoying
in mysql query i did:
in php convert i did:
this solved my problem for me returning
respectively.
I hope this helps someone out...
There is a MySQL function
unix_timestamp
. In your SQL query, instead of selecting the Datetime or Timestamp column directly, do this:Alternatively, if you have the string already, you could use the PHP function
strtotime()
.