Last active
August 29, 2015 13:56
-
-
Save umidjons/9183735 to your computer and use it in GitHub Desktop.
Format date and time in Yii with CFormatter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// in config/main.php | |
array( | |
'components'=>array( | |
'format' => array( | |
'datetimeFormat' => 'd.m.Y H:i:s', | |
'dateFormat' => 'd.m.Y', | |
), | |
) | |
) | |
// usage: | |
// $data->created_at timestamp value | |
Yii::app()->format->formatDate( $data->created_at ); // 24.02.2014 | |
Yii::app()->format->formatDatetime( $data->created_at ); // 24.02.2014 13:17:39 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment