dongzhi4690
dongzhi4690
2013-06-20 11:46

无法更改DATETIME格式

已采纳

How do I change the format of date + time in a database when calling it?

Currently it's:

YYYY-MM-DD Days:HH:MM

But I need it to be:

DD-MM-YYYY Days:HH:MM

I tried this approach

FORMAT(s.date, 'DD-MM-YYYY')

But it gives me something like this:

20,130,618,232,643

Because it has time included I think.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dp19001 dp19001 8年前

    Use DATE_FORMAT(date, format):

    DATE_FORMAT(s.date,'%d-%m-%Y')
    
    点赞 评论 复制链接分享