convert mysql timestamp into actual date and time?

后端 未结 3 2118
我在风中等你
我在风中等你 2020-12-24 01:48

I have dates stored in a mysql table, they are set to store as CURRENT TIMESTAMP in each row and are stored as follows:

2010-05-29 01:17:35

3条回答
  •  情歌与酒
    2020-12-24 02:19

    If you have a DATETIME field in your table and you only want the date field, then:

    SELECT DATE_FORMAT(timestamp,'%M %D, %Y') FROM Mytable;
    

    or:

    SELECT DATE_FORMAT(timestamp,'%Y-%m-%d') FROM Mytable;
    

    where timestamp is your column name.

提交回复
热议问题