Difference between #9 and #10 of
Save and Display Date/Time Fields in different formats in Yii2

Revision #10 has been created by Kartik V on Oct 19, 2014, 3:56:58 AM with the memo:

Change timestamp formats for Yii2 new i18n Formatter
« previous (#9)

Changes

Title unchanged

Save and Display Date/Time Fields in different formats in Yii2

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

date, format, time, datetime, save, display, i18n, extension, date control, datecontrol, timestamp, events, behavior

Content changed

[...]
```php
'formatter' => [
'class' => 'yii\i18n\Formatter',
'dateFormat' => '
php:d-M-Y', 'datetimeFormat' => 'php:d-M-Y H:i:s', 'timeFormat' => 'php:H:i:s',
]
```
[...]
```php
class Setup {
const DATE_FORMAT = '
php:Y-m-d'; const DATETIME_FORMAT = 'php:Y-m-d H:i:s'; const TIME_FORMAT = 'php:H:i:s';

public static function convert($dateStr, $type='date', $format = null) {
if ($type === 'datetime') {
$fmt = ($format == null) ? self::DATETIME_FORMAT : $format;
}
[...]
0 0
51 followers
Viewed: 178 083 times
Version: 2.0
Category: How-tos
Written by: Kartik V
Last updated by: Kartik V
Created on: May 16, 2014
Last updated: 10 years ago
Update Article

Revisions

View all history