This article is a mirror article of machine translation, please click here to jump to the original article.

View: 8690|Reply: 0

How PHP converts datetime in mysql to int format

[Copy link]
Posted on 2/23/2016 4:42:10 PM | | |

The database date type is of int type, and the query result is of datetime type

SELECTfrom_unixtime( `dateline` ) FROM cdb_posts

If the original type is datetime, the query result must be of int type

SELECTunix_timestamp( `dateline` ) FROM cdb_posts

The key to PHP time conversion is to see when you want to get the corresponding time type

$timestamp = 1210003200; $datetime = date('Y-m-d H:i:s', $timestamp); echo "The time represented by the timestamp:", $datetime, "\n"; echo "revert to timestamp from this time:", strtotime($datetime), "\n";


Get system time unix_timestamp (now())




Previous:C# Form-to-Form Values (Using Delegates vs. Custom Events)
Next:Join the jQuery library in Chrome Console
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com