Skip to content

raponiwalter/Autodate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autodate V 1.0.0

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

CakePlugin::load('Autodate');

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%