PHP code example of mdmsoft / yii2-format-converter
1. Go to this page and download the library: Download mdmsoft/yii2-format-converter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mdmsoft / yii2-format-converter example snippets
public function behaviors()
{
return [
[
'class' => 'mdm\converter\DateConverter',
'type' => 'date', // 'date', 'time', 'datetime'
'logicalFormat' => 'php:d/m/Y', // default to locale format
'physicalFormat' => 'php:Y-m-d', // database level format, default to 'Y-m-d'
'attributes' => [
'Date' => 'date', // date is original attribute
]
],
...
]
}