2017 © Pedro Peláez
 

yii2-extension yii2-datetime-behavior

Yii2 DateTime Behavior

image

maddoger/yii2-datetime-behavior

Yii2 DateTime Behavior

  • Monday, May 21, 2018
  • by maddoger
  • Repository
  • 0 Watchers
  • 0 Stars
  • 38 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

Yii2 DateTime formatting behavior

Installation

The preferred way to install this extension is through composer., (*1)

Either run, (*2)

php composer.phar require --prefer-dist maddoger/yii2-datetime-behavior "*"

or add, (*3)

"maddoger/yii2-datetime-behavior": "*"

to the require section of your composer.json file., (*4)

Usage

For datetime format and timezone conversation you can use DateTimeBehavior., (*5)

In model behaviors for timestamp field:, (*6)

[
    'class' => DateTimeBehavior::className(),
    'attributes' => ['published_at'],
    'originalFormat' => 'U', //original format
    'originalTimeZone' => 'UTC', //original timezone

    'timeZone' => 'Europe/London', //local timezone
    'format' => 'datetime', //local format, Formatter format
]

Now you can use published_at as original attribute and published_at_local as user read-write attribute., (*7)

For date fields:, (*8)

[
    'class' => DateTimeBehavior::className(),
    'attributes' => ['birth_date'],
    'originalFormat' => 'Y-m-d',
    'format' => 'date',
    'timeZone' => 'UTC',
]

The Versions

21/05 2018

dev-master

9999999-dev

Yii2 DateTime Behavior

  Sources   Download

MIT

The Requires

 

by Vitaliy Syrchikov

extension yii2

21/05 2018

v2.0.0

2.0.0.0

Yii2 DateTime Behavior

  Sources   Download

MIT

The Requires

 

by Vitaliy Syrchikov

extension yii2

05/11 2016

v1.0.1

1.0.1.0

Yii2 DateTime Behavior

  Sources   Download

MIT

The Requires

 

by Vitaliy Syrchikov

extension yii2

05/11 2016

v1.0.0

1.0.0.0

Yii2 DateTime Behavior

  Sources   Download

MIT

The Requires

 

by Vitaliy Syrchikov

extension yii2