MYSQL DATE_FORMAT功能不起作用

时间:2022-04-20 01:27:15

I am currently working on a gig guide and would like to format the date as: Day - Month - Date

我目前正在制作一个演出指南,并希望将日期格式化为:日 - 月 - 日期

I'm using the following mysql query -

我正在使用以下mysql查询 -

$query_getEvents = "SELECT gig_guide.date, gig_guide.artist, gig_guide.venue, 
gig_guide.tickets, DATE_FORMAT(gig_guide.date, '%M %e, %Y') 
FROM gig_guide ORDER BY gig_guide.date ASC";

Unfortunately the DATE_FORMAT is not formatting and keeps returning the standard 0000-00-00 format instead of the way I want it.

不幸的是,DATE_FORMAT没有格式化并且不断返回标准的0000-00-00格式而不是我想要的方式。

Any ideas what may have gone wrong with this code? Or could it be a direct problem with the database itself and the date structure.

任何想法这个代码可能出了什么问题?或者它可能是数据库本身和日期结构的直接问题。

1 个解决方案

#1


0  

If the month is not setted in gig_guide.date, the mysql can't make representation 00.month as a string.

如果未在gig_guide.date中设置月份,则mysql无法将00.month表示为字符串。

Try it with some date which have month setted.

尝试使用月份设置的日期。

#1


0  

If the month is not setted in gig_guide.date, the mysql can't make representation 00.month as a string.

如果未在gig_guide.date中设置月份,则mysql无法将00.month表示为字符串。

Try it with some date which have month setted.

尝试使用月份设置的日期。