mysql query - format date on output?

后端 未结 4 1612
情书的邮戳
情书的邮戳 2021-01-16 06:57

In my table, dates are stored like this: 2011-03-03T13:30:00

I\'m trying to output dates like this: March 3, 2011 1:30 PM

I\'d much rather work it into the q

4条回答
  •  情话喂你
    2021-01-16 07:18

    The MySQL date storage format is actually YYYY-MM-DD, but using the str_to_date() and date_format() functions you can accept and generate any date format required.

    
    select DATE_FORMAT(DateTable.MyDate,'%d %b %y')
    from DateTable
    
    would return
    
    04 Nov 08
    
    

提交回复
热议问题