This article briefly introduces the time function and examples of mysql. Interested friends can refer to the time
function ofFROM_UNIXTIME FROM_UNIXTIME(unix_timestamp, format)
format. The second is the format you want to convert ultimately, such as
SELECT FROM_UNIXTIME(1436102304,'%Y年%m月%d日') as date;
UNIX_TIMESTAMP UNIX_TIMESTAMP(date)
SELECT UNIX_TIMESTAMP('2015-07-05');
Example: Find the records in the log table from 2015-05 to 2015-07:
SELECT id, FROM_UNIXTIME(time,'%Y-%m-%d') as date FROM log WHERE time BETWEEN UNIX_TIMESTAMP('2015-05-01') AND UNIX_TIMESTAMP('2015-07-01');
1.
Free mysql online video tutorialMySQL latest manual tutorialBoolean Education Yan Shiba mysql introductory video tutorialThe above is the detailed content of A brief introduction to mysql time functions and examples. For more information, please follow other related articles on the PHP Chinese website!