如果我的MySQL日期如下2012-07-29 22:02:50
,并且我希望将其格式化为Jul 29 2012
,是否有一种简单的方法可以使用SELECT语句执行此操作?
目前我的sql语句如下所示:
$rs = mysql_query("SELECT Id, DATE_FORMAT(Date,\"%Y-%m-%d\") AS Date FROM infoTable WHERE credential = '$credential'");
这会输出2012-07-29
答案 0 :(得分:1)
试试这个:
$rs = mysql_query("SELECT Id, DATE_FORMAT(Date,\"%b %e %Y\") AS Date FROM infoTable WHERE credential = '$credential'");
答案 1 :(得分:0)
答案 2 :(得分:0)
$rs = mysql_query("SELECT Id, DATE_FORMAT(Date,\"%b %e %Y\") AS Date FROM infoTable WHERE credential = '$credential'");