关于时间查询

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')

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值