Phpfox_Date

Description

Handles all time/date related logic for phpFox.

Example to get a current users timezone they are in:

  1.  Phpfox::getLib('date')->getTimeZone();

Example of our usage of mktime:

  1.  Phpfox::getLib('date')->mktime(1116221982);

  • author: Raymond Benc
  • version: $Id: date.class.php 1687 2010-07-22 03:13:27Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]

Located in /include/library/phpfox/date/date.class.php (line 26)


	
			
Variable Summary
Method Summary
 static string getTimeZone ([bool $bDst = true])
 static bool _isDst ()
 Phpfox_Date __construct ()
 int amToPm (int $iTime)
 int convertFromGmt (int $iTime, string $sOffset)
 string convertTime (int $iTime, [string $sDefault = null])
 int convertToGmt (int $iTime, string $sOffset)
 int daysToDate (int $iTimeEnd, [int $iTimeStart = null], [bool $bRound = true])
 int getGmtOffset (int $iTime)
 string getMonth (int $iMonth)
 int getSaturday ()
 int getSunday ()
 int getWeekEnd ([int $iTime = null])
 bool isLeapYear (int $iYear)
 int lastDayOfMonth (int $iMonth, [int $iYear = null])
 Returns mktime (int $iHour, int $iMinute, int $iSecond, int $iMonth, int $iDay, int $iYear)
 int modifyHours (string $sTime, [bool $bAmPm = false])
Variables
array $_aMonthTable = array(
31,
28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
)
(line 33)

Array of all the last days for each of the months starting with January

  • access: private
Methods
static getTimeZone (line 65)

Gets the current time zone for a person browsing the site. If they have selected a time zone it will return their value, if not it will return the sites default time zone.

  • return: Returns the time zone offset from GMT
  • access: public
string getTimeZone ([bool $bDst = true])
  • bool $bDst: Take DST into account. Set to false to disable DST.
static _isDst (line 546)

Check to see if we are to use DST support.

  • return: TRUE if we use DST, FALSE if we don't
  • access: private
bool _isDst ()
Constructor __construct (line 52)

Class constructor

  • access: public
Phpfox_Date __construct ()
amToPm (line 374)

Converts PM time stamp into military time.

  • return: Returns military time
  • access: public
int amToPm (int $iTime)
  • int $iTime: PM time
convertFromGmt (line 435)

Converts the time passed based on the offset passed from GMT

  • return: Returns the time stamp converted from GMT
  • access: public
int convertFromGmt (int $iTime, string $sOffset)
  • int $iTime: Current time stamp to convert from GMT
  • string $sOffset: Offset of the time zone from GMT
convertTime (line 461)

Converts a time stamp into a human readable phrase.

  • return: Returns the readable phrase with the time stamp included.
  • access: public
string convertTime (int $iTime, [string $sDefault = null])
  • int $iTime: Time stamp to convert
  • string $sDefault: Default phrase to use with the display of the time stamp
convertToGmt (line 447)

Converts the time passed based on the offset passed into GMT

  • return: Returns the time stamp as GMT
  • access: public
int convertToGmt (int $iTime, string $sOffset)
  • int $iTime: Current time stamp to convert into GMT
  • string $sOffset: Offset of the time zone to GMT
daysToDate (line 121)

Calculates how many days there are between 2 specific dates.

  • return: Number of days between $iTimeStart and $iTimeEnd
  • access: public
int daysToDate (int $iTimeEnd, [int $iTimeStart = null], [bool $bRound = true])
  • int $iTimeStart: mktime of the starting date. If null we take current time
  • int $iTimeEnd: mktime of the ending date
  • bool $bRound: TRUE will round the calculation and FALSE will return its full calculation
getGmtOffset (line 510)

Gets the offset from the current timezone being used to GMT.

  • return: Returns GMT offset
  • access: public
int getGmtOffset (int $iTime)
  • int $iTime: Current time stamp to check
getMonth (line 166)

Gets a specific month and returns the phrase based on the language package being used

  • return: Returns the month as a phrase.
  • access: public
string getMonth (int $iMonth)
  • int $iMonth: The int value of the month to return, where 1 is January
getSaturday (line 393)

Gets the first saturday of the coming week

  • return: Unix time stamp
  • access: public
int getSaturday ()
getSunday (line 403)

Gets the first sunday of the coming week

  • return: Unix time stamp
  • access: public
int getSunday ()
getWeekEnd (line 414)

Finds the upcoming weekend

  • return: Returns How many days until the next weekend
  • access: public
int getWeekEnd ([int $iTime = null])
  • int $iTime: By default we use the current time, however you can pass a unix time stamp to check when the next weekend is from that date.
isLeapYear (line 349)

Checks if the current year passed is a leap year.

  • return: Returns TRUE if it is a leap year and FALSE if it is not.
  • access: public
bool isLeapYear (int $iYear)
  • int $iYear: The year to check.
lastDayOfMonth (line 104)

Gets the last day of month.

  • return: number of day
  • access: public
int lastDayOfMonth (int $iMonth, [int $iYear = null])
  • int $iMonth: The month to get the last day of
  • int $iYear: You can specify a year, if not we find the current year to work with
mktime (line 226)

PHP has their own mktime() function, however there are issues related to dates before the year 1901 and the year 2038. This function extends the PHP mktime() function to help resolve those issues. The logic and outcome is still the same as mktime()

Returns mktime (int $iHour, int $iMinute, int $iSecond, int $iMonth, int $iDay, int $iYear)
  • int $iHour: The number of the hour.
  • int $iMinute: The number of the minute.
  • int $iSecond: The number of seconds past the minute.
  • int $iMonth: The number of the month.
  • int $iDay: The number of the month.
  • int $iYear: The number of the year.
modifyHours (line 522)

Modify the current hour of a time stamp based on DST settings

  • return: Converted time stamp is returned
  • access: public
int modifyHours (string $sTime, [bool $bAmPm = false])
  • string $sTime: Time stamp
  • bool $bAmPm: Not being used at the moment

Documentation generated on Tue, 28 Sep 2010 10:36:38 +0200 by phpDocumentor 1.4.0a2