Gumbo_Date
Variables
Constants
- DAYS_IN_LEAP_YEAR
- DAYS_IN_WEEK
- DAYS_IN_YEAR
- HOURS_IN_DAY
- HOURS_IN_LEAP_YEAR
- HOURS_IN_WEEK
- HOURS_IN_YEAR
- MINUTES_IN_DAY
- MINUTES_IN_HOUR
- MINUTES_IN_LEAP_YEAR
- MINUTES_IN_WEEK
- MINUTES_IN_YEAR
- MONTHS_IN_YEAR
- SECONDS_IN_DAY
- SECONDS_IN_HOUR
- SECONDS_IN_LEAP_YEAR
- SECONDS_IN_MINUTE
- SECONDS_IN_WEEK
- SECONDS_IN_YEAR
- WEEKS_IN_YEAR
Methods
- __construct
- diff
- diffDay
- diffMonth
- diffWeek
- diffYear
- get
- getCentury
- getDate
- getDay
- getHour
- getMinute
- getMonth
- getMonthFacts
- getSecond
- getTime
- getWeek
- getYear
- isApril
- isAugust
- isDecember
- isFall
- isFebruary
- isFriday
- isHoliday
- isJanuary
- isJuly
- isJune
- isLeapYear
- isMarch
- isMay
- isMonday
- isNovember
- isOctober
- isSaturday
- isSeptember
- isSpring
- isSummer
- isSunday
- isThursday
- isTuesday
- isWednesday
- isWeekday
- isWeekend
- isWinter
- meridien
- nextDay
- nextHour
- nextMinute
- nextMonth
- nextSecond
- nextWeek
- nextYear
- prevDay
- prevHour
- prevMinute
- prevMonth
- prevSecond
- prevWeek
- prevYear
- reset
- setDate
- setDateEpoch
- setDateStamp
- setDay
- setHoliday
- setHour
- setMinute
- setMonth
- setSeconds
- setTime
- setYear
- totalDays
- zeroHour
- _calcDayOfWeek
- _calcDayOfYear
- _calcWeekOfYear
- _change
- _getOrigStamp
- _parse
- _setOrigStamp
Date Class
| Author(s): |
Michael Luster <mluster79@yahoo.com> |
| License: | New BSD License |
| Copyright: | Copyright (c) 2007, iBayou, Michael Luster |
| Link: | http://sourceforge.net/projects/phpgumbo |
| Version: | 0.0.1 |
Implements interfaces:
Class Variables
Class Methods
Checks if the current year is a Leap Year
Parameter(s):
- (int) $year
- throws:
Gumbo_Exception Implementation of:
[ Top ]public Gumbo_Date __construct ( string|int $stamp, [int $month], [int $day], [int $hour], [int $minute], [int $seconds] ) [line 131]Constructor
Parameter(s):
- (string|int) $stamp :: full date stamp, or year value
- (int) $month
- (int) $day
- (int) $hour
- (int) $minute
- (int) $seconds
[ Top ]public array diff ( Gumbo_Interface_Date $date ) [line 1786]Returns the difference from the supplied Date
Parameter(s):
- (Gumbo_Interface_Date) $date
- return:
[when|year|month|day|hour|minute|second] Implementation of:
[ Top ]public int diffDay ( Gumbo_Interface_Date $val ) [line 1939]Returns the number of Days difference
Parameter(s):
- (Gumbo_Interface_Date) $val
Implementation of:
[ Top ]public int diffMonth ( Gumbo_Interface_Date $val ) [line 1889]Returns the number of Months difference
Parameter(s):
- (Gumbo_Interface_Date) $val
Implementation of:
[ Top ]public int diffWeek ( Gumbo_Interface_Date $val ) [line 1914]Returns the number of Weeks difference
Parameter(s):
- (Gumbo_Interface_Date) $val
Implementation of:
[ Top ]public int diffYear ( int|Gumbo_Interface_Date $val ) [line 1861]Returns the number of Years difference
Parameter(s):
- (int|Gumbo_Interface_Date) $val
Implementation of:
[ Top ]public int|string get ( [int $format] ) [line 1090]Returns a Date string in predefined format
Format Codes:
- 0 => yyyy-mm-dd hh:mm:ss (MySQL DATETIME)
- 1 => yyyymm
- 2 => yyyymmdd
- 3 => yyyymmddhh
- 4 => yyyymmddhhmm
- 5 => yyyymmddhhmmss
- 6 => UNIX EPOCH
Parameter(s):
- (int) $format :: format code
- throws:
Gumbo_Exception Implementation of:
[ Top ]public int|string getCentury ( [ $as_string] ) [line 1241]Returns the Century
Parameter(s):
- () $as_string
- throws:
Gumbo_Exception - uses:
Gumbo_Number Implementation of:
[ Top ]public void getDate ( [string|int $format] ) [line 1143]Returns a formatted Date string
Date Formats:
- 0 => yyyy-mm-dd (default)
- 1 => yyyymm
- 2 => yyyymmdd
- 3 => mm/dd/yyyy
- 4 => [m]m/[d]d/yyyy
- 5 => Mon [d]d[suffix], yyyy
- 6 => Month [d]d[suffix], yyyy
- 7 => Day, [d]d Mon yyyy
Parameter(s):
- (string|int) $format :: pre-defined format code or string stamp
- throws:
Gumbo_Exception - uses:
Gumbo_Number Implementation of:
[ Top ]public int|string getDay ( [int $format] ) [line 1358]Returns the Day in the requested format
Formats:
- 0 => [d]d
- 1 => dd
- 2 => ## (numerical day of week)
- 3 => Day (abbreviation)
- 4 => Day (full name)
- 5 => ## (day of year)
Parameter(s):
- (int) $format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public int|string getHour ( [int $format] ) [line 1399]Returns the Hour in the requested format
Formats:
- 0 => [h]h (24-hour format)
- 1 => hh (24-hour format)
- 2 => [h]h (12-hour format)
- 3 => hh (12-hour format)
Parameter(s):
- (int) $format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public int|string getMinute ( [int $format] ) [line 1453]Returns the Minutes in the requested format
Format:
- 0 => [m]m
- 1 => mm
Parameter(s):
- (int) $format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public int|string getMonth ( [int $format] ) [line 1309]Returns the Month in the requested format
Formats:
- -> [m]m
- -> mm
- -> Mon (abbreviation)
- -> Month (full name)
Parameter(s):
- (int) $format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public array getMonthFacts ( ) [line 1530]Returns an array of factual months
Implementation of:
[ Top ]public int|string getSecond ( [int $format] ) [line 1494]Returns the Seconds in the requested format
Format:
- 0 => [s]s
- 1 => ss
Parameter(s):
- (int) $format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public string getTime ( [int $format] ) [line 1201]Returns a formatted Time string
Time Format:
- 0 => hh:mm:ss (default)
- 1 => hh
- 2 => hhmm
- 3 => hhmmss
- 4 => hh:mm
- 5 => hh:mm [am|pm]
- 6 => [h]h:mm
- 7 => [h]h:mm [am|pm]
- 8 => hh:mm:ss
- 9 => hh:mm:ss [am|pm]
- 10 => [h]h:mm:ss
- 11 => [h]h:mm:ss [am|pm]
Parameter(s):
- (int) $format :: pre-defined time format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public int|string getYear ( [int $format] ) [line 1273]Returns the Year requested format
Formats:
- -> yyyy
- -> yy
Parameter(s):
- (int) $format
- throws:
Gumbo_Exception Implementation of:
[ Top ]public bool isHoliday ( ) [line 1585]Returns if the current day is a holiday
Implementation of:
[ Top ]public bool isWeekday ( ) [line 1577]Returns if the current day is on the weekday
Implementation of:
[ Top ]public bool isWeekend ( ) [line 1565]Returns if the current day is on the weekend
Implementation of:
[ Top ]public string meridien ( [bool $in_caps] ) [line 1967]Returns the AM/PM time value
Parameter(s):
- (bool) $in_caps :: returns value in caps
- throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextDay ( [int $num] ) [line 362]Increases the Day
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextHour ( [int $num] ) [line 400]Increases the Hour
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextMinute ( [int $num] ) [line 433]Increases the Minutes
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextMonth ( [int $num] ) [line 299]Increases the Month by number.
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextSecond ( [int $num] ) [line 466]Increases the Seconds
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextWeek ( [int $num] ) [line 333]Increases the Week
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void nextYear ( [int $num] ) [line 270]Increases the Year by number
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevDay ( [int $num] ) [line 591]Decreases the Day
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevHour ( [int $num] ) [line 629]Decreases the Hour
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevMinute ( [int $num] ) [line 662]Decreases the Minutes
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevMonth ( [int $num] ) [line 529]Decreases the Month
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevSecond ( [int $num] ) [line 695]Decreases the Seconds
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevWeek ( [int $num] ) [line 562]Decreases the Week
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void prevYear ( [int $num] ) [line 499]Decreases the Year
Parameter(s):
- (int) $num
- precondition:
$num > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void reset ( ) [line 188]Resets the state to the original time stamp
Implementation of:
[ Top ]public void setDate ( int $year, int $month, int $day ) [line 792]Sets the Date values of the object
Parameter(s):
- (int) $year
- (int) $month
- (int) $day
Implementation of:
[ Top ]public void setDateEpoch ( int $time ) [line 834]Sets the Date by the UNIX Epoch
Parameter(s):
- (int) $time
- throws:
Gumbo_Exception Implementation of:
[ Top ]public void setDateStamp ( mixed $stamp ) [line 815]Sets the Date by a stamp parsed down to yyyymmdd[hhmmss] format
Parameter(s):
- (mixed) $stamp
- throws:
Gumbo_Exception Implementation of:
[ Top ]0 < $val <= 31 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void setHoliday ( bool $val ) [line 773]Marks the Date as a Holiday
Parameter(s):
- (bool) $val
- throws:
Gumbo_Exception Implementation of:
[ Top ]0 <= $val < 24 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void setMinute ( int $min ) [line 977]Sets the Minute
Parameter(s):
- (int) $min
- precondition:
0 <= $val < 60 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void setMonth ( int|string $month ) [line 881]Sets the Month
The value can be the numberical month, a three-letter abbreviation of the month name, or the full name.
Parameter(s):
- (int|string) $month
- precondition:
if int, 0 < $val < 13 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void setSeconds ( int $sec ) [line 1000]Sets the Seconds
Parameter(s):
- (int) $sec
- precondition:
0 <= $val < 60 - throws:
Gumbo_Exception Implementation of:
[ Top ]public void setTime ( int $hour, int $minutes, int $seconds ) [line 804]Sets the Time values of object
Parameter(s):
- (int) $hour
- (int) $minutes
- (int) $seconds
Implementation of:
[ Top ]$val > 0 - throws:
Gumbo_Exception Implementation of:
[ Top ]public int totalDays ( [int $month] ) [line 1540]Returns the total days within a month
Parameter(s):
- (int) $month
- throws:
Gumbo_Exception Implementation of:
[ Top ]$hour=0 - postcondition:
$minutes=0 - postcondition:
$seconds=0 Implementation of:
[ Top ]private void _change ( int $num, string $method ) [line 1038]Changes the particular element by the supplied number
Parameter(s):
- (int) $num :: number to increase/decrease
- (string) $method :: Date method to call
- throws:
Gumbo_Exception
[ Top ]as [year|month|day]
[ Top ]private void _parse ( string|int $stamp ) [line 1021]Parses the timestamp into Date components
Parameter(s):
- (string|int) $stamp
[ Top ]private void _setOrigStamp ( int $year, int $month, int $day, int $hour, int $minute, int $second ) [line 735]Sets the original time stamp
Parameter(s):
- (int) $year
- (int) $month
- (int) $day
- (int) $hour
- (int) $minute
- (int) $second
- throws:
Gumbo_Exception
[ Top ]Class Constants
DAYS_IN_LEAP_YEAR = [line 80]DAYS_IN_WEEK = [line 82]DAYS_IN_YEAR = [line 78]HOURS_IN_DAY = [line 88]HOURS_IN_LEAP_YEAR = [line 94]HOURS_IN_WEEK = [line 90]HOURS_IN_YEAR = [line 92]MINUTES_IN_DAY = [line 99]MINUTES_IN_HOUR = [line 97]MINUTES_IN_LEAP_YEAR = [line 105]MINUTES_IN_WEEK = [line 101]MINUTES_IN_YEAR = [line 103]MONTHS_IN_YEAR = [line 75]SECONDS_IN_DAY = [line 112]SECONDS_IN_HOUR = [line 110]SECONDS_IN_LEAP_YEAR = [line 118]SECONDS_IN_MINUTE = [line 108]SECONDS_IN_WEEK = [line 114]SECONDS_IN_YEAR = [line 116]WEEKS_IN_YEAR = [line 85]