`
haohappy2
  • 浏览: 327606 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

how to deal with MYSQL DATE

 
阅读更多

suppose you use timestamp, but you need to get the date

 

SELECT

DISTINCT DATE( `LoginDate` )
FROM

loginlog

 

SELECT

DISTINCT left( `LoginDate` , 10 ) AS LDate

FROM

loginlog

 

SELECT

DISTINCT date_format( `LoginDate` , '%Y-%m-%d' ) AS 'Ldate'
FROM

loginlog

 

Suppose you use intval time format

SELECT

  DISTINCT FROM_UNIXTIME( LoginDate, '%Y%-m%-d%' ) AS 'Ldate'
FROM

loginlog

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics