Format date in SELECT * query

后端 未结 5 1915
萌比男神i
萌比男神i 2020-12-17 20:25

Is it possible to format a date field in a SELECT * query? I want to get all of the columns from my table but need a different format from the date.

Something like:<

5条回答
  •  攒了一身酷
    2020-12-17 20:55

    select DATE_FORMAT(your_date_field_name,'%m-%d-%y') AS whatever FROM your_table_name_here;
    

    the result is something like this

    09-22-11

    as opposed to this

    2011-02-02 15:42:51

提交回复
热议问题