From: http://yushine.iteye.com/blog/775407
From_unixtime to convert UNIX timestamps to standard Time
Unix_timestamp convert standard Time to UNIX timestamp//query statement you cannot use the Strtotime () function! But you can use the Unix_timestamp
Date_format (' 1997-10-04 22:23:00 ', '%y-%m-%d ') format time
such as: Select From_unixtime (pubdate) from article where pubdate >unix_timestamp (' 2007-10-27 00:00:00 ');
Date is the parameter that needs to be processed (the parameter is a UNIX timestamp), can be a field name, or it can be a Unix timestamp string
The following '%y%m%d ' is primarily the formatting of the return value
For example:
Mysql>select from_unixtime (1195488000, '%y%m%d ')
->20071120
Mysql>select from_unixtime (1195488000, '%y year%m Month%d ')//Remember to add "%"
->2007 Year November 20
Unix_timestamp () is a time function that is opposite to it
For example:
mysql> SELECT unix_timestamp (' 2007-11-20 ');
->1195488000
MySQL common built-in functions-the strtotime () function cannot be used in query statements!