在mysql中,某字段的类型设置为了timestamp,那么我们现在希望取出指定时间段的记录,该如何做呢?
在php中有time()和strtotime()来进行日期和时间戳的格式化,而在mysql中也有类似的函数,它们就是unix_timestamp()和from_unixtime()函数
举例说明,参考如下sql语句:
1Select *
2 |
FROM (`x60_usr_subscribe`)
|
3 |
Where `status` = 1
|
4 |
AND unix_timestamp(stime) > 1351085010
|
5 |
AND unix_timestamp(stime) < 1354685130
|