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

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: 175 682 times
Version: 2.0
Category: How-tos
Written by: Kartik V
Last updated by: Kartik V
Created on: May 16, 2014
Last updated: 9 years ago
Update Article

Revisions

View all history