关于时间查询

select * from task
select * from user_task
select * from user_account where name='关维康'

--MySql在固定的时间段
select * from pk_invite where created_at >= unix_timestamp("2011-05-10 00:00:00")*1000 and created_at <= unix_timestamp("2011-05-10 23:59:59")*1000

--查询某一天零点的时间
--1304956800000
select unix_timestamp("2011-05-10 00:00:00")*1000
--1304956800000
select unix_timestamp(CURDATE())*1000

--查询某一天23:59:59的时间
--1305043199000
select  unix_timestamp("2011-05-10 23:59:59")*1000
--1305043199000
select  (unix_timestamp(CURDATE()+1)-1)*1000

--查询当前时间2011-05-10 15:00:25
select Now()

--查询今天的日期2011-05-10
select CURDATE()

--对当前时间进行换算1305010901000
select unix_timestamp(Now())*1000

---PK每天发的PK
select * from pk_invite where  uid='kaixin001-10135' and  created_at BETWEEN unix_timestamp(CURDATE())*1000 and  (unix_timestamp(CURDATE()+1)-1)*1000

--查询最后访问的时间
select *, from_unixtime(latest_visited_at/1000,'%Y-%m-%d') as a from user_account

--查询今天的日期
select  date_format(now(),'%Y-%m-%d')
----查询今天用户登录信息
SELECT *, from_unixtime(latest_visited_at/1000,'%Y-%m-%d')
as a from user_account   where uid='kaixin001-1013345' and  from_unixtime(latest_visited_at/1000,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')

 

 

你可能感兴趣的:(关于时间查询)