Converting mysql TIME from 24 HR to AM/PM format

后端 未结 5 527
南旧
南旧 2020-12-17 14:37

I want to display the TIME field from my mysql table on my website, but rather than showing 21:00:00 etc I want to show 8:00 PM. I need a function/code to do this or even an

5条回答
  •  旧巷少年郎
    2020-12-17 15:37

    Check this out: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

    I'd imagine you'd want date_format().

    Example: DATE_FORMAT($date, "%r")

提交回复
热议问题