2015-09-07 45 views

回答

0

格式化使用此模式语法

http://stuff.cebe.cc/yii2docs/yii-i18n-formatter.html#$dateFormat-detail

http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax

您的格式将是这样的:

Yii::$app->formatter->asDate(strtotime($model->attribute), $format = "EEEE dd 'of' LLLL yyyy KK:m:s a") 

不知道如何添加模式中的“st”,“nd”,“rd”部分。从上面给出的模式中,这仍然是缺失的。 (你可以查找自己)

但你也可以只使用普通的PHP日期函数,如:

echo date("l jS \of F Y h:i:s A",strtotime($model->attribute));