= sfDateTimePlugin plugin = == Credits == This plugin has been mainly written by Stephen Riesenberg. I merely maintains it (fixing minor bugs, porting to sf1.1 and a few feature enhancements) == Overview == This plugin will add a date manipulation library to the symfony framework. The library manipulates timestamp values, allowing you to quickly translate a date into another date based on an infinite number of operations. The library contains a base add function, which handles all cases of a single date manipulation. It also contains a large number of other functions based on the add function, which faciliate more complicated operations. Finally, the library contains an instantiable class, which provides an interface hook into the main library allowing chainable date manipulation operations for more readable code. == Installation == To install sfDateTimePlugin: {{{ symfony plugin-install symfony/sfDateTimePlugin }}} or {{{ svn co http://svn.symfony-project.com/plugins/sfDateTime2Plugin plugins/sfDateTime2Plugin }}} Clear your cache {{{ symfony cc }}} You're done! == Usage == Examples which dump their results to a datetime. {{{ #!php firstDayOfWeek()->tomorrow()->dump(); // => 2007-04-16 19:39:05 echo $dt->addYear()->subtractQuarter()->dump(); // => 2008-01-16 19:39:05 echo $dt->finalDayOfQuarter()->clearTime()->dump(); // => 2008-03-31 00:00:00 echo $dt->finalDayOfYear()->subtractWeek(4)->addDay(5)->dump(); // => 2008-12-08 00:00:00 echo $dt->reset()->dump(); // => 2007-04-17 19:39:05 }}} The I18N date helpers are integrated directly into the library. {{{ #!php Next sunday in your language: firstDayOfWeek()->addWeek()->date() ?> Last thursday in your language: previousDay(sfTime::THURSDAY)->date() ?> Now in your language: datetime() ?> }}} == Documentation == === Constants === Constants are available through the sfTime class (as in sfTime::CONSTANT_NAME): * Units of time * SECOND * MINUTE * HOUR * DAY * WEEK * MONTH * QUARTER * YEAR * DECADE * CENTURY * MILLENIUM * Days of the week * SUNDAY * MONDAY * TUESDAY * WEDNESDAY * THURSDAY * FRIDAY * SATURDAY * Months of the year * JANUARY * FEBRUARY * MARCH * APRIL * MAY * JUNE * JULY * AUGUST * SEPTEMBER * OCTOBER * NOVEMBER * DECEMBER === Functions === The following functions are available to an instantiated sfDate object, and are chainable: * add * parameters * number of units * unit of time * subtract * parameters * number of units * unit of time * add functions * format: add