2015-09-07 13 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));