mysql时间的应用

时间比较的方式

查询写文章的时间列表

select distinct  DATE_FORMAT(a.last_modify_time,'%Y年%m月') as yearmonth from article as a  where   a.userid=1 
 

 

 查询某个月的文章信息

select   *   from   note   where   date_format(time, '%Y%m ')= '200705 '
  判断一个时间是否在一个区间内

 

        select * from table where unix_timestamp( time ) between unix_time_stamp( start ) and unix_timestamp( end )

  

 

你可能感兴趣的:(mysql,unix)