Truncate datetime column in MySQL query

前端 未结 1 1104
有刺的猬
有刺的猬 2021-01-27 09:54

I have a column I am using as part of a select that uses this format (2011-09-28 14:51:59). How do I remove the time element and just keep the date all within my query?

相关标签:
1条回答
  • 2021-01-27 10:29

    Try this one

    DATE_FORMAT

    SELECT DATE_FORMAT(PictureModifiedDateTime,'%y-%m-%d') AS FILE_DATE WHERE column = "blah"
    

    or use date

    DATE

    SELECT DATE(PictureModifiedDateTime) AS FILE_DATE WHERE column = "blah"
    
    0 讨论(0)
提交回复
热议问题