Skip to content

Returns a date time object for virtually any date in a string.

Notifications You must be signed in to change notification settings

BookOfOrigin/GiveMeADate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Give Me A Date

Description: Takes any string and attempts to find a date in that string regardless of format.

GiveMeADate extends PHP's DateTime object. So it has all of the same functions and features you need.

Examples:

$date = new GiveMeADate('my birthday is October 14, 1992.'); $date = new GiveMeADate('some text October 5th 86 some text'); $date = new GiveMeADate('2011-01-11');

You can use this to do some awesome stuff. Example:

if((new GiveMeADate('my birthday is November 11, 2001')) < ((new DateTime())->modify('-21 years'))){ // Person is unable to drink. } else { /// Person is able to drink. }

Notes: As with anything please use this responsibly. This class is not fool proof. The universe can always make a better idiot... yada... yada...

License: WTFPL

Like it? Buy me a beer:

Click here to lend your support to: Development Funds and make a donation at pledgie.com !

About

Returns a date time object for virtually any date in a string.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages