BitDate Class Reference

List of all members.

Public Member Functions

 _getDate ($origd=false, $fast=false, $is_gmt=false)
 _is_leap_year ($year)
 BitDate ($_display_offset=0)
 calculateTimeZoneDate ($dateTime, $fromTZ, $toTZ, $fromLocation= 'North America', $toLocation= 'GMT')
 date ($fmt, $d=false, $is_gmt=false)
 date2 ($fmt, $d=false, $is_gmt=false)
 dayOfWeek ($year, $month, $day)
 daysInMonth ($month, $year)
 get_display_offset ($_user=false)
 get_iso8601_datetime ($timestamp, $user=false)
 get_rfc2822_datetime ($timestamp=false, $user=false)
 get_rfc2822_timezone_offset ($time=false, $no_colon=false, $user=false)
 get_timezone_list ($use_default=false)
 getDate ($d=false, $fast=false)
 getDisplayDateFromUTC ($_timestamp)
 getHolidays ($pYear, $pCountryCode='US')
 getServerDateFromUTC ($_timestamp)
 getTimestampFromISO ($iso_date)
 getTzName ()
 getUTCDate ()
 getUTCFromDisplayDate ($_timestamp)
 getUTCFromServerDate ($_timestamp)
 getUTCTime ()
 getUTCTimestamp ()
 gmmktime ($hr, $min, $sec, $mon=false, $day=false, $year=false, $is_dst=false)
 gmstrftime ($fmt, $ls=false)
 gregorianToISO ($year, $month, $day)
 is_leap_year ($year)
 mktime ($hr, $min, $sec, $mon=false, $day=false, $year=false, $is_dst=false, $is_gmt=false)
 set_locale ($user=false)
 strftime ($fmt, $ls=false, $is_gmt=false)
 strtotime ($time, $now=NULL)
 weekOfYear ($year, $month, $day)
 year_digit_check ($y)

Public Attributes

 $display_offset
 $server_offset

Detailed Description

Definition at line 28 of file BitDate.php.


Member Function Documentation

BitDate::_getDate ( origd = false,
fast = false,
is_gmt = false 
)

Low-level function that returns the getdate() array. We have a special $fast flag, which if set to true, will return fewer array values, and is much faster as it does not calculate dow, etc.

Parameters:
int Date to be converted in Unix epochs
boolean Return short format array ( less weekday and month )
boolean Ignore timezone
Returns:
array

Definition at line 336 of file BitDate.php.

References mktime().

Referenced by getDate().

Here is the call graph for this function:

BitDate::_is_leap_year ( year  ) 

Checks for leap year, returns true if it is. No 2-digit year check. Also handles julian calendar correctly.

Parameters:
int 
Returns:
boolean

Definition at line 236 of file BitDate.php.

Referenced by is_leap_year().

BitDate::BitDate ( _display_offset = 0  ) 

Default constructor

Parameters:
int desired offset for date display, in minutes

Definition at line 45 of file BitDate.php.

References gmmktime(), and mktime().

Here is the call graph for this function:

BitDate::calculateTimeZoneDate ( dateTime,
fromTZ,
toTZ,
fromLocation = 'North America',
toLocation = 'GMT' 
)

Definition at line 1157 of file BitDate.php.

References date(), and strtotime().

Here is the call graph for this function:

BitDate::date ( fmt,
d = false,
is_gmt = false 
)

Return formatted date based on timestamp $d

Parameters:
string Format of date output
int Date to be converted
boolean Ignore timezone
Returns:
string In the format specified by $fmt

Definition at line 545 of file BitDate.php.

References $i, $max, and mktime().

Referenced by calculateTimeZoneDate(), date2(), getHolidays(), getUTCDate(), getUTCTimestamp(), strftime(), and year_digit_check().

Here is the call graph for this function:

BitDate::date2 ( fmt,
d = false,
is_gmt = false 
)

Definition at line 519 of file BitDate.php.

References date().

Here is the call graph for this function:

BitDate::dayOfWeek ( year,
month,
day 
)

Returns day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc

Parameters:
int 
int 
int 
Returns:
int

Definition at line 179 of file BitDate.php.

BitDate::daysInMonth ( month,
year 
)

Definition at line 1072 of file BitDate.php.

References FALSE, and is_leap_year().

Here is the call graph for this function:

BitDate::get_display_offset ( _user = false  ) 

Retrieves the user's preferred offset for displaying dates.

Parameters:
int the logged-in user.
Returns:
int the preferred offset to UTC or 0 for straight UTC display

Definition at line 56 of file BitDate.php.

References $_COOKIE, and $gBitUser.

Referenced by BitEvents::BitEvents(), data_calendar(), and BitBlogPost::verify().

BitDate::get_iso8601_datetime ( timestamp,
user = false 
)

Per http://www.w3.org/TR/NOTE-datetime

Definition at line 1019 of file BitDate.php.

References $timestamp, $user, and strftime().

Here is the call graph for this function:

BitDate::get_rfc2822_datetime ( timestamp = false,
user = false 
)

Definition at line 1023 of file BitDate.php.

References $timestamp, $user, get_rfc2822_timezone_offset(), and strftime().

Here is the call graph for this function:

BitDate::get_rfc2822_timezone_offset ( time = false,
no_colon = false,
user = false 
)

Definition at line 1040 of file BitDate.php.

References $time, $user, and strftime().

Referenced by get_rfc2822_datetime().

Here is the call graph for this function:

BitDate::get_timezone_list ( use_default = false  ) 

Get a list of timezones to be worked with

Definition at line 993 of file BitDate.php.

References $offset.

BitDate::getDate ( d = false,
fast = false 
)

Returns an array with date info.

Parameters:
boolean 
boolean 
Returns:
array

Definition at line 296 of file BitDate.php.

References _getDate().

Here is the call graph for this function:

BitDate::getDisplayDateFromUTC ( _timestamp  ) 

Convert a UTC timestamp to the preferred display offset.

Parameters:
timestamp ISO format date yYYY-mM-dD hH:mM:sS.s ( Lower case letters optional, but should be 0 )
Returns:
int Seconds count based on 1st Jan 1970

Definition at line 82 of file BitDate.php.

References getTimestampFromISO().

Here is the call graph for this function:

BitDate::getHolidays ( pYear,
pCountryCode = 'US' 
)

Get a hash of holidays for a given year

Parameters:
$pYear the year in question
$pCountryCode -- the country in question - only US is supported currently
Returns:
an associative array containing the holidays occuring in the given year they key is a date stamp of the form Y-m-d, the value is the name of the corresponding holiday public

Definition at line 1105 of file BitDate.php.

References date(), and strtotime().

Here is the call graph for this function:

BitDate::getServerDateFromUTC ( _timestamp  ) 

Convert a UTC timestamp to the local server time.

Parameters:
timestamp UTC timestamp to convert.
Returns:
timestamp Server timestamp.

Definition at line 101 of file BitDate.php.

References getTimestampFromISO().

Here is the call graph for this function:

BitDate::getTimestampFromISO ( iso_date  ) 

Convert ISO date to numberic timestamp.

Parameters:
string ISO format date yYYY-mM-dD hH:mM:sS.s ( Lower case letters optional, but should be 0 )
Returns:
int Seconds count based on 1st Jan 1970
returns $iso_date if it is a number, or 0 if format invalid

Definition at line 158 of file BitDate.php.

References $ret, and mktime().

Referenced by getDisplayDateFromUTC(), getServerDateFromUTC(), getUTCFromDisplayDate(), and getUTCFromServerDate().

Here is the call graph for this function:

BitDate::getTzName (  ) 

Get the name of the current timezone. Currently, only "UTC" or an empty string (Local).

Returns:
string Current timezone

Definition at line 143 of file BitDate.php.

BitDate::getUTCDate (  ) 

Retrieve a current UTC Date as an ISO formated date

Returns:
string Current ISO formated date

Definition at line 134 of file BitDate.php.

References date().

Here is the call graph for this function:

BitDate::getUTCFromDisplayDate ( _timestamp  ) 

Convert a display-offset timestamp to UTC.

Parameters:
timestamp ISO format date yYYY-mM-dD hH:mM:sS.s ( Lower case letters optional, but should be 0 )
Returns:
int Seconds count based on 1st Jan 1970

Definition at line 92 of file BitDate.php.

References getTimestampFromISO().

Here is the call graph for this function:

BitDate::getUTCFromServerDate ( _timestamp  ) 

Convert a local server timestamp to UTC.

Parameters:
timestamp Server timestamp to convert.
Returns:
timestamp UTC timestamp.

Definition at line 110 of file BitDate.php.

References getTimestampFromISO().

Here is the call graph for this function:

BitDate::getUTCTime (  ) 

Retrieve a current UTC timestamp as Unix epoch.

Returns:
int Unix epoch

Definition at line 118 of file BitDate.php.

Referenced by LibertyStars::calculateUserWeight(), LibertyStars::verify(), and LibertyRecommends::verify().

BitDate::getUTCTimestamp (  ) 

Retrieve a current UTC Timestamp as an ISO formated date/time.

Returns:
string Current ISO formated date/time

Definition at line 126 of file BitDate.php.

References date().

Here is the call graph for this function:

BitDate::gmmktime ( hr,
min,
sec,
mon = false,
day = false,
year = false,
is_dst = false 
)

Returns a timestamp given a GMT/UTC time.

Parameters:
int Hour
int Minute
int Second
int Month
int Day
int Year
int $is_dst is not implemented and is ignored
Returns:
int

Definition at line 691 of file BitDate.php.

References $sec, and mktime().

Referenced by BitDate(), and mktime().

Here is the call graph for this function:

BitDate::gmstrftime ( fmt,
ls = false 
)

Definition at line 810 of file BitDate.php.

References strftime().

Referenced by strftime().

Here is the call graph for this function:

BitDate::gregorianToISO ( year,
month,
day 
)

Converts from Gregorian Year-Month-Day to ISO YearNumber-WeekNumber-WeekDay

Uses ISO 8601 definitions. Algorithm from Rick McCarty, 1999 at http://personal.ecu.edu/mccartyr/ISOwdALG.txt

Parameters:
int $year
int $month
int $day
Returns:
string public

Definition at line 931 of file BitDate.php.

References $c, $h, $i, and is_leap_year().

Referenced by weekOfYear().

Here is the call graph for this function:

BitDate::is_leap_year ( year  ) 

checks for leap year, returns true if it is. Has 2-digit year check

Parameters:
int 
Returns:
boolean

Definition at line 255 of file BitDate.php.

References _is_leap_year(), and year_digit_check().

Referenced by daysInMonth(), and gregorianToISO().

Here is the call graph for this function:

BitDate::mktime ( hr,
min,
sec,
mon = false,
day = false,
year = false,
is_dst = false,
is_gmt = false 
)

Return a timestamp given a local time. Originally by jackbbs. Not a very fast algorithm - O(n) operation. Could be optimized to O(1).

Parameters:
int Hour
int Minute
int Second
int Month
int Day
int Year
int $is_dst is not implemented and is ignored
Returns:
int

Definition at line 708 of file BitDate.php.

References $b, $ret, $sec, gmmktime(), and year_digit_check().

Referenced by _getDate(), BitDate(), date(), getTimestampFromISO(), and gmmktime().

Here is the call graph for this function:

BitDate::set_locale ( user = false  ) 

Definition at line 1060 of file BitDate.php.

References $user.

BitDate::strftime ( fmt,
ls = false,
is_gmt = false 
)

Definition at line 824 of file BitDate.php.

References $i, $max, $ret, date(), and gmstrftime().

Referenced by get_iso8601_datetime(), get_rfc2822_datetime(), get_rfc2822_timezone_offset(), and gmstrftime().

Here is the call graph for this function:

BitDate::strtotime ( time,
now = NULL 
)

Definition at line 815 of file BitDate.php.

References $now, and $time.

Referenced by calculateTimeZoneDate(), and getHolidays().

BitDate::weekOfYear ( year,
month,
day 
)

Returns week of year, 1 = first week of year. Algorithm from PEAR::Date_Calc This needs to be checked out for both start day and early date rules

Parameters:
int 
int 
int 
Returns:
int

Definition at line 221 of file BitDate.php.

References $parts, and gregorianToISO().

Here is the call graph for this function:

BitDate::year_digit_check ( y  ) 

Fix 2-digit years. Works for any century. Assumes that if 2-digit is more than 30 years in future, then previous century.

Todo:
This needs to be disabled when dates prior to 100AD are required in ISO format
Parameters:
int 
Returns:
int

Definition at line 267 of file BitDate.php.

References date().

Referenced by is_leap_year(), and mktime().

Here is the call graph for this function:


Member Data Documentation

BitDate::$display_offset

Definition at line 33 of file BitDate.php.

BitDate::$server_offset

Definition at line 39 of file BitDate.php.


The documentation for this class was generated from the following file:
Generated on Wed Aug 22 19:34:12 2007 for bitweaver by  doxygen 1.5.2