Gumbo_Interface_Date



Date Interface

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

Interface Methods

public static bool isLeapYear ( int $year ) [line 42]

Checks if the current year is a Leap Year

Parameter(s):

  • (int) $year
  • throws:  Gumbo_Exception

[ Top ]
public array diff ( Gumbo_Interface_Date $date ) [line 618]

Returns the difference from the supplied Date

Parameter(s):

  • return:  [when|year|month|day|hour|minute|second]

[ Top ]
public int diffDay ( Gumbo_Interface_Date $val ) [line 646]

Returns the number of Days difference

Parameter(s):


[ Top ]
public int diffMonth ( Gumbo_Interface_Date $val ) [line 632]

Returns the number of Months difference

Parameter(s):


[ Top ]
public int diffWeek ( Gumbo_Interface_Date $val ) [line 639]

Returns the number of Weeks difference

Parameter(s):


[ Top ]
public int diffYear ( int|Gumbo_Interface_Date $val ) [line 625]

Returns the number of Years difference

Parameter(s):


[ Top ]
public int|string get ( [int $format] ) [line 285]

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
To use more complex combinations, use a combination of the getDate() and getTime() methods.

Parameter(s):

  • (int) $format :: format code
  • throws:  Gumbo_Exception

[ Top ]
public int|string getCentury ( [ $as_string] ) [line 337]

Returns the Century

Parameter(s):

  • () $as_string

[ Top ]
public void getDate ( [string|int $format] ) [line 308]

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
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 use date().

Parameter(s):

  • (string|int) $format :: pre-defined format code or string stamp

[ Top ]
public int|string getDay ( [int $format] ) [line 388]

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

[ Top ]
public int|string getHour ( [int $format] ) [line 403]

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

[ Top ]
public int|string getMinute ( [int $format] ) [line 416]

Returns the Minutes in the requested format

Format:

  • 0 => [m]m
  • 1 => mm

Parameter(s):

  • (int) $format
  • throws:  Gumbo_Exception

[ Top ]
public int|string getMonth ( [int $format] ) [line 365]

Returns the Month in the requested format

Formats:

  1. -> [m]m
  2. -> mm
  3. -> Mon (abbreviation)
  4. -> Month (full name)

Parameter(s):

  • (int) $format
  • throws:  Gumbo_Exception

[ Top ]
public array getMonthFacts ( ) [line 437]

Returns an array of factual months


[ Top ]
public int|string getSecond ( [int $format] ) [line 429]

Returns the Seconds in the requested format

Format:

  • 0 => [s]s
  • 1 => ss

Parameter(s):

  • (int) $format
  • throws:  Gumbo_Exception

[ Top ]
public string getTime ( [int $format] ) [line 329]

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

[ Top ]
public int getWeek ( ) [line 371]

Returns the Week


[ Top ]
public int|string getYear ( [int $format] ) [line 350]

Returns the Year requested format

Formats:

  1. -> yyyy
  2. -> yy

Parameter(s):

  • (int) $format
  • throws:  Gumbo_Exception

[ Top ]
public bool isApril ( ) [line 535]

Returns if April


[ Top ]
public bool isAugust ( ) [line 559]

Returns if August


[ Top ]
public bool isDecember ( ) [line 583]

Returns if December


[ Top ]
public boolean isFall ( ) [line 609]

Returns if Fall


[ Top ]
public bool isFebruary ( ) [line 523]

Returns if February


[ Top ]
public bool isFriday ( ) [line 503]

Returns if a Friday


[ Top ]
public bool isHoliday ( ) [line 465]

Returns if the current day is a holiday


[ Top ]
public bool isJanuary ( ) [line 517]

Returns if January


[ Top ]
public bool isJuly ( ) [line 553]

Returns if July


[ Top ]
public bool isJune ( ) [line 547]

Returns if June


[ Top ]
public bool isMarch ( ) [line 529]

Returns if March


[ Top ]
public bool isMay ( ) [line 541]

Returns if May


[ Top ]
public bool isMonday ( ) [line 479]

Returns if a Monday


[ Top ]
public bool isNovember ( ) [line 577]

Returns if November


[ Top ]
public bool isOctober ( ) [line 571]

Returns if October


[ Top ]
public bool isSaturday ( ) [line 509]

Returns if a Saturday


[ Top ]
public bool isSeptember ( ) [line 565]

Returns if September


[ Top ]
public boolean isSpring ( ) [line 597]

Returns if Spring


[ Top ]
public boolean isSummer ( ) [line 603]

Returns if Summer


[ Top ]
public bool isSunday ( ) [line 473]

Returns if a Sunday


[ Top ]
public bool isThursday ( ) [line 497]

Returns if a Thursday


[ Top ]
public bool isTuesday ( ) [line 485]

Returns if a Tuesday


[ Top ]
public bool isWednesday ( ) [line 491]

Returns if a Wednesday


[ Top ]
public bool isWeekday ( ) [line 459]

Returns if the current day is on the weekday


[ Top ]
public bool isWeekend ( ) [line 453]

Returns if the current day is on the weekend


[ Top ]
public boolean isWinter ( ) [line 591]

Returns if Winter


[ Top ]
public string meridien ( [bool $in_caps] ) [line 656]

Returns the AM/PM time value

Parameter(s):

  • (bool) $in_caps :: returns value in caps
  • throws:  Gumbo_Exception

[ Top ]
public void nextDay ( [int $num] ) [line 90]

Increases the Day

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void nextHour ( [int $num] ) [line 98]

Increases the Hour

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void nextMinute ( [int $num] ) [line 106]

Increases the Minutes

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void nextMonth ( [int $num] ) [line 74]

Increases the Month by number.

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void nextSecond ( [int $num] ) [line 114]

Increases the Seconds

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void nextWeek ( [int $num] ) [line 82]

Increases the Week

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void nextYear ( [int $num] ) [line 66]

Increases the Year by number

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevDay ( [int $num] ) [line 146]

Decreases the Day

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevHour ( [int $num] ) [line 154]

Decreases the Hour

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevMinute ( [int $num] ) [line 162]

Decreases the Minutes

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevMonth ( [int $num] ) [line 130]

Decreases the Month

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevSecond ( [int $num] ) [line 170]

Decreases the Seconds

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevWeek ( [int $num] ) [line 138]

Decreases the Week

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void prevYear ( [int $num] ) [line 122]

Decreases the Year

Parameter(s):

  • (int) $num
  • precondition:  $num > 0
  • throws:  Gumbo_Exception

[ Top ]
public void reset ( ) [line 50]

Resets the state to the original time stamp


[ Top ]
public void setDate ( int $year, int $month, int $day ) [line 188]

Sets the Date values of the object

Parameter(s):

  • (int) $year
  • (int) $month
  • (int) $day

[ Top ]
public void setDateEpoch ( int $time ) [line 210]

Sets the Date by the UNIX Epoch

Parameter(s):

  • (int) $time
  • throws:  Gumbo_Exception

[ Top ]
public void setDateStamp ( mixed $stamp ) [line 203]

Sets the Date by a stamp parsed down to yyyymmdd[hhmmss] format

Parameter(s):

  • (mixed) $stamp
  • throws:  Gumbo_Exception

[ Top ]
public void setDay ( int $day ) [line 238]

Sets the Day

Parameter(s):

  • (int) $day
  • precondition:  0 < $val <= 31
  • throws:  Gumbo_Exception

[ Top ]
public void setHoliday ( bool $val ) [line 180]

Marks the Date as a Holiday

Parameter(s):

  • (bool) $val
  • throws:  Gumbo_Exception

[ Top ]
public void setHour ( int $hour ) [line 246]

Sets the Hour

Parameter(s):

  • (int) $hour
  • precondition:  0 <= $val < 24
  • throws:  Gumbo_Exception

[ Top ]
public void setMinute ( int $min ) [line 254]

Sets the Minute

Parameter(s):

  • (int) $min
  • precondition:  0 <= $val < 60
  • throws:  Gumbo_Exception

[ Top ]
public void setMonth ( int|string $month ) [line 230]

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

[ Top ]
public void setSeconds ( int $sec ) [line 262]

Sets the Seconds

Parameter(s):

  • (int) $sec
  • precondition:  0 <= $val < 60
  • throws:  Gumbo_Exception

[ Top ]
public void setTime ( int $hour, int $minutes, int $seconds ) [line 196]

Sets the Time values of object

Parameter(s):

  • (int) $hour
  • (int) $minutes
  • (int) $seconds

[ Top ]
public void setYear ( int $year ) [line 218]

Sets the Year

Parameter(s):

  • (int) $year
  • precondition:  $val > 0
  • throws:  Gumbo_Exception

[ Top ]
public int totalDays ( [int $month] ) [line 445]

Returns the total days within a month

Parameter(s):

  • (int) $month
  • throws:  Gumbo_Exception

[ Top ]
public void zeroHour ( ) [line 58]

Sets the time to the zero hour

  • postcondition:  $hour=0
  • postcondition:  $minutes=0
  • postcondition:  $seconds=0

[ Top ]