表 名:archives
字 段:writer pubdate
数据格式: 张三 1384858337
writer=作者名称
pubdate=提交时间
我需要列出作者为张三当日提交的所有数据,求sql查询语句。
注:因为时间戳纯数字,所以考虑是否有必要把时间戳格式化为:%Y-%m-%d %h:%i。
select * from archives where date_format(FROM_UNIXTIME(pubdate),'%Y-%m-%d')=curdate() and writer='张三';
select * from archives where writer='张三' and pubdate between unix_timestamp(date(now)) and unix_timestamp(date(adddate(now(),1)));
select * from archives where writer='张三' and pubdate between unix_timestamp(date(now())) and unix_timestamp(date(adddate(now(),1)));