cakephp-tutorial / autodate
Automatically convert date fields
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.2.0
- composer/installers: *
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-11-09 19:04:35 UTC
README
A CakePHP Plugin that will auto convert date fields from SQL format to a chosen date format (eg: d/m/Y). Will auto convert the date before saving to database, before find (to match conditions on db), after find and after update
Requirements
- CakePHP 2
- PHP 5.2
Compatibility
- V 1.x - CakePHP 2
Usage
/** * Attach to AppModel to auto convert all date fields * or attach it to a single model **/ class AppModel extends Model { public $actsAs = array( 'Autodate.Autodate' => array('dateformat' => 'd/m/Y') ); }
Available date Formats
- 'd-m-Y'
- 'd/m/Y'
- 'Y/m/d'
- 'Y-m-d'
- 'Y-d-m'
- 'Y/d/m'
- 'm-d-Y'
- 'm/d/Y'
- 'Ymd'
- 'Ydm'
Installation
Using composer
{
"require": {
"cakephp-tutorial/autodate": "1.0.0"
}
}
Manually Installation
- Download from github https://github.com/cakephp-tutorial/Autodate
- copy in app/Plugin/Autodate
- enable in app/Config/bootstrap.php
CakePlugin::load('Autodate');