Source for file Date.class.php
Documentation is available at Date.class.php
* Gumbo Library Framework
* This library is being released under the terms of the New BSD License. A
* copy of the license is packaged with the software (LICENSE.txt). If no
* copy is found, a copy of the license template can be found at:
* http://www.opensource.org/licenses/bsd-license.php
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* Checks if the current year is a Leap Year
* @throws Gumbo_Exception
* Resets the state to the original time stamp
public function reset ();
* Sets the time to the zero hour
* @postcondition $minutes=0
* @postcondition $seconds=0
* Increases the Year by number
* @throws Gumbo_Exception
* Increases the Month by number.
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* Marks the Date as a Holiday
* @throws Gumbo_Exception
* Sets the Date values of the object
public function setDate ($year, $month, $day);
* Sets the Time values of object
public function setTime ($hour, $minutes, $seconds);
* Sets the Date by a stamp parsed down to yyyymmdd[hhmmss] format
* @throws Gumbo_Exception
* Sets the Date by the UNIX Epoch
* @throws Gumbo_Exception
* @throws Gumbo_Exception
* The value can be the numberical month, a three-letter abbreviation of the
* month name, or the full name.
* @precondition if int, 0 < $val < 13
* @param int|string$month
* @throws Gumbo_Exception
* @precondition 0 < $val <= 31
* @throws Gumbo_Exception
public function setDay ($day);
* @precondition 0 <= $val < 24
* @throws Gumbo_Exception
* @precondition 0 <= $val < 60
* @throws Gumbo_Exception
* @precondition 0 <= $val < 60
* @throws Gumbo_Exception
* Returns a Date string in predefined format
* - 0 => yyyy-mm-dd hh:mm:ss (MySQL DATETIME)
* To use more complex combinations, use a combination of the
* getDate() and getTime() methods.
* @param int $format format code
* @throws Gumbo_Exception
public function get ($format=
null);
* Returns a formatted Date string
* - 0 => yyyy-mm-dd (default)
* - 5 => Mon [d]d[suffix], yyyy
* - 6 => Month [d]d[suffix], yyyy
* - 7 => Day, [d]d Mon yyyy
* The method also uses the date() and strftime() functions. The format
* would have to be a string representing values the function will parse.
* If the percent sign (%) is found, it will use strftime(), else it will
* @param string|int$format pre-defined format code or string stamp
* @throws Gumbo_Exception
public function getDate ($format=
null);
* Returns a formatted Time string
* - 0 => hh:mm:ss (default)
* - 9 => hh:mm:ss [am|pm]
* - 11 => [h]h:mm:ss [am|pm]
* @param int $format pre-defined time format
* @throws Gumbo_Exception
public function getTime ($format=
null);
* @throws Gumbo_Exception
* Returns the Year requested format
* @throws Gumbo_Exception
public function getYear ($format=
null);
* Returns the Month in the requested format
* 2 -> Mon (abbreviation)
* @throws Gumbo_Exception
public function getMonth ($format=
null);
* Returns the Day in the requested format
* - 2 => ## (numerical day of week)
* - 3 => Day (abbreviation)
* - 5 => ## (day of year)
* @throws Gumbo_Exception
public function getDay ($format=
null);
* Returns the Hour in the requested format
* - 0 => [h]h (24-hour format)
* - 1 => hh (24-hour format)
* - 2 => [h]h (12-hour format)
* - 3 => hh (12-hour format)
* @throws Gumbo_Exception
public function getHour ($format=
null);
* Returns the Minutes in the requested format
* @throws Gumbo_Exception
* Returns the Seconds in the requested format
* @throws Gumbo_Exception
* Returns an array of factual months
* Returns the total days within a month
* @throws Gumbo_Exception
* Returns if the current day is on the weekend
* Returns if the current day is on the weekday
* Returns if the current day is a holiday
public function isMay ();
* Returns the difference from the supplied Date
* @param Gumbo_Interface_Date $date
* @return array [when|year|month|day|hour|minute|second]
public function diff (Gumbo_Interface_Date $date);
* Returns the number of Years difference
* @param int|Gumbo_Interface_Date$val
* Returns the number of Months difference
* @param Gumbo_Interface_Date $val
public function diffMonth (Gumbo_Interface_Date $val);
* Returns the number of Weeks difference
* @param Gumbo_Interface_Date $val
public function diffWeek (Gumbo_Interface_Date $val);
* Returns the number of Days difference
* @param Gumbo_Interface_Date $val
public function diffDay (Gumbo_Interface_Date $val);
* Returns the AM/PM time value
* @param bool $in_caps returns value in caps
* @throws Gumbo_Exception
public function meridien ($in_caps=
false);