Skip to content

A simple date parser and formatter for dealing with partial dates.

Notifications You must be signed in to change notification settings

bigfishtv/partial-date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Build Status

Partial Date

A simple PHP date parser and formatter for dealing with partial dates. This is handy when you want to store a year or year/month in MySQL date format without specifying a month or day.

<?php

use Bigfish\PartialDate;

// from Australian date format to SQL
$date = new PartialDate('2/2015');
echo $date->toSQLFormat(); // outputs 2015-02-00

// from SQL date format to Australian
$date = new PartialDate('2015-02-00');
echo $date->toAusFormat(); // outputs 02/2015

// parse method
$data = new PartialDate();
$date->parse('12/12/14');

// setDate method
$data = new PartialDate();
$date->setDate(2015, 2, 3);

About

A simple date parser and formatter for dealing with partial dates.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages