package.xml100666 0 0 31146 10530726054 6256 Date pear.php.net Generic date/time handling class for PEAR Generic classes for representation and manipulation of dates, times and time zones without the need of timestamps, which is a huge limitation for php programs. Includes time zone data, time zone conversions and many date/time conversions. It does not rely on 32-bit system date stamps, so you can display calendars and compare dates that date pre 1970 and post 2038. This package also provides a class to convert date strings between Gregorian and Human calendar formats. Baba Buehler baba baba@babaz.com no Pierre-Alain Joye pajoye pajoye@php.net no Monte Ohrt mohrt mohrt@php.net no Firman Wandayandi firman firman@php.net yes Alan Knowles alan_k alan@akbkhome.com yes Leonardo Dutra scar scar@php.net yes 2006-11-22 1.4.7 1.4 stable stable BSD License * Fix bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows * Fix bug #9409: Date_Calc, fatal error using a non-array variable as an array * Fix bug #9414: Date::addSeconds() fails to work properly with negative numbers * Many cosmetics update * Moved bug test files to tests/bugs/ * Removed unused files 4.3 1.4.0 1.4.7 1.4 stable stable 2006-11-22 BSD License * Fix bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows * Fix bug #9409: Date_Calc, fatal error using a non-array variable as an array * Fix bug #9414: Date::addSeconds() fails to work properly with negative numbers * Many cosmetics update * Moved bug test files to tests/bugs/ * Removed unused files 2005-11-15 1.4.6 1.4.6 stable stable - Change license from PHP License to new BSD License - Bug #5715 fypo, missing s in $GLOBALS 1.4.5 1.4.5 stable stable 2005-10-12 PHP License Same code base as 1.4.4-beta See 1.4.4 changelog for details 1.4.4 1.4.4 beta stable 2004-05-16 PHP License - Establish the DATE_CALC_FORMAT constant and use it as the default value for each of the Date_Calc class' method's $format parameter. - Add beginOfMonthBySpan() and endOfMonthBySpan() methods to Date_Calc. - Use integers for the parameters in Date_Calc instead of strings. - Tweak Date_Calc::NWeekdayOfMonth() so it can calculate the 'last' given weekday of a month. - Fix Bug 1640. Make sure all longname's are also keys in $GLOBALS['_DATE_TIMEZONE_DATA']. Makes Date_TimeZone work under more operating systems. - #5420, missing CEST - #3846, getYear, getMonth returns integer - #2652, add %h and %i support (rob at wildlime dot com - #5494, force dot as decimal separator - #3022, allow to specify the weekday abbrevation length used in ::format() - #4878, %s padding fix when < 10 ( aashley at optimiser dot com) - #3059, use GLOBALS in date_span 1.4.3 1.4.3 stable stable 2004-05-16 PHP License - Fix #1250, wrong name for Bangladesh TZ - Fix #1390, add XML Schema datetime support (aashley at optimiser dot com) See http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#dateTime 1.4.3 1.4.3 stable stable 2004-05-16 PHP License - Fix #1250, wrong name for Bangladesh TZ - Fix #1390, add XML Schema datetime support (aashley at optimiser dot com) See http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#dateTime 1.4.2 1.4.2 stable stable 2004-03-14 PHP License - Fix #976 TimeZone default bad global usage only _DATE_TIMEZONE_DEFAULT is used now - Fix #683, add optional length argumet to getDayName() - Fix PHP5 problems with get_class functions 1.4.1 1.4.1 stable stable 2005-10-02 PHP License - Fix #674 endOfWeek() beginOfWeek() - Fix #727, weeksInMonth (wrong result with some dates) - Fix #674 (and old system #22549), check arguments in Date_Span 1.4 1.4 stable stable 2003-12-21 PHP License - improvements in input date parsing - add Date methods addSpan() and subtractSpan() - added two more ISO8601 date/time output formats DATE_FORMAT_ISO_BASIC and DATE_FORMAT_ISO_EXTENDED - improve Date_Calc isLeapYear() and daysInMonth() for year 1582 - add gregorianToISO() method to Date_Calc - add dateSeason() method to Date_Calc - add Date_Span class - bugfix in Date_Calc when century ends in 00, only define DATE_CALC_BEGIN_WEEKDAY if not already defined - bugfix in beginOfNextWeek(), beginOfPreviousWeek() (thx to andreas dot kossmeier at bergfex dot at) - bugfix in nextDayOfWeek and prevDayOfWeek (thx to koan at gmx dot at) - bugfix for bug 62: getDate(DATE_FORMAT_UNIXTIME) off because of DST - bugfix for bug 65: format(e) returns zero-padded day - bugfix for bug 195: Suppress a notice in setDate() - bugfix for bug 271: Date_Calc weeksInMonth() returns wrong number - fix abstraction bug, Date constructor accepts now object that extends Date - add tests to release package - Fix notices and mins calc in to toUTCbyOffset() Date-1.4.7/Date/Calc.php100666 0 0 211035 10530726050 7724 * @author Pierre-Alain Joye * @author Daniel Convissor * @copyright 1999-2006 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version CVS: $Id: Calc.php,v 1.35 2006/11/21 23:01:13 firman Exp $ * @link http://pear.php.net/package/Date * @since File available since Release 1.2 */ // }}} if (!defined('DATE_CALC_BEGIN_WEEKDAY')) { /** * Defines what day starts the week * * Monday (1) is the international standard. * Redefine this to 0 if you want weeks to begin on Sunday. */ define('DATE_CALC_BEGIN_WEEKDAY', 1); } if (!defined('DATE_CALC_FORMAT')) { /** * The default value for each method's $format parameter * * The default is '%Y%m%d'. To override this default, define * this constant before including Calc.php. * * @since Constant available since Release 1.4.4 */ define('DATE_CALC_FORMAT', '%Y%m%d'); } // {{{ Class: Date_Calc /** * Calculates, manipulates and retrieves dates * * It does not rely on 32-bit system time stamps, so it works dates * before 1970 and after 2038. * * @author Monte Ohrt * @author Daniel Convissor * @copyright 1999-2006 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version Release: 1.4.7 * @link http://pear.php.net/package/Date * @since Class available since Release 1.2 */ class Date_Calc { // {{{ dateFormat() /** * Formats the date in the given format, much like strfmt() * * This function is used to alleviate the problem with 32-bit numbers for * dates pre 1970 or post 2038, as strfmt() has on most systems. * Most of the formatting options are compatible. * * Formatting options: *
     * %a   abbreviated weekday name (Sun, Mon, Tue)
     * %A   full weekday name (Sunday, Monday, Tuesday)
     * %b   abbreviated month name (Jan, Feb, Mar)
     * %B   full month name (January, February, March)
     * %d   day of month (range 00 to 31)
     * %e   day of month, single digit (range 0 to 31)
     * %E   number of days since unspecified epoch (integer)
     *        (%E is useful for passing a date in a URL as
     *        an integer value. Then simply use
     *        daysToDate() to convert back to a date.)
     * %j   day of year (range 001 to 366)
     * %m   month as decimal number (range 1 to 12)
     * %n   newline character (\n)
     * %t   tab character (\t)
     * %w   weekday as decimal (0 = Sunday)
     * %U   week number of current year, first sunday as first week
     * %y   year as decimal (range 00 to 99)
     * %Y   year as decimal including century (range 0000 to 9999)
     * %%   literal '%'
     * 
* * @param int $day the day of the month * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * @param string $format the format string * * @return string the date in the desired format * * @access public * @static */ function dateFormat($day, $month, $year, $format) { if (!Date_Calc::isValidDate($day, $month, $year)) { $year = Date_Calc::dateNow('%Y'); $month = Date_Calc::dateNow('%m'); $day = Date_Calc::dateNow('%d'); } $output = ''; for ($strpos = 0; $strpos < strlen($format); $strpos++) { $char = substr($format, $strpos, 1); if ($char == '%') { $nextchar = substr($format, $strpos + 1, 1); switch($nextchar) { case 'a': $output .= Date_Calc::getWeekdayAbbrname($day, $month, $year); break; case 'A': $output .= Date_Calc::getWeekdayFullname($day, $month, $year); break; case 'b': $output .= Date_Calc::getMonthAbbrname($month); break; case 'B': $output .= Date_Calc::getMonthFullname($month); break; case 'd': $output .= sprintf('%02d', $day); break; case 'e': $output .= $day; break; case 'E': $output .= Date_Calc::dateToDays($day, $month, $year); break; case 'j': $output .= Date_Calc::julianDate($day, $month, $year); break; case 'm': $output .= sprintf('%02d', $month); break; case 'n': $output .= "\n"; break; case 't': $output .= "\t"; break; case 'w': $output .= Date_Calc::dayOfWeek($day, $month, $year); break; case 'U': $output .= Date_Calc::weekOfYear($day, $month, $year); break; case 'y': $output .= substr($year, 2, 2); break; case 'Y': $output .= $year; break; case '%': $output .= '%'; break; default: $output .= $char.$nextchar; } $strpos++; } else { $output .= $char; } } return $output; } // }}} // {{{ defaultCentury() /** * Turns a two digit year into a four digit year * * From '51 to '99 is in the 1900's, otherwise it's in the 2000's. * * @param int $year the 2 digit year * * @return string the 4 digit year * * @access public * @static */ function defaultCentury($year) { if (strlen($year) == 1) { $year = '0' . $year; } if ($year > 50) { return '19' . $year; } else { return '20' . $year; } } // }}} // {{{ dateToDays() /** * Converts a date to number of days since a distant unspecified epoch * * @param int $day the day of the month * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return integer the number of days since the Date_Calc epoch * * @access public * @static */ function dateToDays($day, $month, $year) { $century = (int)substr($year, 0, 2); $year = (int)substr($year, 2, 2); if ($month > 2) { $month -= 3; } else { $month += 9; if ($year) { $year--; } else { $year = 99; $century --; } } return (floor((146097 * $century) / 4 ) + floor((1461 * $year) / 4 ) + floor((153 * $month + 2) / 5 ) + $day + 1721119); } // }}} // {{{ daysToDate() /** * Converts number of days to a distant unspecified epoch * * @param int $days the number of days since the Date_Calc epoch * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function daysToDate($days, $format = DATE_CALC_FORMAT) { $days -= 1721119; $century = floor((4 * $days - 1) / 146097); $days = floor(4 * $days - 1 - 146097 * $century); $day = floor($days / 4); $year = floor((4 * $day + 3) / 1461); $day = floor(4 * $day + 3 - 1461 * $year); $day = floor(($day + 4) / 4); $month = floor((5 * $day - 3) / 153); $day = floor(5 * $day - 3 - 153 * $month); $day = floor(($day + 5) / 5); if ($month < 10) { $month +=3; } else { $month -=9; if ($year++ == 99) { $year = 0; $century++; } } $century = sprintf('%02d', $century); $year = sprintf('%02d', $year); return Date_Calc::dateFormat($day, $month, $century . $year, $format); } // }}} // {{{ gregorianToISO() /** * Converts from Gregorian Year-Month-Day to ISO Year-WeekNumber-WeekDay * * Uses ISO 8601 definitions. Algorithm by Rick McCarty, 1999 at * http://personal.ecu.edu/mccartyr/ISOwdALG.txt . * Transcribed to PHP by Jesus M. Castagnetto. * * @param int $day the day of the month * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return string the date in ISO Year-WeekNumber-WeekDay format * * @access public * @static */ function gregorianToISO($day, $month, $year) { $mnth = array (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334); $y_isleap = Date_Calc::isLeapYear($year); $y_1_isleap = Date_Calc::isLeapYear($year - 1); $day_of_year_number = $day + $mnth[$month - 1]; if ($y_isleap && $month > 2) { $day_of_year_number++; } // find Jan 1 weekday (monday = 1, sunday = 7) $yy = ($year - 1) % 100; $c = ($year - 1) - $yy; $g = $yy + intval($yy / 4); $jan1_weekday = 1 + intval((((($c / 100) % 4) * 5) + $g) % 7); // weekday for year-month-day $h = $day_of_year_number + ($jan1_weekday - 1); $weekday = 1 + intval(($h - 1) % 7); // find if Y M D falls in YearNumber Y-1, WeekNumber 52 or if ($day_of_year_number <= (8 - $jan1_weekday) && $jan1_weekday > 4){ $yearnumber = $year - 1; if ($jan1_weekday == 5 || ($jan1_weekday == 6 && $y_1_isleap)) { $weeknumber = 53; } else { $weeknumber = 52; } } else { $yearnumber = $year; } // find if Y M D falls in YearNumber Y+1, WeekNumber 1 if ($yearnumber == $year) { if ($y_isleap) { $i = 366; } else { $i = 365; } if (($i - $day_of_year_number) < (4 - $weekday)) { $yearnumber++; $weeknumber = 1; } } // find if Y M D falls in YearNumber Y, WeekNumber 1 through 53 if ($yearnumber == $year) { $j = $day_of_year_number + (7 - $weekday) + ($jan1_weekday - 1); $weeknumber = intval($j / 7); if ($jan1_weekday > 4) { $weeknumber--; } } // put it all together if ($weeknumber < 10) { $weeknumber = '0'.$weeknumber; } return $yearnumber . '-' . $weeknumber . '-' . $weekday; } // }}} // {{{ dateSeason() /** * Determines julian date of the given season * * Adapted from previous work in Java by James Mark Hamilton. * * @param string $season the season to get the date for: VERNALEQUINOX, * SUMMERSOLSTICE, AUTUMNALEQUINOX, * or WINTERSOLSTICE * @param string $year the year in four digit format. Must be between * -1000BC and 3000AD. * * @return float the julian date the season starts on * * @author James Mark Hamilton * @author Robert Butler * @access public * @static */ function dateSeason($season, $year = 0) { if ($year == '') { $year = Date_Calc::dateNow('%Y'); } if (($year >= -1000) && ($year <= 1000)) { $y = $year / 1000.0; switch ($season) { case 'VERNALEQUINOX': $juliandate = (((((((-0.00071 * $y) - 0.00111) * $y) + 0.06134) * $y) + 365242.1374) * $y) + 1721139.29189; break; case 'SUMMERSOLSTICE': $juliandate = (((((((0.00025 * $y) + 0.00907) * $y) - 0.05323) * $y) + 365241.72562) * $y) + 1721233.25401; break; case 'AUTUMNALEQUINOX': $juliandate = (((((((0.00074 * $y) - 0.00297) * $y) - 0.11677) * $y) + 365242.49558) * $y) + 1721325.70455; break; case 'WINTERSOLSTICE': default: $juliandate = (((((((-0.00006 * $y) - 0.00933) * $y) - 0.00769) * $y) + 365242.88257) * $y) + 1721414.39987; } } elseif (($year > 1000) && ($year <= 3000)) { $y = ($year - 2000) / 1000; switch ($season) { case 'VERNALEQUINOX': $juliandate = (((((((-0.00057 * $y) - 0.00411) * $y) + 0.05169) * $y) + 365242.37404) * $y) + 2451623.80984; break; case 'SUMMERSOLSTICE': $juliandate = (((((((-0.0003 * $y) + 0.00888) * $y) + 0.00325) * $y) + 365241.62603) * $y) + 2451716.56767; break; case 'AUTUMNALEQUINOX': $juliandate = (((((((0.00078 * $y) + 0.00337) * $y) - 0.11575) * $y) + 365242.01767) * $y) + 2451810.21715; break; case 'WINTERSOLSTICE': default: $juliandate = (((((((0.00032 * $y) - 0.00823) * $y) - 0.06223) * $y) + 365242.74049) * $y) + 2451900.05952; } } return $juliandate; } // }}} // {{{ dateNow() /** * Returns the current local date * * NOTE: This function retrieves the local date using strftime(), * which may or may not be 32-bit safe on your system. * * @param string $format the string indicating how to format the output * * @return string the current date in the specified format * * @access public * @static */ function dateNow($format = DATE_CALC_FORMAT) { return strftime($format, time()); } // }}} // {{{ getYear() /** * Returns the current local year in format CCYY * * @return string the current year in four digit format * * @access public * @static */ function getYear() { return Date_Calc::dateNow('%Y'); } // }}} // {{{ getMonth() /** * Returns the current local month in format MM * * @return string the current month in two digit format * * @access public * @static */ function getMonth() { return Date_Calc::dateNow('%m'); } // }}} // {{{ getDay() /** * Returns the current local day in format DD * * @return string the current day of the month in two digit format * * @access public * @static */ function getDay() { return Date_Calc::dateNow('%d'); } // }}} // {{{ julianDate() /** * Returns number of days since 31 December of year before given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int the julian date for the date * * @access public * @static */ function julianDate($day = 0, $month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334); $julian = ($days[$month - 1] + $day); if ($month > 2 && Date_Calc::isLeapYear($year)) { $julian++; } return $julian; } // }}} // {{{ getWeekdayFullname() /** * Returns the full weekday name for the given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return string the full name of the day of the week * * @access public * @static */ function getWeekdayFullname($day = 0, $month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $weekday_names = Date_Calc::getWeekDays(); $weekday = Date_Calc::dayOfWeek($day, $month, $year); return $weekday_names[$weekday]; } // }}} // {{{ getWeekdayAbbrname() /** * Returns the abbreviated weekday name for the given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param int $length the length of abbreviation * * @return string the abbreviated name of the day of the week * * @access public * @static * @see Date_Calc::getWeekdayFullname() */ function getWeekdayAbbrname($day = 0, $month = 0, $year = 0, $length = 3) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } return substr(Date_Calc::getWeekdayFullname($day, $month, $year), 0, $length); } // }}} // {{{ getMonthFullname() /** * Returns the full month name for the given month * * @param int $month the month * * @return string the full name of the month * * @access public * @static */ function getMonthFullname($month) { $month = (int)$month; if (empty($month)) { $month = (int)Date_Calc::dateNow('%m'); } $month_names = Date_Calc::getMonthNames(); return $month_names[$month]; } // }}} // {{{ getMonthAbbrname() /** * Returns the abbreviated month name for the given month * * @param int $month the month * @param int $length the length of abbreviation * * @return string the abbreviated name of the month * * @access public * @static * @see Date_Calc::getMonthFullname */ function getMonthAbbrname($month, $length = 3) { $month = (int)$month; if (empty($month)) { $month = Date_Calc::dateNow('%m'); } return substr(Date_Calc::getMonthFullname($month), 0, $length); } // }}} // {{{ getMonthFromFullname() /** * Returns the numeric month from the month name or an abreviation * * Both August and Aug would return 8. * * @param string $month the name of the month to examine. * Case insensitive. * * @return integer the month's number * * @access public * @static */ function getMonthFromFullName($month) { $month = strtolower($month); $months = Date_Calc::getMonthNames(); while(list($id, $name) = each($months)) { if (ereg($month, strtolower($name))) { return $id; } } return 0; } // }}} // {{{ getMonthNames() /** * Returns an array of month names * * Used to take advantage of the setlocale function to return * language specific month names. * * TODO: cache values to some global array to avoid preformace * hits when called more than once. * * @returns array an array of month names * * @access public * @static */ function getMonthNames() { $months = array(); for ($i = 1; $i < 13; $i++) { $months[$i] = strftime('%B', mktime(0, 0, 0, $i, 1, 2001)); } return $months; } // }}} // {{{ getWeekDays() /** * Returns an array of week days * * Used to take advantage of the setlocale function to * return language specific week days. * * TODO: cache values to some global array to avoid preformace * hits when called more than once. * * @returns array an array of week day names * * @access public * @static */ function getWeekDays() { $weekdays = array(); for ($i = 0; $i < 7; $i++) { $weekdays[$i] = strftime('%A', mktime(0, 0, 0, 1, $i, 2001)); } return $weekdays; } // }}} // {{{ dayOfWeek() /** * Returns day of week for given date (0 = Sunday) * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int the number of the day in the week * * @access public * @static */ function dayOfWeek($day = 0, $month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } if ($month > 2) { $month -= 2; } else { $month += 10; $year--; } $day = (floor((13 * $month - 1) / 5) + $day + ($year % 100) + floor(($year % 100) / 4) + floor(($year / 100) / 4) - 2 * floor($year / 100) + 77); $weekday_number = $day - 7 * floor($day / 7); return $weekday_number; } // }}} // {{{ weekOfYear() /** * Returns week of the year, first Sunday is first day of first week * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int the number of the week in the year * * @access public * @static */ function weekOfYear($day = 0, $month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $iso = Date_Calc::gregorianToISO($day, $month, $year); $parts = explode('-', $iso); $week_number = intval($parts[1]); return $week_number; } // }}} // {{{ quarterOfYear() /** * Returns quarter of the year for given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int the number of the quarter in the year * * @access public * @static */ function quarterOfYear($day = 0, $month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $year_quarter = intval(($month - 1) / 3 + 1); return $year_quarter; } // }}} // {{{ daysInMonth() /** * Find the number of days in the given month * * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int the number of days the month has * * @access public * @static */ function daysInMonth($month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if ($year == 1582 && $month == 10) { return 21; // October 1582 only had 1st-4th and 15th-31st } if ($month == 2) { if (Date_Calc::isLeapYear($year)) { return 29; } else { return 28; } } elseif ($month == 4 or $month == 6 or $month == 9 or $month == 11) { return 30; } else { return 31; } } // }}} // {{{ weeksInMonth() /** * Returns the number of rows on a calendar month * * Useful for determining the number of rows when displaying a typical * month calendar. * * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int the number of weeks the month has * * @access public * @static */ function weeksInMonth($month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } $FDOM = Date_Calc::firstOfMonthWeekday($month, $year); if (DATE_CALC_BEGIN_WEEKDAY==1 && $FDOM==0) { $first_week_days = 7 - $FDOM + DATE_CALC_BEGIN_WEEKDAY; $weeks = 1; } elseif (DATE_CALC_BEGIN_WEEKDAY==0 && $FDOM == 6) { $first_week_days = 7 - $FDOM + DATE_CALC_BEGIN_WEEKDAY; $weeks = 1; } else { $first_week_days = DATE_CALC_BEGIN_WEEKDAY - $FDOM; $weeks = 0; } $first_week_days %= 7; return ceil((Date_Calc::daysInMonth($month, $year) - $first_week_days) / 7) + $weeks; } // }}} // {{{ getCalendarWeek() /** * Return an array with days in week * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return array $week[$weekday] * * @access public * @static */ function getCalendarWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $week_array = array(); // date for the column of week $curr_day = Date_Calc::beginOfWeek($day, $month, $year,'%E'); for ($counter = 0; $counter <= 6; $counter++) { $week_array[$counter] = Date_Calc::daysToDate($curr_day, $format); $curr_day++; } return $week_array; } // }}} // {{{ getCalendarMonth() /** * Return a set of arrays to construct a calendar month for the given date * * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return array $month[$row][$col] * * @access public * @static */ function getCalendarMonth($month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } $month_array = array(); // date for the first row, first column of calendar month if (DATE_CALC_BEGIN_WEEKDAY == 1) { if (Date_Calc::firstOfMonthWeekday($month, $year) == 0) { $curr_day = Date_Calc::dateToDays('01', $month, $year) - 6; } else { $curr_day = Date_Calc::dateToDays('01', $month, $year) - Date_Calc::firstOfMonthWeekday($month, $year) + 1; } } else { $curr_day = (Date_Calc::dateToDays('01', $month, $year) - Date_Calc::firstOfMonthWeekday($month, $year)); } // number of days in this month $daysInMonth = Date_Calc::daysInMonth($month, $year); $weeksInMonth = Date_Calc::weeksInMonth($month, $year); for ($row_counter = 0; $row_counter < $weeksInMonth; $row_counter++) { for ($column_counter = 0; $column_counter <= 6; $column_counter++) { $month_array[$row_counter][$column_counter] = Date_Calc::daysToDate($curr_day , $format); $curr_day++; } } return $month_array; } // }}} // {{{ getCalendarYear() /** * Return a set of arrays to construct a calendar year for the given date * * @param int $year the year in four digit format, default current local year * @param string $format the string indicating how to format the output * * @return array $year[$month][$row][$col] * * @access public * @static */ function getCalendarYear($year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } $year_array = array(); for ($curr_month = 0; $curr_month <= 11; $curr_month++) { $year_array[$curr_month] = Date_Calc::getCalendarMonth($curr_month + 1, $year, $format); } return $year_array; } // }}} // {{{ prevDay() /** * Returns date of day before given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function prevDay($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = Date_Calc::dateToDays($day, $month, $year); return Date_Calc::daysToDate($days - 1, $format); } // }}} // {{{ nextDay() /** * Returns date of day after given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function nextDay($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = Date_Calc::dateToDays($day, $month, $year); return Date_Calc::daysToDate($days + 1, $format); } // }}} // {{{ prevWeekday() /** * Returns date of the previous weekday, skipping from Monday to Friday * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function prevWeekday($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = Date_Calc::dateToDays($day, $month, $year); if (Date_Calc::dayOfWeek($day, $month, $year) == 1) { $days -= 3; } elseif (Date_Calc::dayOfWeek($day, $month, $year) == 0) { $days -= 2; } else { $days -= 1; } return Date_Calc::daysToDate($days, $format); } // }}} // {{{ nextWeekday() /** * Returns date of the next weekday of given date, skipping from * Friday to Monday * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function nextWeekday($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = Date_Calc::dateToDays($day, $month, $year); if (Date_Calc::dayOfWeek($day, $month, $year) == 5) { $days += 3; } elseif (Date_Calc::dayOfWeek($day, $month, $year) == 6) { $days += 2; } else { $days += 1; } return Date_Calc::daysToDate($days, $format); } // }}} // {{{ prevDayOfWeek() /** * Returns date of the previous specific day of the week * from the given date * * @param int day of week, 0=Sunday * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param bool $onOrBefore if true and days are same, returns current day * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function prevDayOfWeek($dow, $day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT, $onOrBefore = false) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = Date_Calc::dateToDays($day, $month, $year); $curr_weekday = Date_Calc::dayOfWeek($day, $month, $year); if ($curr_weekday == $dow) { if (!$onOrBefore) { $days -= 7; } } elseif ($curr_weekday < $dow) { $days -= 7 - ($dow - $curr_weekday); } else { $days -= $curr_weekday - $dow; } return Date_Calc::daysToDate($days, $format); } // }}} // {{{ nextDayOfWeek() /** * Returns date of the next specific day of the week * from the given date * * @param int $dow the day of the week (0 = Sunday) * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param bool $onOrAfter if true and days are same, returns current day * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function nextDayOfWeek($dow, $day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT, $onOrAfter = false) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $days = Date_Calc::dateToDays($day, $month, $year); $curr_weekday = Date_Calc::dayOfWeek($day, $month, $year); if ($curr_weekday == $dow) { if (!$onOrAfter) { $days += 7; } } elseif ($curr_weekday > $dow) { $days += 7 - ($curr_weekday - $dow); } else { $days += $dow - $curr_weekday; } return Date_Calc::daysToDate($days, $format); } // }}} // {{{ prevDayOfWeekOnOrBefore() /** * Returns date of the previous specific day of the week * on or before the given date * * @param int $dow the day of the week (0 = Sunday) * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function prevDayOfWeekOnOrBefore($dow, $day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { return Date_Calc::prevDayOfWeek($dow, $day, $month, $year, $format, true); } // }}} // {{{ nextDayOfWeekOnOrAfter() /** * Returns date of the next specific day of the week * on or after the given date * * @param int $dow the day of the week (0 = Sunday) * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function nextDayOfWeekOnOrAfter($dow, $day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { return Date_Calc::nextDayOfWeek($dow, $day, $month, $year, $format, true); } // }}} // {{{ beginOfWeek() /** * Find the month day of the beginning of week for given date, * using DATE_CALC_BEGIN_WEEKDAY * * Can return weekday of prev month. * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function beginOfWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $this_weekday = Date_Calc::dayOfWeek($day, $month, $year); $interval = (7 - DATE_CALC_BEGIN_WEEKDAY + $this_weekday) % 7; return Date_Calc::daysToDate(Date_Calc::dateToDays($day, $month, $year) - $interval, $format); } // }}} // {{{ endOfWeek() /** * Find the month day of the end of week for given date, * using DATE_CALC_BEGIN_WEEKDAY * * Can return weekday of following month. * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function endOfWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $this_weekday = Date_Calc::dayOfWeek($day, $month, $year); $interval = (6 + DATE_CALC_BEGIN_WEEKDAY - $this_weekday) % 7; return Date_Calc::daysToDate(Date_Calc::dateToDays($day, $month, $year) + $interval, $format); } // }}} // {{{ beginOfPrevWeek() /** * Find the month day of the beginning of week before given date, * using DATE_CALC_BEGIN_WEEKDAY * * Can return weekday of prev month. * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function beginOfPrevWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $date = Date_Calc::daysToDate(Date_Calc::dateToDays($day-7, $month, $year), '%Y%m%d'); $prev_week_year = substr($date, 0, 4); $prev_week_month = substr($date, 4, 2); $prev_week_day = substr($date, 6, 2); return Date_Calc::beginOfWeek($prev_week_day, $prev_week_month, $prev_week_year, $format); } // }}} // {{{ beginOfNextWeek() /** * Find the month day of the beginning of week after given date, * using DATE_CALC_BEGIN_WEEKDAY * * Can return weekday of prev month. * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function beginOfNextWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $date = Date_Calc::daysToDate(Date_Calc::dateToDays($day + 7, $month, $year), '%Y%m%d'); $next_week_year = substr($date, 0, 4); $next_week_month = substr($date, 4, 2); $next_week_day = substr($date, 6, 2); return Date_Calc::beginOfWeek($next_week_day, $next_week_month, $next_week_year, $format); } // }}} // {{{ beginOfMonth() /** * Return date of first day of month of given date * * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @see Date_Calc::beginOfMonthBySpan() * @deprecated Method deprecated in Release 1.4.4 */ function beginOfMonth($month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } return Date_Calc::dateFormat('01', $month, $year, $format); } // }}} // {{{ beginOfPrevMonth() /** * Returns date of the first day of previous month of given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @see Date_Calc::beginOfMonthBySpan() * @deprecated Method deprecated in Release 1.4.4 */ function beginOfPrevMonth($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } if ($month > 1) { $month--; $day = 1; } else { $year--; $month = 12; $day = 1; } return Date_Calc::dateFormat($day, $month, $year, $format); } // }}} // {{{ endOfPrevMonth() /** * Returns date of the last day of previous month for given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @see Date_Calc::endOfMonthBySpan() * @deprecated Method deprecated in Release 1.4.4 */ function endOfPrevMonth($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } if ($month > 1) { $month--; } else { $year--; $month = 12; } $day = Date_Calc::daysInMonth($month, $year); return Date_Calc::dateFormat($day, $month, $year, $format); } // }}} // {{{ beginOfNextMonth() /** * Returns date of begin of next month of given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @see Date_Calc::beginOfMonthBySpan() * @deprecated Method deprecated in Release 1.4.4 */ function beginOfNextMonth($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } if ($month < 12) { $month++; $day = 1; } else { $year++; $month = 1; $day = 1; } return Date_Calc::dateFormat($day, $month, $year, $format); } // }}} // {{{ endOfNextMonth() /** * Returns date of the last day of next month of given date * * @param int $day the day of the month, default is current local day * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @see Date_Calc::endOfMonthBySpan() * @deprecated Method deprecated in Release 1.4.4 */ function endOfNextMonth($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } if ($month < 12) { $month++; } else { $year++; $month = 1; } $day = Date_Calc::daysInMonth($month, $year); return Date_Calc::dateFormat($day, $month, $year, $format); } // }}} // {{{ beginOfMonthBySpan() /** * Returns date of the first day of the month in the number of months * from the given date * * @param int $months the number of months from the date provided. * Positive numbers go into the future. * Negative numbers go into the past. * 0 is the month presented in $month. * @param string $month the month, default is current local month * @param string $year the year in four digit format, default is the * current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @since Method available since Release 1.4.4 */ function beginOfMonthBySpan($months = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if ($months > 0) { // future month $tmp_mo = $month + $months; $month = $tmp_mo % 12; if ($month == 0) { $month = 12; $year = $year + floor(($tmp_mo - 1) / 12); } else { $year = $year + floor($tmp_mo / 12); } } else { // past or present month $tmp_mo = $month + $months; if ($tmp_mo > 0) { // same year $month = $tmp_mo; } elseif ($tmp_mo == 0) { // prior dec $month = 12; $year--; } else { // some time in a prior year $month = 12 + ($tmp_mo % 12); $year = $year + floor($tmp_mo / 12); } } return Date_Calc::dateFormat(1, $month, $year, $format); } // }}} // {{{ endOfMonthBySpan() /** * Returns date of the last day of the month in the number of months * from the given date * * @param int $months the number of months from the date provided. * Positive numbers go into the future. * Negative numbers go into the past. * 0 is the month presented in $month. * @param string $month the month, default is current local month * @param string $year the year in four digit format, default is the * current local year * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static * @since Method available since Release 1.4.4 */ function endOfMonthBySpan($months = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if ($months > 0) { // future month $tmp_mo = $month + $months; $month = $tmp_mo % 12; if ($month == 0) { $month = 12; $year = $year + floor(($tmp_mo - 1) / 12); } else { $year = $year + floor($tmp_mo / 12); } } else { // past or present month $tmp_mo = $month + $months; if ($tmp_mo > 0) { // same year $month = $tmp_mo; } elseif ($tmp_mo == 0) { // prior dec $month = 12; $year--; } else { // some time in a prior year $month = 12 + ($tmp_mo % 12); $year = $year + floor($tmp_mo / 12); } } return Date_Calc::dateFormat(Date_Calc::daysInMonth($month, $year), $month, $year, $format); } // }}} // {{{ firstOfMonthWeekday() /** * Find the day of the week for the first of the month of given date * * @param int $month the month, default is current local month * @param int $year the year in four digit format, default is current local year * * @return int number of weekday for the first day, 0=Sunday * * @access public * @static */ function firstOfMonthWeekday($month = 0, $year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } return Date_Calc::dayOfWeek('01', $month, $year); } // }}} // {{{ NWeekdayOfMonth() /** * Calculates the date of the Nth weekday of the month, * such as the second Saturday of January 2000 * * @param int $week the number of the week to get * (1 = first, etc. Also can be 'last'.) * @param int $dow the day of the week (0 = Sunday) * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * @param string $format the string indicating how to format the output * * @return string the date in the desired format * * @access public * @static */ function NWeekdayOfMonth($week, $dow, $month, $year, $format = DATE_CALC_FORMAT) { if (is_numeric($week)) { $DOW1day = ($week - 1) * 7 + 1; $DOW1 = Date_Calc::dayOfWeek($DOW1day, $month, $year); $wdate = ($week - 1) * 7 + 1 + (7 + $dow - $DOW1) % 7; if ($wdate > Date_Calc::daysInMonth($month, $year)) { return -1; } else { return Date_Calc::dateFormat($wdate, $month, $year, $format); } } elseif ($week == 'last' && $dow < 7) { $lastday = Date_Calc::daysInMonth($month, $year); $lastdow = Date_Calc::dayOfWeek($lastday, $month, $year); $diff = $dow - $lastdow; if ($diff > 0) { return Date_Calc::dateFormat($lastday - (7 - $diff), $month, $year, $format); } else { return Date_Calc::dateFormat($lastday + $diff, $month, $year, $format); } } else { return -1; } } // }}} // {{{ isValidDate() /** * Returns true for valid date, false for invalid date * * @param int $day the day of the month * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return boolean * * @access public * @static */ function isValidDate($day, $month, $year) { if ($year < 0 || $year > 9999) { return false; } if (!checkdate($month, $day, $year)) { return false; } return true; } // }}} // {{{ isLeapYear() /** * Returns true for a leap year, else false * * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return boolean * * @access public * @static */ function isLeapYear($year = 0) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (preg_match('/\D/', $year)) { return false; } if ($year < 1000) { return false; } if ($year < 1582) { // pre Gregorio XIII - 1582 return ($year % 4 == 0); } else { // post Gregorio XIII - 1582 return (($year % 4 == 0) && ($year % 100 != 0)) || ($year % 400 == 0); } } // }}} // {{{ isFutureDate() /** * Determines if given date is a future date from now * * @param int $day the day of the month * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return boolean * * @access public * @static */ function isFutureDate($day, $month, $year) { $this_year = Date_Calc::dateNow('%Y'); $this_month = Date_Calc::dateNow('%m'); $this_day = Date_Calc::dateNow('%d'); if ($year > $this_year) { return true; } elseif ($year == $this_year) { if ($month > $this_month) { return true; } elseif ($month == $this_month) { if ($day > $this_day) { return true; } } } return false; } // }}} // {{{ isPastDate() /** * Determines if given date is a past date from now * * @param int $day the day of the month * @param int $month the month * @param int $year the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return boolean * * @access public * @static */ function isPastDate($day, $month, $year) { $this_year = Date_Calc::dateNow('%Y'); $this_month = Date_Calc::dateNow('%m'); $this_day = Date_Calc::dateNow('%d'); if ($year < $this_year) { return true; } elseif ($year == $this_year) { if ($month < $this_month) { return true; } elseif ($month == $this_month) { if ($day < $this_day) { return true; } } } return false; } // }}} // {{{ dateDiff() /** * Returns number of days between two given dates * * @param int $day1 the day of the month * @param int $month1 the month * @param int $year1 the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * @param int $day2 the day of the month * @param int $month2 the month * @param int $year2 the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return int the absolute number of days between the two dates. * If an error occurs, -1 is returned. * * @access public * @static */ function dateDiff($day1, $month1, $year1, $day2, $month2, $year2) { if (!Date_Calc::isValidDate($day1, $month1, $year1)) { return -1; } if (!Date_Calc::isValidDate($day2, $month2, $year2)) { return -1; } return abs(Date_Calc::dateToDays($day1, $month1, $year1) - Date_Calc::dateToDays($day2, $month2, $year2)); } // }}} // {{{ compareDates() /** * Compares two dates * * @param int $day1 the day of the month * @param int $month1 the month * @param int $year1 the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * @param int $day2 the day of the month * @param int $month2 the month * @param int $year2 the year. Use the complete year instead of the * abbreviated version. E.g. use 2005, not 05. * Do not add leading 0's for years prior to 1000. * * @return int 0 if the dates are equal. 1 if date 1 is later, -1 if * date 1 is earlier. * * @access public * @static */ function compareDates($day1, $month1, $year1, $day2, $month2, $year2) { $ndays1 = Date_Calc::dateToDays($day1, $month1, $year1); $ndays2 = Date_Calc::dateToDays($day2, $month2, $year2); if ($ndays1 == $ndays2) { return 0; } return ($ndays1 > $ndays2) ? 1 : -1; } // }}} } // }}} /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>Date-1.4.7/Date/Human.php100666 0 0 20551 10530726050 10113 * @copyright 1997-2006 Allan Kent * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version CVS: $Id: Human.php,v 1.6 2006/11/21 17:38:15 firman Exp $ * @link http://pear.php.net/package/Date * @since File available since Release 1.3 */ // }}} // {{{ Class: Date_Human /** * Class to convert date strings between Gregorian and Human calendar formats * * The Human Calendar format has been proposed by Scott Flansburg and can be * explained as follows: * The year is made up of 13 months * Each month has 28 days * Counting of months starts from 0 (zero) so the months will run from 0 to 12 * New Years day (00) is a monthless day * Note: Leap Years are not yet accounted for in the Human Calendar system * * @author Allan Kent * @copyright 1997-2005 Allan Kent * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version Release: 1.4.7 * @link http://pear.php.net/package/Date * @since Class available since Release 1.3 */ class Date_Human { // {{{ gregorianToHuman() /** * Returns an associative array containing the converted date information * in 'Human Calendar' format. * * @param int day in DD format, default current local day * @param int month in MM format, default current local month * @param int year in CCYY format, default to current local year * * @access public * * @return associative array( * hdom, // Human Day Of Month, starting at 1 * hdow, // Human Day Of Week, starting at 1 * hwom, // Human Week of Month, starting at 1 * hwoy, // Human Week of Year, starting at 1 * hmoy, // Human Month of Year, starting at 0 * ) * * If the day is New Years Day, the function will return * "hdom" => 0 * "hdow" => 0 * "hwom" => 0 * "hwoy" => 0 * "hmoy" => -1 * Since 0 is a valid month number under the Human Calendar, I have left * the month as -1 for New Years Day. */ function gregorianToHuman($day=0, $month=0, $year=0) { /* * Check to see if any of the arguments are empty * If they are then populate the $dateinfo array * Then check to see which arguments are empty and fill * those with the current date info */ if ((empty($day) || (empty($month)) || empty($year))) { $dateinfo = getdate(time()); } if (empty($day)) { $day = $dateinfo["mday"]; } if (empty($month)) { $month = $dateinfo["mon"]; } if (empty($year)) { $year = $dateinfo["year"]; } /* * We need to know how many days into the year we are */ $dateinfo = getdate(mktime(0, 0, 0, $month, $day, $year)); $dayofyear = $dateinfo["yday"]; /* * Human Calendar starts at 0 for months and the first day of the year * is designated 00, so we need to start our day of the year at 0 for * these calculations. * Also, the day of the month is calculated with a modulus of 28. * Because a day is 28 days, the last day of the month would have a * remainder of 0 and not 28 as it should be. Decrementing $dayofyear * gets around this. */ $dayofyear--; /* * 28 days in a month... */ $humanMonthOfYear = floor($dayofyear / 28); /* * If we are in the first month then the day of the month is $dayofyear * else we need to find the modulus of 28. */ if ($humanMonthOfYear == 0) { $humanDayOfMonth = $dayofyear; } else { $humanDayOfMonth = ($dayofyear) % 28; } /* * Day of the week is modulus 7 */ $humanDayOfWeek = $dayofyear % 7; /* * We can now increment $dayofyear back to it's correct value for * the remainder of the calculations */ $dayofyear++; /* * $humanDayOfMonth needs to be incremented now - recall that we fudged * it a bit by decrementing $dayofyear earlier * Same goes for $humanDayOfWeek */ $humanDayOfMonth++; $humanDayOfWeek++; /* * Week of the month is day of the month divided by 7, rounded up * Same for week of the year, but use $dayofyear instead $humanDayOfMonth */ $humanWeekOfMonth = ceil($humanDayOfMonth / 7); $humanWeekOfYear = ceil($dayofyear / 7); /* * Return an associative array of the values */ return array( "hdom" => $humanDayOfMonth, "hdow" => $humanDayOfWeek, "hwom" => $humanWeekOfMonth, "hwoy" => $humanWeekOfYear, "hmoy" => $humanMonthOfYear ); } // }}} // {{{ humanToGregorian() /** * Returns unix timestamp for a given Human Calendar date * * @param int day in DD format * @param int month in MM format * @param int year in CCYY format, default to current local year * * @access public * * @return int unix timestamp of date */ function humanToGregorian($day, $month, $year=0) { /* * Check to see if the year has been passed through. * If not get current year */ if (empty($year)) { $dateinfo = getdate(time()); $year = $dateinfo["year"]; } /* * We need to get the day of the year that we are currently at so that * we can work out the Gregorian Month and day */ $DayOfYear = $month * 28; $DayOfYear += $day; /* * Human Calendar starts at 0, so we need to increment $DayOfYear * to take into account the day 00 */ $DayOfYear++; /* * the mktime() function will correctly calculate the date for out of * range values, so putting $DayOfYear instead of the day of the month * will work fine. */ $GregorianTimeStamp = mktime(0, 0, 0, 1, $DayOfYear, $year); return $GregorianTimeStamp; } // }}} } // }}} /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>Date-1.4.7/Date/Span.php100666 0 0 102341 10530726050 7762 * @author Pierre-Alain Joye * @copyright 1997-2006 Leandro Lucarella, Pierre-Alain Joye * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version CVS: $Id: Span.php,v 1.9 2006/11/21 17:38:15 firman Exp $ * @link http://pear.php.net/package/Date * @since File available since Release 1.4 */ // }}} // {{{ Includes /** * Get the Date class */ require_once 'Date.php'; /** * Get the Date_Calc class */ require_once 'Date/Calc.php'; // }}} // {{{ Constants /** * Non Numeric Separated Values (NNSV) Input Format. * * Input format guessed from something like this: * dayshoursminutesseconds * Where is any quantity of non numeric chars. If no values are * given, time span is set to zero, if one value is given, it's used for * hours, if two values are given it's used for hours and minutes and if * three values are given, it's used for hours, minutes and seconds.
* Examples:
* '' -> 0, 0, 0, 0 (days, hours, minutes, seconds)
* '12' -> 0, 12, 0, 0 * '12.30' -> 0, 12, 30, 0
* '12:30:18' -> 0, 12, 30, 18
* '3-12-30-18' -> 3, 12, 30, 18
* '3 days, 12-30-18' -> 3, 12, 30, 18
* '12:30 with 18 secs' -> 0, 12, 30, 18
* * @const int */ define('DATE_SPAN_INPUT_FORMAT_NNSV', 1); // }}} // {{{ Global Variables /** * Default time format when converting to a string. * * @global string */ $GLOBALS['_DATE_SPAN_FORMAT'] = '%C'; /** * Default time format when converting from a string. * * @global mixed */ $GLOBALS['_DATE_SPAN_INPUT_FORMAT'] = DATE_SPAN_INPUT_FORMAT_NNSV; // }}} // {{{ Class: Date_Span /** * Generic time span handling class for PEAR * * @author Leandro Lucarella * @author Pierre-Alain Joye * @copyright 1997-2006 Leandro Lucarella, Pierre-Alain Joye * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version Release: 1.4.7 * @link http://pear.php.net/package/Date * @since Class available since Release 1.4 */ class Date_Span { // {{{ Properties /** * @var int */ var $day; /** * @var int */ var $hour; /** * @var int */ var $minute; /** * @var int */ var $second; // }}} // {{{ Constructor /** * Constructor. * * Creates the time span object calling the set() method. * * @param mixed $time Time span expression. * @param mixed $format Format string to set it from a string or the * second date set it from a date diff. * * @see set() * @access public */ function Date_Span($time = 0, $format = null) { $this->set($time, $format); } // }}} // {{{ set() /** * Set the time span to a new value in a 'smart' way. * * Sets the time span depending on the argument types, calling * to the appropriate setFromXxx() method. * * @param mixed $time Time span expression. * @param mixed $format Format string to set it from a string or the * second date set it from a date diff. * * @return bool true on success. * * @see setFromObject() * @see setFromArray() * @see setFromString() * @see setFromSeconds() * @see setFromDateDiff() * @access public */ function set($time = 0, $format = null) { if (is_a($time, 'date_span')) { return $this->copy($time); } elseif (is_a($time, 'date') and is_a($format, 'date')) { return $this->setFromDateDiff($time, $format); } elseif (is_array($time)) { return $this->setFromArray($time); } elseif (is_string($time)) { return $this->setFromString($time, $format); } elseif (is_int($time)) { return $this->setFromSeconds($time); } else { return $this->setFromSeconds(0); } } // }}} // {{{ setFromArray() /** * Set the time span from an array. * * Set the time span from an array. Any value can be a float (but it * has no sense in seconds), for example array(23.5, 20, 0) is * interpreted as 23 hours, .5*60 + 20 = 50 minutes and 0 seconds. * * @param array $time Items are counted from right to left. First * item is for seconds, second for minutes, third * for hours and fourth for days. If there are * less items than 4, zero (0) is assumed for the * absent values. * * @return bool True on success. * * @access public */ function setFromArray($time) { if (!is_array($time)) { return false; } $tmp1 = new Date_Span; if (!$tmp1->setFromSeconds(@array_pop($time))) { return false; } $tmp2 = new Date_Span; if (!$tmp2->setFromMinutes(@array_pop($time))) { return false; } $tmp1->add($tmp2); if (!$tmp2->setFromHours(@array_pop($time))) { return false; } $tmp1->add($tmp2); if (!$tmp2->setFromDays(@array_pop($time))) { return false; } $tmp1->add($tmp2); return $this->copy($tmp1); } // }}} // {{{ setFromString() /** * Set the time span from a string based on an input format. * * Set the time span from a string based on an input format. This is * some like a mix of format() method and sscanf() PHP function. The * error checking and validation of this function is very primitive, * so you should be carefull when using it with unknown $time strings. * With this method you are assigning day, hour, minute and second * values, and the last values are used. This means that if you use * something like setFromString('10, 20', '%H, %h') your time span * would be 20 hours long. Allways remember that this method set * all the values, so if you had a $time span 30 minutes long * and you make $time->setFromString('20 hours', '%H hours'), $time * span would be 20 hours long (and not 20 hours and 30 minutes). * Input format options:
* %C Days with time, same as "%D, %H:%M:%S".
* %d Total days as a float number * (2 days, 12 hours = 2.5 days).
* %D Days as a decimal number.
* %e Total hours as a float number * (1 day, 2 hours, 30 minutes = 26.5 hours).
* %f Total minutes as a float number * (2 minutes, 30 seconds = 2.5 minutes).
* %g Total seconds as a decimal number * (2 minutes, 30 seconds = 90 seconds).
* %h Hours as decimal number.
* %H Hours as decimal number limited to 2 digits.
* %m Minutes as a decimal number.
* %M Minutes as a decimal number limited to 2 digits.
* %n Newline character (\n).
* %p Either 'am' or 'pm' depending on the time. If 'pm' * is detected it adds 12 hours to the resulting time * span (without any checks). This is case * insensitive.
* %r Time in am/pm notation, same as "%H:%M:%S %p".
* %R Time in 24-hour notation, same as "%H:%M".
* %s Seconds as a decimal number.
* %S Seconds as a decimal number limited to 2 digits.
* %t Tab character (\t).
* %T Current time equivalent, same as "%H:%M:%S".
* %% Literal '%'.
* * @param string $time String from where to get the time span * information. * @param string $format Format string. * * @return bool True on success. * * @access public */ function setFromString($time, $format = null) { if (is_null($format)) { $format = $GLOBALS['_DATE_SPAN_INPUT_FORMAT']; } // If format is a string, it parses the string format. if (is_string($format)) { $str = ''; $vars = array(); $pm = 'am'; $day = $hour = $minute = $second = 0; for ($i = 0; $i < strlen($format); $i++) { $char = $format{$i}; if ($char == '%') { $nextchar = $format{++$i}; switch ($nextchar) { case 'c': $str .= '%d, %d:%d:%d'; array_push( $vars, 'day', 'hour', 'minute', 'second'); break; case 'C': $str .= '%d, %2d:%2d:%2d'; array_push( $vars, 'day', 'hour', 'minute', 'second'); break; case 'd': $str .= '%f'; array_push($vars, 'day'); break; case 'D': $str .= '%d'; array_push($vars, 'day'); break; case 'e': $str .= '%f'; array_push($vars, 'hour'); break; case 'f': $str .= '%f'; array_push($vars, 'minute'); break; case 'g': $str .= '%f'; array_push($vars, 'second'); break; case 'h': $str .= '%d'; array_push($vars, 'hour'); break; case 'H': $str .= '%2d'; array_push($vars, 'hour'); break; case 'm': $str .= '%d'; array_push($vars, 'minute'); break; case 'M': $str .= '%2d'; array_push($vars, 'minute'); break; case 'n': $str .= "\n"; break; case 'p': $str .= '%2s'; array_push($vars, 'pm'); break; case 'r': $str .= '%2d:%2d:%2d %2s'; array_push( $vars, 'hour', 'minute', 'second', 'pm'); break; case 'R': $str .= '%2d:%2d'; array_push($vars, 'hour', 'minute'); break; case 's': $str .= '%d'; array_push($vars, 'second'); break; case 'S': $str .= '%2d'; array_push($vars, 'second'); break; case 't': $str .= "\t"; break; case 'T': $str .= '%2d:%2d:%2d'; array_push($vars, 'hour', 'minute', 'second'); break; case '%': $str .= "%"; break; default: $str .= $char . $nextchar; } } else { $str .= $char; } } $vals = sscanf($time, $str); foreach ($vals as $i => $val) { if (is_null($val)) { return false; } $$vars[$i] = $val; } if (strcasecmp($pm, 'pm') == 0) { $hour += 12; } elseif (strcasecmp($pm, 'am') != 0) { return false; } $this->setFromArray(array($day, $hour, $minute, $second)); // If format is a integer, it uses a predefined format // detection method. } elseif (is_integer($format)) { switch ($format) { case DATE_SPAN_INPUT_FORMAT_NNSV: $time = preg_split('/\D+/', $time); switch (count($time)) { case 0: return $this->setFromArray( array(0, 0, 0, 0)); case 1: return $this->setFromArray( array(0, $time[0], 0, 0)); case 2: return $this->setFromArray( array(0, $time[0], $time[1], 0)); case 3: return $this->setFromArray( array(0, $time[0], $time[1], $time[2])); default: return $this->setFromArray($time); } break; } } return false; } // }}} // {{{ setFromSeconds() /** * Set the time span from a total number of seconds. * * @param int $seconds Total number of seconds. * * @return bool True on success. * * @access public */ function setFromSeconds($seconds) { if ($seconds < 0) { return false; } $sec = intval($seconds); $min = floor($sec / 60); $hour = floor($min / 60); $day = intval(floor($hour / 24)); $this->second = $sec % 60; $this->minute = $min % 60; $this->hour = $hour % 24; $this->day = $day; return true; } // }}} // {{{ setFromMinutes() /** * Set the time span from a total number of minutes. * * @param float $minutes Total number of minutes. * * @return bool True on success. * * @access public */ function setFromMinutes($minutes) { return $this->setFromSeconds(round($minutes * 60)); } // }}} // {{{ setFromHours() /** * Set the time span from a total number of hours. * * @param float $hours Total number of hours. * * @return bool True on success. * * @access public */ function setFromHours($hours) { return $this->setFromSeconds(round($hours * 3600)); } // }}} // {{{ setFromDays() /** * Set the time span from a total number of days. * * @param float $days Total number of days. * * @return bool True on success. * * @access public */ function setFromDays($days) { return $this->setFromSeconds(round($days * 86400)); } // }}} // {{{ setFromDateDiff() /** * Set the span from the elapsed time between two dates. * * Set the span from the elapsed time between two dates. The time span * is allways positive, so the date's order is not important. * * @param object Date $date1 First Date. * @param object Date $date2 Second Date. * * @return bool True on success. * * @access public */ function setFromDateDiff($date1, $date2) { if (!is_a($date1, 'date') or !is_a($date2, 'date')) { return false; } $date1->toUTC(); $date2->toUTC(); if ($date1->after($date2)) { list($date1, $date2) = array($date2, $date1); } $days = Date_Calc::dateDiff( $date1->getDay(), $date1->getMonth(), $date1->getYear(), $date2->getDay(), $date2->getMonth(), $date2->getYear() ); $hours = $date2->getHour() - $date1->getHour(); $mins = $date2->getMinute() - $date1->getMinute(); $secs = $date2->getSecond() - $date1->getSecond(); $this->setFromSeconds( $days * 86400 + $hours * 3600 + $mins * 60 + $secs ); return true; } // }}} // {{{ copy() /** * Set the time span from another time object. * * @param object Date_Span $time Source time span object. * * @return bool True on success. * * @access public */ function copy($time) { if (is_a($time, 'date_span')) { $this->second = $time->second; $this->minute = $time->minute; $this->hour = $time->hour; $this->day = $time->day; return true; } else { return false; } } // }}} // {{{ format() /** * Time span pretty printing (similar to Date::format()). * * Formats the time span in the given format, similar to * strftime() and Date::format().
*
* Formatting options:
* %C Days with time, same as "%D, %H:%M:%S".
* %d Total days as a float number * (2 days, 12 hours = 2.5 days).
* %D Days as a decimal number.
* %e Total hours as a float number * (1 day, 2 hours, 30 minutes = 26.5 hours).
* %E Total hours as a decimal number * (1 day, 2 hours, 40 minutes = 26 hours).
* %f Total minutes as a float number * (2 minutes, 30 seconds = 2.5 minutes).
* %F Total minutes as a decimal number * (1 hour, 2 minutes, 40 seconds = 62 minutes).
* %g Total seconds as a decimal number * (2 minutes, 30 seconds = 90 seconds).
* %h Hours as decimal number (0 to 23).
* %H Hours as decimal number (00 to 23).
* %i Hours as decimal number on 12-hour clock * (1 to 12).
* %I Hours as decimal number on 12-hour clock * (01 to 12).
* %m Minutes as a decimal number (0 to 59).
* %M Minutes as a decimal number (00 to 59).
* %n Newline character (\n).
* %p Either 'am' or 'pm' depending on the time.
* %P Either 'AM' or 'PM' depending on the time.
* %r Time in am/pm notation, same as "%I:%M:%S %p".
* %R Time in 24-hour notation, same as "%H:%M".
* %s Seconds as a decimal number (0 to 59).
* %S Seconds as a decimal number (00 to 59).
* %t Tab character (\t).
* %T Current time equivalent, same as "%H:%M:%S".
* %% Literal '%'.
* * @param string $format The format string for returned time span. * * @return string The time span in specified format. * * @access public */ function format($format = null) { if (is_null($format)) { $format = $GLOBALS['_DATE_SPAN_FORMAT']; } $output = ''; for ($i = 0; $i < strlen($format); $i++) { $char = $format{$i}; if ($char == '%') { $nextchar = $format{++$i}; switch ($nextchar) { case 'C': $output .= sprintf( '%d, %02d:%02d:%02d', $this->day, $this->hour, $this->minute, $this->second ); break; case 'd': $output .= $this->toDays(); break; case 'D': $output .= $this->day; break; case 'e': $output .= $this->toHours(); break; case 'E': $output .= floor($this->toHours()); break; case 'f': $output .= $this->toMinutes(); break; case 'F': $output .= floor($this->toMinutes()); break; case 'g': $output .= $this->toSeconds(); break; case 'h': $output .= $this->hour; break; case 'H': $output .= sprintf('%02d', $this->hour); break; case 'i': $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour; $output .= ($hour == 0) ? 12 : $hour; break; case 'I': $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour; $output .= sprintf('%02d', $hour==0 ? 12 : $hour); break; case 'm': $output .= $this->minute; break; case 'M': $output .= sprintf('%02d',$this->minute); break; case 'n': $output .= "\n"; break; case 'p': $output .= $this->hour >= 12 ? 'pm' : 'am'; break; case 'P': $output .= $this->hour >= 12 ? 'PM' : 'AM'; break; case 'r': $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour; $output .= sprintf( '%02d:%02d:%02d %s', $hour==0 ? 12 : $hour, $this->minute, $this->second, $this->hour >= 12 ? 'pm' : 'am' ); break; case 'R': $output .= sprintf( '%02d:%02d', $this->hour, $this->minute ); break; case 's': $output .= $this->second; break; case 'S': $output .= sprintf('%02d', $this->second); break; case 't': $output .= "\t"; break; case 'T': $output .= sprintf( '%02d:%02d:%02d', $this->hour, $this->minute, $this->second ); break; case '%': $output .= "%"; break; default: $output .= $char . $nextchar; } } else { $output .= $char; } } return $output; } // }}} // {{{ toSeconds() /** * Convert time span to seconds. * * @return int Time span as an integer number of seconds. * * @access public */ function toSeconds() { return $this->day * 86400 + $this->hour * 3600 + $this->minute * 60 + $this->second; } // }}} // {{{ toMinutes() /** * Convert time span to minutes. * * @return float Time span as a decimal number of minutes. * * @access public */ function toMinutes() { return $this->day * 1440 + $this->hour * 60 + $this->minute + $this->second / 60; } // }}} // {{{ toHours() /** * Convert time span to hours. * * @return float Time span as a decimal number of hours. * * @access public */ function toHours() { return $this->day * 24 + $this->hour + $this->minute / 60 + $this->second / 3600; } // }}} // {{{ toDays() /** * Convert time span to days. * * @return float Time span as a decimal number of days. * * @access public */ function toDays() { return $this->day + $this->hour / 24 + $this->minute / 1440 + $this->second / 86400; } // }}} // {{{ add() /** * Adds a time span. * * @param object Date_Span $time Time span to add. * * @access public */ function add($time) { return $this->setFromSeconds( $this->toSeconds() + $time->toSeconds() ); } // }}} // {{{ substract() /** * Subtracts a time span. * * Subtracts a time span. If the time span to subtract is larger * than the original, the result is zero (there's no sense in * negative time spans). * * @param object Date_Span $time Time span to subtract. * * @access public */ function subtract($time) { $sub = $this->toSeconds() - $time->toSeconds(); if ($sub < 0) { $this->setFromSeconds(0); } else { $this->setFromSeconds($sub); } } // }}} // {{{ equal() /** * Tells if time span is equal to $time. * * @param object Date_Span $time Time span to compare to. * * @return bool True if the time spans are equal. * * @access public */ function equal($time) { return $this->toSeconds() == $time->toSeconds(); } // }}} // {{{ greaterEqual() /** * Tells if this time span is greater or equal than $time. * * @param object Date_Span $time Time span to compare to. * * @return bool True if this time span is greater or equal than $time. * * @access public */ function greaterEqual($time) { return $this->toSeconds() >= $time->toSeconds(); } // }}} // {{{ lowerEqual() /** * Tells if this time span is lower or equal than $time. * * @param object Date_Span $time Time span to compare to. * * @return bool True if this time span is lower or equal than $time. * * @access public */ function lowerEqual($time) { return $this->toSeconds() <= $time->toSeconds(); } // }}} // {{{ greater() /** * Tells if this time span is greater than $time. * * @param object Date_Span $time Time span to compare to. * * @return bool True if this time span is greater than $time. * * @access public */ function greater($time) { return $this->toSeconds() > $time->toSeconds(); } // }}} // {{{ lower() /** * Tells if this time span is lower than $time. * * @param object Date_Span $time Time span to compare to. * * @return bool True if this time span is lower than $time. * * @access public */ function lower($time) { return $this->toSeconds() < $time->toSeconds(); } // }}} // {{{ compare() /** * Compares two time spans. * * Compares two time spans. Suitable for use in sorting functions. * * @param object Date_Span $time1 The first time span. * @param object Date_Span $time2 The second time span. * * @return int 0 if the time spans are equal, -1 if time1 is lower * than time2, 1 if time1 is greater than time2. * * @static * @access public */ function compare($time1, $time2) { if ($time1->equal($time2)) { return 0; } elseif ($time1->lower($time2)) { return -1; } else { return 1; } } // }}} // {{{ isEmpty() /** * Tells if the time span is empty (zero length). * * @return bool True is it's empty. */ function isEmpty() { return !$this->day && !$this->hour && !$this->minute && !$this->second; } // }}} // {{{ setDefaultInputFormat() /** * Set the default input format. * * @param mixed $format New default input format. * * @return mixed Previous default input format. * * @static */ function setDefaultInputFormat($format) { $old = $GLOBALS['_DATE_SPAN_INPUT_FORMAT']; $GLOBALS['_DATE_SPAN_INPUT_FORMAT'] = $format; return $old; } // }}} // {{{ getDefaultInputFormat() /** * Get the default input format. * * @return mixed Default input format. * * @static */ function getDefaultInputFormat() { return $GLOBALS['_DATE_SPAN_INPUT_FORMAT']; } // }}} // {{{ setDefaultFormat() /** * Set the default format. * * @param mixed $format New default format. * * @return mixed Previous default format. * * @static */ function setDefaultFormat($format) { $old = $GLOBALS['_DATE_SPAN_FORMAT']; $GLOBALS['_DATE_SPAN_FORMAT'] = $format; return $old; } // }}} // {{{ getDefaultFormat() /** * Get the default format. * * @return mixed Default format. * * @static */ function getDefaultFormat() { return $GLOBALS['_DATE_SPAN_FORMAT']; } // }}} // {{{ __clone() /** * Returns a copy of the object (workarround for PHP5 forward compatibility). * * @return object Date_Span Copy of the object. */ function __clone() { $c = get_class($this); $s = new $c; $s->day = $this->day; $s->hour = $this->hour; $s->minute = $this->minute; $s->second = $this->second; return $s; } // }}} } // }}} /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>Date-1.4.7/Date/TimeZone.php100666 0 0 476453 10530726050 10635 * @author Pierre-Alain Joye * @copyright 1997-2006 Baba Buehler, Pierre-Alain Joye * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version CVS: $Id: TimeZone.php,v 1.14 2006/11/22 01:03:12 firman Exp $ * @link http://pear.php.net/package/Date */ // }}} // {{{ Class: Date_TimeZone /** * TimeZone representation class, along with time zone information data * * The default timezone is set from the first valid timezone id found * in one of the following places, in this order: * + global $_DATE_TIMEZONE_DEFAULT * + system environment variable PHP_TZ * + system environment variable TZ * + the result of date('T') * * If no valid timezone id is found, the default timezone is set to 'UTC'. * You may also manually set the default timezone by passing a valid id to * Date_TimeZone::setDefault(). * * This class includes time zone data (from zoneinfo) in the form of a * global array, $_DATE_TIMEZONE_DATA. * * @author Baba Buehler * @copyright 1997-2006 Baba Buehler, Pierre-Alain Joye * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version Release: 1.4.7 * @link http://pear.php.net/package/Date */ class Date_TimeZone { // {{{ Properties /** * Time Zone ID of this time zone * @var string */ var $id; /** * Long Name of this time zone (ie Central Standard Time) * @var string */ var $longname; /** * Short Name of this time zone (ie CST) * @var string */ var $shortname; /** * true if this time zone observes daylight savings time * @var boolean */ var $hasdst; /** * DST Long Name of this time zone * @var string */ var $dstlongname; /** * DST Short Name of this timezone * @var string */ var $dstshortname; /** * offset, in milliseconds, of this timezone * @var int */ var $offset; /** * System Default Time Zone * @var object Date_TimeZone */ var $default; // }}} // {{{ Constructor /** * Constructor * * Creates a new Date::TimeZone object, representing the time zone * specified in $id. If the supplied ID is invalid, the created * time zone is UTC. * * @access public * @param string $id the time zone id * @return object Date_TimeZone the new Date_TimeZone object */ function Date_TimeZone($id) { $_DATE_TIMEZONE_DATA =& $GLOBALS['_DATE_TIMEZONE_DATA']; if(Date_TimeZone::isValidID($id)) { $this->id = $id; $this->longname = $_DATE_TIMEZONE_DATA[$id]['longname']; $this->shortname = $_DATE_TIMEZONE_DATA[$id]['shortname']; $this->offset = $_DATE_TIMEZONE_DATA[$id]['offset']; if($_DATE_TIMEZONE_DATA[$id]['hasdst']) { $this->hasdst = true; $this->dstlongname = $_DATE_TIMEZONE_DATA[$id]['dstlongname']; $this->dstshortname = $_DATE_TIMEZONE_DATA[$id]['dstshortname']; } else { $this->hasdst = false; $this->dstlongname = $this->longname; $this->dstshortname = $this->shortname; } } else { $this->id = 'UTC'; $this->longname = $_DATE_TIMEZONE_DATA[$this->id]['longname']; $this->shortname = $_DATE_TIMEZONE_DATA[$this->id]['shortname']; $this->hasdst = $_DATE_TIMEZONE_DATA[$this->id]['hasdst']; $this->offset = $_DATE_TIMEZONE_DATA[$this->id]['offset']; } } // }}} // {{{ getDefault() /** * Return a TimeZone object representing the system default time zone * * Return a TimeZone object representing the system default time zone, * which is initialized during the loading of TimeZone.php. * * @access public * @return object Date_TimeZone the default time zone */ function getDefault() { return new Date_TimeZone($GLOBALS['_DATE_TIMEZONE_DEFAULT']); } // }}} // {{{ setDefault() /** * Sets the system default time zone to the time zone in $id * * Sets the system default time zone to the time zone in $id * * @access public * @param string $id the time zone id to use */ function setDefault($id) { if(Date_TimeZone::isValidID($id)) { $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = $id; } } // }}} // {{{ isValidID() /** * Tests if given id is represented in the $_DATE_TIMEZONE_DATA time zone data * * Tests if given id is represented in the $_DATE_TIMEZONE_DATA time zone data * * @access public * @param string $id the id to test * @return boolean true if the supplied ID is valid */ function isValidID($id) { if(isset($GLOBALS['_DATE_TIMEZONE_DATA'][$id])) { return true; } else { return false; } } // }}} // {{{ isEqual() /** * Is this time zone equal to another * * Tests to see if this time zone is equal (ids match) * to a given Date_TimeZone object. * * @access public * @param object Date_TimeZone $tz the timezone to test * @return boolean true if this time zone is equal to the supplied time zone */ function isEqual($tz) { if(strcasecmp($this->id, $tz->id) == 0) { return true; } else { return false; } } // }}} // {{{ isEquivalent() /** * Is this time zone equivalent to another * * Tests to see if this time zone is equivalent to * a given time zone object. Equivalence in this context * is defined by the two time zones having an equal raw * offset and an equal setting of "hasdst". This is not true * equivalence, as the two time zones may have different rules * for the observance of DST, but this implementation does not * know DST rules. * * @access public * @param object Date_TimeZone $tz the timezone object to test * @return boolean true if this time zone is equivalent to the supplied time zone */ function isEquivalent($tz) { if($this->offset == $tz->offset && $this->hasdst == $tz->hasdst) { return true; } else { return false; } } // }}} // {{{ hasDaylightTime() /** * Returns true if this zone observes daylight savings time * * Returns true if this zone observes daylight savings time * * @access public * @return boolean true if this time zone has DST */ function hasDaylightTime() { return $this->hasdst; } // }}} // {{{ inDaylightTime() /** * Is the given date/time in DST for this time zone * * Attempts to determine if a given Date object represents a date/time * that is in DST for this time zone. WARNINGS: this basically attempts to * "trick" the system into telling us if we're in DST for a given time zone. * This uses putenv() which may not work in safe mode, and relies on unix time * which is only valid for dates from 1970 to ~2038. This relies on the * underlying OS calls, so it may not work on Windows or on a system where * zoneinfo is not installed or configured properly. * * @access public * @param object Date $date the date/time to test * @return boolean true if this date is in DST for this time zone */ function inDaylightTime($date) { $env_tz = ''; if(isset($_ENV['TZ']) && getenv('TZ')) { $env_tz = getenv('TZ'); } putenv('TZ=' . $this->id); $ltime = localtime($date->getTime(), true); if ($env_tz != '') { putenv('TZ=' . $env_tz); } return $ltime['tm_isdst']; } // }}} // {{{ getDSTSavings() /** * Get the DST offset for this time zone * * Returns the DST offset of this time zone, in milliseconds, * if the zone observes DST, zero otherwise. Currently the * DST offset is hard-coded to one hour. * * @access public * @return int the DST offset, in milliseconds or zero if the zone does not observe DST */ function getDSTSavings() { if($this->hasdst) { return 3600000; } else { return 0; } } // }}} // {{{ getOffset() /** * Get the DST-corrected offset to UTC for the given date * * Attempts to get the offset to UTC for a given date/time, taking into * account daylight savings time, if the time zone observes it and if * it is in effect. Please see the WARNINGS on Date::TimeZone::inDaylightTime(). * * * @access public * @param object Date $date the Date to test * @return int the corrected offset to UTC in milliseconds */ function getOffset($date) { if($this->inDaylightTime($date)) { return $this->offset + $this->getDSTSavings(); } else { return $this->offset; } } // }}} // {{{ getAvailableIDs() /** * Returns the list of valid time zone id strings * * Returns the list of valid time zone id strings * * @access public * @return mixed an array of strings with the valid time zone IDs */ function getAvailableIDs() { return array_keys($GLOBALS['_DATE_TIMEZONE_DATA']); } // }}} // {{{ getID() /** * Returns the id for this time zone * * Returns the time zone id for this time zone, i.e. "America/Chicago" * * @access public * @return string the id */ function getID() { return $this->id; } // }}} // {{{ getLongName() /** * Returns the long name for this time zone * * Returns the long name for this time zone, * i.e. "Central Standard Time" * * @access public * @return string the long name */ function getLongName() { return $this->longname; } // }}} // {{{ getShortName() /** * Returns the short name for this time zone * * Returns the short name for this time zone, i.e. "CST" * * @access public * @return string the short name */ function getShortName() { return $this->shortname; } // }}} // {{{ getDSTLongName() /** * Returns the DST long name for this time zone * * Returns the DST long name for this time zone, i.e. "Central Daylight Time" * * @access public * @return string the daylight savings time long name */ function getDSTLongName() { return $this->dstlongname; } // }}} // {{{ getDSTShortName() /** * Returns the DST short name for this time zone * * Returns the DST short name for this time zone, i.e. "CDT" * * @access public * @return string the daylight savings time short name */ function getDSTShortName() { return $this->dstshortname; } // }}} // {{{ getRawOffset() /** * Returns the raw (non-DST-corrected) offset from UTC/GMT for this time zone * * Returns the raw (non-DST-corrected) offset from UTC/GMT for this time zone * * @access public * @return int the offset, in milliseconds */ function getRawOffset() { return $this->offset; } // }}} } // }}} /** * Time Zone Data offset is in miliseconds * * @global array $GLOBALS['_DATE_TIMEZONE_DATA'] */ $GLOBALS['_DATE_TIMEZONE_DATA'] = array( 'Etc/GMT+12' => array( 'offset' => -43200000, 'longname' => 'GMT-12:00', 'shortname' => 'GMT-12:00', 'hasdst' => false ), 'Etc/GMT+11' => array( 'offset' => -39600000, 'longname' => 'GMT-11:00', 'shortname' => 'GMT-11:00', 'hasdst' => false ), 'MIT' => array( 'offset' => -39600000, 'longname' => 'West Samoa Time', 'shortname' => 'WST', 'hasdst' => false ), 'Pacific/Apia' => array( 'offset' => -39600000, 'longname' => 'West Samoa Time', 'shortname' => 'WST', 'hasdst' => false ), 'Pacific/Midway' => array( 'offset' => -39600000, 'longname' => 'Samoa Standard Time', 'shortname' => 'SST', 'hasdst' => false ), 'Pacific/Niue' => array( 'offset' => -39600000, 'longname' => 'Niue Time', 'shortname' => 'NUT', 'hasdst' => false ), 'Pacific/Pago_Pago' => array( 'offset' => -39600000, 'longname' => 'Samoa Standard Time', 'shortname' => 'SST', 'hasdst' => false ), 'Pacific/Samoa' => array( 'offset' => -39600000, 'longname' => 'Samoa Standard Time', 'shortname' => 'SST', 'hasdst' => false ), 'US/Samoa' => array( 'offset' => -39600000, 'longname' => 'Samoa Standard Time', 'shortname' => 'SST', 'hasdst' => false ), 'America/Adak' => array( 'offset' => -36000000, 'longname' => 'Hawaii-Aleutian Standard Time', 'shortname' => 'HAST', 'hasdst' => true, 'dstlongname' => 'Hawaii-Aleutian Daylight Time', 'dstshortname' => 'HADT' ), 'America/Atka' => array( 'offset' => -36000000, 'longname' => 'Hawaii-Aleutian Standard Time', 'shortname' => 'HAST', 'hasdst' => true, 'dstlongname' => 'Hawaii-Aleutian Daylight Time', 'dstshortname' => 'HADT' ), 'Etc/GMT+10' => array( 'offset' => -36000000, 'longname' => 'GMT-10:00', 'shortname' => 'GMT-10:00', 'hasdst' => false ), 'HST' => array( 'offset' => -36000000, 'longname' => 'Hawaii Standard Time', 'shortname' => 'HST', 'hasdst' => false ), 'Pacific/Fakaofo' => array( 'offset' => -36000000, 'longname' => 'Tokelau Time', 'shortname' => 'TKT', 'hasdst' => false ), 'Pacific/Honolulu' => array( 'offset' => -36000000, 'longname' => 'Hawaii Standard Time', 'shortname' => 'HST', 'hasdst' => false ), 'Pacific/Johnston' => array( 'offset' => -36000000, 'longname' => 'Hawaii Standard Time', 'shortname' => 'HST', 'hasdst' => false ), 'Pacific/Rarotonga' => array( 'offset' => -36000000, 'longname' => 'Cook Is. Time', 'shortname' => 'CKT', 'hasdst' => false ), 'Pacific/Tahiti' => array( 'offset' => -36000000, 'longname' => 'Tahiti Time', 'shortname' => 'TAHT', 'hasdst' => false ), 'SystemV/HST10' => array( 'offset' => -36000000, 'longname' => 'Hawaii Standard Time', 'shortname' => 'HST', 'hasdst' => false ), 'US/Aleutian' => array( 'offset' => -36000000, 'longname' => 'Hawaii-Aleutian Standard Time', 'shortname' => 'HAST', 'hasdst' => true, 'dstlongname' => 'Hawaii-Aleutian Daylight Time', 'dstshortname' => 'HADT' ), 'US/Hawaii' => array( 'offset' => -36000000, 'longname' => 'Hawaii Standard Time', 'shortname' => 'HST', 'hasdst' => false ), 'Pacific/Marquesas' => array( 'offset' => -34200000, 'longname' => 'Marquesas Time', 'shortname' => 'MART', 'hasdst' => false ), 'AST' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'America/Anchorage' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'America/Juneau' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'America/Nome' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'America/Yakutat' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'Etc/GMT+9' => array( 'offset' => -32400000, 'longname' => 'GMT-09:00', 'shortname' => 'GMT-09:00', 'hasdst' => false ), 'Pacific/Gambier' => array( 'offset' => -32400000, 'longname' => 'Gambier Time', 'shortname' => 'GAMT', 'hasdst' => false ), 'SystemV/YST9' => array( 'offset' => -32400000, 'longname' => 'Gambier Time', 'shortname' => 'GAMT', 'hasdst' => false ), 'SystemV/YST9YDT' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'US/Alaska' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'America/Dawson' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'America/Ensenada' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'America/Los_Angeles' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'America/Tijuana' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'America/Vancouver' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'America/Whitehorse' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'Canada/Pacific' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'Canada/Yukon' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'Etc/GMT+8' => array( 'offset' => -28800000, 'longname' => 'GMT-08:00', 'shortname' => 'GMT-08:00', 'hasdst' => false ), 'Mexico/BajaNorte' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'PST' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'PST8PDT' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'Pacific/Pitcairn' => array( 'offset' => -28800000, 'longname' => 'Pitcairn Standard Time', 'shortname' => 'PST', 'hasdst' => false ), 'SystemV/PST8' => array( 'offset' => -28800000, 'longname' => 'Pitcairn Standard Time', 'shortname' => 'PST', 'hasdst' => false ), 'SystemV/PST8PDT' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'US/Pacific' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'US/Pacific-New' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'America/Boise' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Cambridge_Bay' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Chihuahua' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Dawson_Creek' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => false ), 'America/Denver' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Edmonton' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Hermosillo' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => false ), 'America/Inuvik' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Mazatlan' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Phoenix' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => false ), 'America/Shiprock' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Yellowknife' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'Canada/Mountain' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'Etc/GMT+7' => array( 'offset' => -25200000, 'longname' => 'GMT-07:00', 'shortname' => 'GMT-07:00', 'hasdst' => false ), 'MST' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'MST7MDT' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'Mexico/BajaSur' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'Navajo' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'PNT' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => false ), 'SystemV/MST7' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => false ), 'SystemV/MST7MDT' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'US/Arizona' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => false ), 'US/Mountain' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'America/Belize' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Cancun' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Chicago' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Costa_Rica' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/El_Salvador' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Guatemala' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Managua' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Menominee' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Merida' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Mexico_City' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Monterrey' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/North_Dakota/Center' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Rainy_River' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Rankin_Inlet' => array( 'offset' => -21600000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Regina' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Swift_Current' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Tegucigalpa' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'America/Winnipeg' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'CST' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'CST6CDT' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'Canada/Central' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'Canada/East-Saskatchewan' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Canada/Saskatchewan' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Chile/EasterIsland' => array( 'offset' => -21600000, 'longname' => 'Easter Is. Time', 'shortname' => 'EAST', 'hasdst' => true, 'dstlongname' => 'Easter Is. Summer Time', 'dstshortname' => 'EASST' ), 'Etc/GMT+6' => array( 'offset' => -21600000, 'longname' => 'GMT-06:00', 'shortname' => 'GMT-06:00', 'hasdst' => false ), 'Mexico/General' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Pacific/Easter' => array( 'offset' => -21600000, 'longname' => 'Easter Is. Time', 'shortname' => 'EAST', 'hasdst' => true, 'dstlongname' => 'Easter Is. Summer Time', 'dstshortname' => 'EASST' ), 'Pacific/Galapagos' => array( 'offset' => -21600000, 'longname' => 'Galapagos Time', 'shortname' => 'GALT', 'hasdst' => false ), 'SystemV/CST6' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'SystemV/CST6CDT' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'US/Central' => array( 'offset' => -21600000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Bogota' => array( 'offset' => -18000000, 'longname' => 'Colombia Time', 'shortname' => 'COT', 'hasdst' => false ), 'America/Cayman' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Detroit' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Eirunepe' => array( 'offset' => -18000000, 'longname' => 'Acre Time', 'shortname' => 'ACT', 'hasdst' => false ), 'America/Fort_Wayne' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Grand_Turk' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Guayaquil' => array( 'offset' => -18000000, 'longname' => 'Ecuador Time', 'shortname' => 'ECT', 'hasdst' => false ), 'America/Havana' => array( 'offset' => -18000000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'America/Indiana/Indianapolis' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Indiana/Knox' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Indiana/Marengo' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Indiana/Vevay' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Indianapolis' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Iqaluit' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Jamaica' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Kentucky/Louisville' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Kentucky/Monticello' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Knox_IN' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Lima' => array( 'offset' => -18000000, 'longname' => 'Peru Time', 'shortname' => 'PET', 'hasdst' => false ), 'America/Louisville' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Montreal' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Nassau' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/New_York' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Nipigon' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Panama' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Pangnirtung' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Port-au-Prince' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'America/Porto_Acre' => array( 'offset' => -18000000, 'longname' => 'Acre Time', 'shortname' => 'ACT', 'hasdst' => false ), 'America/Rio_Branco' => array( 'offset' => -18000000, 'longname' => 'Acre Time', 'shortname' => 'ACT', 'hasdst' => false ), 'America/Thunder_Bay' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'Brazil/Acre' => array( 'offset' => -18000000, 'longname' => 'Acre Time', 'shortname' => 'ACT', 'hasdst' => false ), 'Canada/Eastern' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'Cuba' => array( 'offset' => -18000000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'EST' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'EST5EDT' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'Etc/GMT+5' => array( 'offset' => -18000000, 'longname' => 'GMT-05:00', 'shortname' => 'GMT-05:00', 'hasdst' => false ), 'IET' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'Jamaica' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'SystemV/EST5' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'SystemV/EST5EDT' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'US/East-Indiana' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'US/Eastern' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'US/Indiana-Starke' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => false ), 'US/Michigan' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'America/Anguilla' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Antigua' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Aruba' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Asuncion' => array( 'offset' => -14400000, 'longname' => 'Paraguay Time', 'shortname' => 'PYT', 'hasdst' => true, 'dstlongname' => 'Paraguay Summer Time', 'dstshortname' => 'PYST' ), 'America/Barbados' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Boa_Vista' => array( 'offset' => -14400000, 'longname' => 'Amazon Standard Time', 'shortname' => 'AMT', 'hasdst' => false ), 'America/Caracas' => array( 'offset' => -14400000, 'longname' => 'Venezuela Time', 'shortname' => 'VET', 'hasdst' => false ), 'America/Cuiaba' => array( 'offset' => -14400000, 'longname' => 'Amazon Standard Time', 'shortname' => 'AMT', 'hasdst' => true, 'dstlongname' => 'Amazon Summer Time', 'dstshortname' => 'AMST' ), 'America/Curacao' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Dominica' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Glace_Bay' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'America/Goose_Bay' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'America/Grenada' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Guadeloupe' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Guyana' => array( 'offset' => -14400000, 'longname' => 'Guyana Time', 'shortname' => 'GYT', 'hasdst' => false ), 'America/Halifax' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'America/La_Paz' => array( 'offset' => -14400000, 'longname' => 'Bolivia Time', 'shortname' => 'BOT', 'hasdst' => false ), 'America/Manaus' => array( 'offset' => -14400000, 'longname' => 'Amazon Standard Time', 'shortname' => 'AMT', 'hasdst' => false ), 'America/Martinique' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Montserrat' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Port_of_Spain' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Porto_Velho' => array( 'offset' => -14400000, 'longname' => 'Amazon Standard Time', 'shortname' => 'AMT', 'hasdst' => false ), 'America/Puerto_Rico' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Santiago' => array( 'offset' => -14400000, 'longname' => 'Chile Time', 'shortname' => 'CLT', 'hasdst' => true, 'dstlongname' => 'Chile Summer Time', 'dstshortname' => 'CLST' ), 'America/Santo_Domingo' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/St_Kitts' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/St_Lucia' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/St_Thomas' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/St_Vincent' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Thule' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Tortola' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'America/Virgin' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'Antarctica/Palmer' => array( 'offset' => -14400000, 'longname' => 'Chile Time', 'shortname' => 'CLT', 'hasdst' => true, 'dstlongname' => 'Chile Summer Time', 'dstshortname' => 'CLST' ), 'Atlantic/Bermuda' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'Atlantic/Stanley' => array( 'offset' => -14400000, 'longname' => 'Falkland Is. Time', 'shortname' => 'FKT', 'hasdst' => true, 'dstlongname' => 'Falkland Is. Summer Time', 'dstshortname' => 'FKST' ), 'Brazil/West' => array( 'offset' => -14400000, 'longname' => 'Amazon Standard Time', 'shortname' => 'AMT', 'hasdst' => false ), 'Canada/Atlantic' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'Chile/Continental' => array( 'offset' => -14400000, 'longname' => 'Chile Time', 'shortname' => 'CLT', 'hasdst' => true, 'dstlongname' => 'Chile Summer Time', 'dstshortname' => 'CLST' ), 'Etc/GMT+4' => array( 'offset' => -14400000, 'longname' => 'GMT-04:00', 'shortname' => 'GMT-04:00', 'hasdst' => false ), 'PRT' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'SystemV/AST4' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'SystemV/AST4ADT' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'America/St_Johns' => array( 'offset' => -12600000, 'longname' => 'Newfoundland Standard Time', 'shortname' => 'NST', 'hasdst' => true, 'dstlongname' => 'Newfoundland Daylight Time', 'dstshortname' => 'NDT' ), 'CNT' => array( 'offset' => -12600000, 'longname' => 'Newfoundland Standard Time', 'shortname' => 'NST', 'hasdst' => true, 'dstlongname' => 'Newfoundland Daylight Time', 'dstshortname' => 'NDT' ), 'Canada/Newfoundland' => array( 'offset' => -12600000, 'longname' => 'Newfoundland Standard Time', 'shortname' => 'NST', 'hasdst' => true, 'dstlongname' => 'Newfoundland Daylight Time', 'dstshortname' => 'NDT' ), 'AGT' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Araguaina' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'America/Belem' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => false ), 'America/Buenos_Aires' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Catamarca' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Cayenne' => array( 'offset' => -10800000, 'longname' => 'French Guiana Time', 'shortname' => 'GFT', 'hasdst' => false ), 'America/Cordoba' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Fortaleza' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'America/Godthab' => array( 'offset' => -10800000, 'longname' => 'Western Greenland Time', 'shortname' => 'WGT', 'hasdst' => true, 'dstlongname' => 'Western Greenland Summer Time', 'dstshortname' => 'WGST' ), 'America/Jujuy' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Maceio' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'America/Mendoza' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Miquelon' => array( 'offset' => -10800000, 'longname' => 'Pierre & Miquelon Standard Time', 'shortname' => 'PMST', 'hasdst' => true, 'dstlongname' => 'Pierre & Miquelon Daylight Time', 'dstshortname' => 'PMDT' ), 'America/Montevideo' => array( 'offset' => -10800000, 'longname' => 'Uruguay Time', 'shortname' => 'UYT', 'hasdst' => false ), 'America/Paramaribo' => array( 'offset' => -10800000, 'longname' => 'Suriname Time', 'shortname' => 'SRT', 'hasdst' => false ), 'America/Recife' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'America/Rosario' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'America/Sao_Paulo' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'BET' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'Brazil/East' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'Etc/GMT+3' => array( 'offset' => -10800000, 'longname' => 'GMT-03:00', 'shortname' => 'GMT-03:00', 'hasdst' => false ), 'America/Noronha' => array( 'offset' => -7200000, 'longname' => 'Fernando de Noronha Time', 'shortname' => 'FNT', 'hasdst' => false ), 'Atlantic/South_Georgia' => array( 'offset' => -7200000, 'longname' => 'South Georgia Standard Time', 'shortname' => 'GST', 'hasdst' => false ), 'Brazil/DeNoronha' => array( 'offset' => -7200000, 'longname' => 'Fernando de Noronha Time', 'shortname' => 'FNT', 'hasdst' => false ), 'Etc/GMT+2' => array( 'offset' => -7200000, 'longname' => 'GMT-02:00', 'shortname' => 'GMT-02:00', 'hasdst' => false ), 'America/Scoresbysund' => array( 'offset' => -3600000, 'longname' => 'Eastern Greenland Time', 'shortname' => 'EGT', 'hasdst' => true, 'dstlongname' => 'Eastern Greenland Summer Time', 'dstshortname' => 'EGST' ), 'Atlantic/Azores' => array( 'offset' => -3600000, 'longname' => 'Azores Time', 'shortname' => 'AZOT', 'hasdst' => true, 'dstlongname' => 'Azores Summer Time', 'dstshortname' => 'AZOST' ), 'Atlantic/Cape_Verde' => array( 'offset' => -3600000, 'longname' => 'Cape Verde Time', 'shortname' => 'CVT', 'hasdst' => false ), 'Etc/GMT+1' => array( 'offset' => -3600000, 'longname' => 'GMT-01:00', 'shortname' => 'GMT-01:00', 'hasdst' => false ), 'Africa/Abidjan' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Accra' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Bamako' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Banjul' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Bissau' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Casablanca' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => false ), 'Africa/Conakry' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Dakar' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/El_Aaiun' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => false ), 'Africa/Freetown' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Lome' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Monrovia' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Nouakchott' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Ouagadougou' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Sao_Tome' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Africa/Timbuktu' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'America/Danmarkshavn' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Atlantic/Canary' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'Atlantic/Faeroe' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'Atlantic/Madeira' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'Atlantic/Reykjavik' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Atlantic/St_Helena' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Eire' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => true, 'dstlongname' => 'Irish Summer Time', 'dstshortname' => 'IST' ), 'Etc/GMT' => array( 'offset' => 0, 'longname' => 'GMT+00:00', 'shortname' => 'GMT+00:00', 'hasdst' => false ), 'Etc/GMT+0' => array( 'offset' => 0, 'longname' => 'GMT+00:00', 'shortname' => 'GMT+00:00', 'hasdst' => false ), 'Etc/GMT-0' => array( 'offset' => 0, 'longname' => 'GMT+00:00', 'shortname' => 'GMT+00:00', 'hasdst' => false ), 'Etc/GMT0' => array( 'offset' => 0, 'longname' => 'GMT+00:00', 'shortname' => 'GMT+00:00', 'hasdst' => false ), 'Etc/Greenwich' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Etc/UCT' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Etc/UTC' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Etc/Universal' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Etc/Zulu' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Europe/Belfast' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => true, 'dstlongname' => 'British Summer Time', 'dstshortname' => 'BST' ), 'Europe/Dublin' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => true, 'dstlongname' => 'Irish Summer Time', 'dstshortname' => 'IST' ), 'Europe/Lisbon' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'Europe/London' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => true, 'dstlongname' => 'British Summer Time', 'dstshortname' => 'BST' ), 'GB' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => true, 'dstlongname' => 'British Summer Time', 'dstshortname' => 'BST' ), 'GB-Eire' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => true, 'dstlongname' => 'British Summer Time', 'dstshortname' => 'BST' ), 'GMT' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'GMT0' => array( 'offset' => 0, 'longname' => 'GMT+00:00', 'shortname' => 'GMT+00:00', 'hasdst' => false ), 'Greenwich' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Iceland' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Portugal' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'UCT' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'UTC' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Universal' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'WET' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'Zulu' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Africa/Algiers' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => false ), 'Africa/Bangui' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Brazzaville' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Ceuta' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Africa/Douala' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Kinshasa' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Lagos' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Libreville' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Luanda' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Malabo' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Ndjamena' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Niamey' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Porto-Novo' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => false ), 'Africa/Tunis' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => false ), 'Africa/Windhoek' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => true, 'dstlongname' => 'Western African Summer Time', 'dstshortname' => 'WAST' ), 'Arctic/Longyearbyen' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Atlantic/Jan_Mayen' => array( 'offset' => 3600000, 'longname' => 'Eastern Greenland Time', 'shortname' => 'EGT', 'hasdst' => true, 'dstlongname' => 'Eastern Greenland Summer Time', 'dstshortname' => 'EGST' ), 'CET' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'CEST' => array( 'offset' => 3600000, 'longname' => "Central European Time", 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => "Central European Summer Time", 'dstshortname' => 'CEST' ), 'ECT' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Etc/GMT-1' => array( 'offset' => 3600000, 'longname' => 'GMT+01:00', 'shortname' => 'GMT+01:00', 'hasdst' => false ), 'Europe/Amsterdam' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Andorra' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Belgrade' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Berlin' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Bratislava' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Brussels' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Budapest' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Copenhagen' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Gibraltar' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Ljubljana' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Luxembourg' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Madrid' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Malta' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Monaco' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Oslo' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Paris' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Prague' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Rome' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/San_Marino' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Sarajevo' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Skopje' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Stockholm' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Tirane' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Vaduz' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Vatican' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Vienna' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Warsaw' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Zagreb' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Europe/Zurich' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'MET' => array( 'offset' => 3600000, 'longname' => 'Middle Europe Time', 'shortname' => 'MET', 'hasdst' => true, 'dstlongname' => 'Middle Europe Summer Time', 'dstshortname' => 'MEST' ), 'Poland' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'ART' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Africa/Blantyre' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Bujumbura' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Cairo' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Africa/Gaborone' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Harare' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Johannesburg' => array( 'offset' => 7200000, 'longname' => 'South Africa Standard Time', 'shortname' => 'SAST', 'hasdst' => false ), 'Africa/Kigali' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Lubumbashi' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Lusaka' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Maputo' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'Africa/Maseru' => array( 'offset' => 7200000, 'longname' => 'South Africa Standard Time', 'shortname' => 'SAST', 'hasdst' => false ), 'Africa/Mbabane' => array( 'offset' => 7200000, 'longname' => 'South Africa Standard Time', 'shortname' => 'SAST', 'hasdst' => false ), 'Africa/Tripoli' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => false ), 'Asia/Amman' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Asia/Beirut' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Asia/Damascus' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Asia/Gaza' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Asia/Istanbul' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Asia/Jerusalem' => array( 'offset' => 7200000, 'longname' => 'Israel Standard Time', 'shortname' => 'IST', 'hasdst' => true, 'dstlongname' => 'Israel Daylight Time', 'dstshortname' => 'IDT' ), 'Asia/Nicosia' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Asia/Tel_Aviv' => array( 'offset' => 7200000, 'longname' => 'Israel Standard Time', 'shortname' => 'IST', 'hasdst' => true, 'dstlongname' => 'Israel Daylight Time', 'dstshortname' => 'IDT' ), 'CAT' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'EET' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Egypt' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Etc/GMT-2' => array( 'offset' => 7200000, 'longname' => 'GMT+02:00', 'shortname' => 'GMT+02:00', 'hasdst' => false ), 'Europe/Athens' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Bucharest' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Chisinau' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Helsinki' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Istanbul' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Kaliningrad' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Kiev' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Minsk' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Nicosia' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Riga' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Simferopol' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Sofia' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Tallinn' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => false ), 'Europe/Tiraspol' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Uzhgorod' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Europe/Vilnius' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => false ), 'Europe/Zaporozhye' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Israel' => array( 'offset' => 7200000, 'longname' => 'Israel Standard Time', 'shortname' => 'IST', 'hasdst' => true, 'dstlongname' => 'Israel Daylight Time', 'dstshortname' => 'IDT' ), 'Libya' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => false ), 'Turkey' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Africa/Addis_Ababa' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Asmera' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Dar_es_Salaam' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Djibouti' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Kampala' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Khartoum' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Mogadishu' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Africa/Nairobi' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Antarctica/Syowa' => array( 'offset' => 10800000, 'longname' => 'Syowa Time', 'shortname' => 'SYOT', 'hasdst' => false ), 'Asia/Aden' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'Asia/Baghdad' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Arabia Daylight Time', 'dstshortname' => 'ADT' ), 'Asia/Bahrain' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'Asia/Kuwait' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'Asia/Qatar' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'Asia/Riyadh' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'EAT' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Etc/GMT-3' => array( 'offset' => 10800000, 'longname' => 'GMT+03:00', 'shortname' => 'GMT+03:00', 'hasdst' => false ), 'Europe/Moscow' => array( 'offset' => 10800000, 'longname' => 'Moscow Standard Time', 'shortname' => 'MSK', 'hasdst' => true, 'dstlongname' => 'Moscow Daylight Time', 'dstshortname' => 'MSD' ), 'Indian/Antananarivo' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Indian/Comoro' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Indian/Mayotte' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'W-SU' => array( 'offset' => 10800000, 'longname' => 'Moscow Standard Time', 'shortname' => 'MSK', 'hasdst' => true, 'dstlongname' => 'Moscow Daylight Time', 'dstshortname' => 'MSD' ), 'Asia/Riyadh87' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Asia/Riyadh88' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Asia/Riyadh89' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Mideast/Riyadh87' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Mideast/Riyadh88' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Mideast/Riyadh89' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Asia/Tehran' => array( 'offset' => 12600000, 'longname' => 'Iran Time', 'shortname' => 'IRT', 'hasdst' => true, 'dstlongname' => 'Iran Sumer Time', 'dstshortname' => 'IRST' ), 'Iran' => array( 'offset' => 12600000, 'longname' => 'Iran Time', 'shortname' => 'IRT', 'hasdst' => true, 'dstlongname' => 'Iran Sumer Time', 'dstshortname' => 'IRST' ), 'Asia/Aqtau' => array( 'offset' => 14400000, 'longname' => 'Aqtau Time', 'shortname' => 'AQTT', 'hasdst' => true, 'dstlongname' => 'Aqtau Summer Time', 'dstshortname' => 'AQTST' ), 'Asia/Baku' => array( 'offset' => 14400000, 'longname' => 'Azerbaijan Time', 'shortname' => 'AZT', 'hasdst' => true, 'dstlongname' => 'Azerbaijan Summer Time', 'dstshortname' => 'AZST' ), 'Asia/Dubai' => array( 'offset' => 14400000, 'longname' => 'Gulf Standard Time', 'shortname' => 'GST', 'hasdst' => false ), 'Asia/Muscat' => array( 'offset' => 14400000, 'longname' => 'Gulf Standard Time', 'shortname' => 'GST', 'hasdst' => false ), 'Asia/Tbilisi' => array( 'offset' => 14400000, 'longname' => 'Georgia Time', 'shortname' => 'GET', 'hasdst' => true, 'dstlongname' => 'Georgia Summer Time', 'dstshortname' => 'GEST' ), 'Asia/Yerevan' => array( 'offset' => 14400000, 'longname' => 'Armenia Time', 'shortname' => 'AMT', 'hasdst' => true, 'dstlongname' => 'Armenia Summer Time', 'dstshortname' => 'AMST' ), 'Etc/GMT-4' => array( 'offset' => 14400000, 'longname' => 'GMT+04:00', 'shortname' => 'GMT+04:00', 'hasdst' => false ), 'Europe/Samara' => array( 'offset' => 14400000, 'longname' => 'Samara Time', 'shortname' => 'SAMT', 'hasdst' => true, 'dstlongname' => 'Samara Summer Time', 'dstshortname' => 'SAMST' ), 'Indian/Mahe' => array( 'offset' => 14400000, 'longname' => 'Seychelles Time', 'shortname' => 'SCT', 'hasdst' => false ), 'Indian/Mauritius' => array( 'offset' => 14400000, 'longname' => 'Mauritius Time', 'shortname' => 'MUT', 'hasdst' => false ), 'Indian/Reunion' => array( 'offset' => 14400000, 'longname' => 'Reunion Time', 'shortname' => 'RET', 'hasdst' => false ), 'NET' => array( 'offset' => 14400000, 'longname' => 'Armenia Time', 'shortname' => 'AMT', 'hasdst' => true, 'dstlongname' => 'Armenia Summer Time', 'dstshortname' => 'AMST' ), 'Asia/Kabul' => array( 'offset' => 16200000, 'longname' => 'Afghanistan Time', 'shortname' => 'AFT', 'hasdst' => false ), 'Asia/Aqtobe' => array( 'offset' => 18000000, 'longname' => 'Aqtobe Time', 'shortname' => 'AQTT', 'hasdst' => true, 'dstlongname' => 'Aqtobe Summer Time', 'dstshortname' => 'AQTST' ), 'Asia/Ashgabat' => array( 'offset' => 18000000, 'longname' => 'Turkmenistan Time', 'shortname' => 'TMT', 'hasdst' => false ), 'Asia/Ashkhabad' => array( 'offset' => 18000000, 'longname' => 'Turkmenistan Time', 'shortname' => 'TMT', 'hasdst' => false ), 'Asia/Bishkek' => array( 'offset' => 18000000, 'longname' => 'Kirgizstan Time', 'shortname' => 'KGT', 'hasdst' => true, 'dstlongname' => 'Kirgizstan Summer Time', 'dstshortname' => 'KGST' ), 'Asia/Dushanbe' => array( 'offset' => 18000000, 'longname' => 'Tajikistan Time', 'shortname' => 'TJT', 'hasdst' => false ), 'Asia/Karachi' => array( 'offset' => 18000000, 'longname' => 'Pakistan Time', 'shortname' => 'PKT', 'hasdst' => false ), 'Asia/Samarkand' => array( 'offset' => 18000000, 'longname' => 'Turkmenistan Time', 'shortname' => 'TMT', 'hasdst' => false ), 'Asia/Tashkent' => array( 'offset' => 18000000, 'longname' => 'Uzbekistan Time', 'shortname' => 'UZT', 'hasdst' => false ), 'Asia/Yekaterinburg' => array( 'offset' => 18000000, 'longname' => 'Yekaterinburg Time', 'shortname' => 'YEKT', 'hasdst' => true, 'dstlongname' => 'Yekaterinburg Summer Time', 'dstshortname' => 'YEKST' ), 'Etc/GMT-5' => array( 'offset' => 18000000, 'longname' => 'GMT+05:00', 'shortname' => 'GMT+05:00', 'hasdst' => false ), 'Indian/Kerguelen' => array( 'offset' => 18000000, 'longname' => 'French Southern & Antarctic Lands Time', 'shortname' => 'TFT', 'hasdst' => false ), 'Indian/Maldives' => array( 'offset' => 18000000, 'longname' => 'Maldives Time', 'shortname' => 'MVT', 'hasdst' => false ), 'PLT' => array( 'offset' => 18000000, 'longname' => 'Pakistan Time', 'shortname' => 'PKT', 'hasdst' => false ), 'Asia/Calcutta' => array( 'offset' => 19800000, 'longname' => 'India Standard Time', 'shortname' => 'IST', 'hasdst' => false ), 'IST' => array( 'offset' => 19800000, 'longname' => 'India Standard Time', 'shortname' => 'IST', 'hasdst' => false ), 'Asia/Katmandu' => array( 'offset' => 20700000, 'longname' => 'Nepal Time', 'shortname' => 'NPT', 'hasdst' => false ), 'Antarctica/Mawson' => array( 'offset' => 21600000, 'longname' => 'Mawson Time', 'shortname' => 'MAWT', 'hasdst' => false ), 'Antarctica/Vostok' => array( 'offset' => 21600000, 'longname' => 'Vostok time', 'shortname' => 'VOST', 'hasdst' => false ), 'Asia/Almaty' => array( 'offset' => 21600000, 'longname' => 'Alma-Ata Time', 'shortname' => 'ALMT', 'hasdst' => true, 'dstlongname' => 'Alma-Ata Summer Time', 'dstshortname' => 'ALMST' ), 'Asia/Colombo' => array( 'offset' => 21600000, 'longname' => 'Sri Lanka Time', 'shortname' => 'LKT', 'hasdst' => false ), 'Asia/Dacca' => array( 'offset' => 21600000, 'longname' => 'Bangladesh Time', 'shortname' => 'BDT', 'hasdst' => false ), 'Asia/Dhaka' => array( 'offset' => 21600000, 'longname' => 'Bangladesh Time', 'shortname' => 'BDT', 'hasdst' => false ), 'Asia/Novosibirsk' => array( 'offset' => 21600000, 'longname' => 'Novosibirsk Time', 'shortname' => 'NOVT', 'hasdst' => true, 'dstlongname' => 'Novosibirsk Summer Time', 'dstshortname' => 'NOVST' ), 'Asia/Omsk' => array( 'offset' => 21600000, 'longname' => 'Omsk Time', 'shortname' => 'OMST', 'hasdst' => true, 'dstlongname' => 'Omsk Summer Time', 'dstshortname' => 'OMSST' ), 'Asia/Thimbu' => array( 'offset' => 21600000, 'longname' => 'Bhutan Time', 'shortname' => 'BTT', 'hasdst' => false ), 'Asia/Thimphu' => array( 'offset' => 21600000, 'longname' => 'Bhutan Time', 'shortname' => 'BTT', 'hasdst' => false ), 'BDT' => array( 'offset' => 21600000, 'longname' => 'Bangladesh Time', 'shortname' => 'BDT', 'hasdst' => false ), 'Etc/GMT-6' => array( 'offset' => 21600000, 'longname' => 'GMT+06:00', 'shortname' => 'GMT+06:00', 'hasdst' => false ), 'Indian/Chagos' => array( 'offset' => 21600000, 'longname' => 'Indian Ocean Territory Time', 'shortname' => 'IOT', 'hasdst' => false ), 'Asia/Rangoon' => array( 'offset' => 23400000, 'longname' => 'Myanmar Time', 'shortname' => 'MMT', 'hasdst' => false ), 'Indian/Cocos' => array( 'offset' => 23400000, 'longname' => 'Cocos Islands Time', 'shortname' => 'CCT', 'hasdst' => false ), 'Antarctica/Davis' => array( 'offset' => 25200000, 'longname' => 'Davis Time', 'shortname' => 'DAVT', 'hasdst' => false ), 'Asia/Bangkok' => array( 'offset' => 25200000, 'longname' => 'Indochina Time', 'shortname' => 'ICT', 'hasdst' => false ), 'Asia/Hovd' => array( 'offset' => 25200000, 'longname' => 'Hovd Time', 'shortname' => 'HOVT', 'hasdst' => false ), 'Asia/Jakarta' => array( 'offset' => 25200000, 'longname' => 'West Indonesia Time', 'shortname' => 'WIT', 'hasdst' => false ), 'Asia/Krasnoyarsk' => array( 'offset' => 25200000, 'longname' => 'Krasnoyarsk Time', 'shortname' => 'KRAT', 'hasdst' => true, 'dstlongname' => 'Krasnoyarsk Summer Time', 'dstshortname' => 'KRAST' ), 'Asia/Phnom_Penh' => array( 'offset' => 25200000, 'longname' => 'Indochina Time', 'shortname' => 'ICT', 'hasdst' => false ), 'Asia/Pontianak' => array( 'offset' => 25200000, 'longname' => 'West Indonesia Time', 'shortname' => 'WIT', 'hasdst' => false ), 'Asia/Saigon' => array( 'offset' => 25200000, 'longname' => 'Indochina Time', 'shortname' => 'ICT', 'hasdst' => false ), 'Asia/Vientiane' => array( 'offset' => 25200000, 'longname' => 'Indochina Time', 'shortname' => 'ICT', 'hasdst' => false ), 'Etc/GMT-7' => array( 'offset' => 25200000, 'longname' => 'GMT+07:00', 'shortname' => 'GMT+07:00', 'hasdst' => false ), 'Indian/Christmas' => array( 'offset' => 25200000, 'longname' => 'Christmas Island Time', 'shortname' => 'CXT', 'hasdst' => false ), 'VST' => array( 'offset' => 25200000, 'longname' => 'Indochina Time', 'shortname' => 'ICT', 'hasdst' => false ), 'Antarctica/Casey' => array( 'offset' => 28800000, 'longname' => 'Western Standard Time (Australia)', 'shortname' => 'WST', 'hasdst' => false ), 'Asia/Brunei' => array( 'offset' => 28800000, 'longname' => 'Brunei Time', 'shortname' => 'BNT', 'hasdst' => false ), 'Asia/Chongqing' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Chungking' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Harbin' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Hong_Kong' => array( 'offset' => 28800000, 'longname' => 'Hong Kong Time', 'shortname' => 'HKT', 'hasdst' => false ), 'Asia/Irkutsk' => array( 'offset' => 28800000, 'longname' => 'Irkutsk Time', 'shortname' => 'IRKT', 'hasdst' => true, 'dstlongname' => 'Irkutsk Summer Time', 'dstshortname' => 'IRKST' ), 'Asia/Kashgar' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Kuala_Lumpur' => array( 'offset' => 28800000, 'longname' => 'Malaysia Time', 'shortname' => 'MYT', 'hasdst' => false ), 'Asia/Kuching' => array( 'offset' => 28800000, 'longname' => 'Malaysia Time', 'shortname' => 'MYT', 'hasdst' => false ), 'Asia/Macao' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Manila' => array( 'offset' => 28800000, 'longname' => 'Philippines Time', 'shortname' => 'PHT', 'hasdst' => false ), 'Asia/Shanghai' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Singapore' => array( 'offset' => 28800000, 'longname' => 'Singapore Time', 'shortname' => 'SGT', 'hasdst' => false ), 'Asia/Taipei' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Asia/Ujung_Pandang' => array( 'offset' => 28800000, 'longname' => 'Central Indonesia Time', 'shortname' => 'CIT', 'hasdst' => false ), 'Asia/Ulaanbaatar' => array( 'offset' => 28800000, 'longname' => 'Ulaanbaatar Time', 'shortname' => 'ULAT', 'hasdst' => false ), 'Asia/Ulan_Bator' => array( 'offset' => 28800000, 'longname' => 'Ulaanbaatar Time', 'shortname' => 'ULAT', 'hasdst' => false ), 'Asia/Urumqi' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Australia/Perth' => array( 'offset' => 28800000, 'longname' => 'Western Standard Time (Australia)', 'shortname' => 'WST', 'hasdst' => false ), 'Australia/West' => array( 'offset' => 28800000, 'longname' => 'Western Standard Time (Australia)', 'shortname' => 'WST', 'hasdst' => false ), 'CTT' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Etc/GMT-8' => array( 'offset' => 28800000, 'longname' => 'GMT+08:00', 'shortname' => 'GMT+08:00', 'hasdst' => false ), 'Hongkong' => array( 'offset' => 28800000, 'longname' => 'Hong Kong Time', 'shortname' => 'HKT', 'hasdst' => false ), 'PRC' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Singapore' => array( 'offset' => 28800000, 'longname' => 'Singapore Time', 'shortname' => 'SGT', 'hasdst' => false ), 'Asia/Choibalsan' => array( 'offset' => 32400000, 'longname' => 'Choibalsan Time', 'shortname' => 'CHOT', 'hasdst' => false ), 'Asia/Dili' => array( 'offset' => 32400000, 'longname' => 'East Timor Time', 'shortname' => 'TPT', 'hasdst' => false ), 'Asia/Jayapura' => array( 'offset' => 32400000, 'longname' => 'East Indonesia Time', 'shortname' => 'EIT', 'hasdst' => false ), 'Asia/Pyongyang' => array( 'offset' => 32400000, 'longname' => 'Korea Standard Time', 'shortname' => 'KST', 'hasdst' => false ), 'Asia/Seoul' => array( 'offset' => 32400000, 'longname' => 'Korea Standard Time', 'shortname' => 'KST', 'hasdst' => false ), 'Asia/Tokyo' => array( 'offset' => 32400000, 'longname' => 'Japan Standard Time', 'shortname' => 'JST', 'hasdst' => false ), 'Asia/Yakutsk' => array( 'offset' => 32400000, 'longname' => 'Yakutsk Time', 'shortname' => 'YAKT', 'hasdst' => true, 'dstlongname' => 'Yaktsk Summer Time', 'dstshortname' => 'YAKST' ), 'Etc/GMT-9' => array( 'offset' => 32400000, 'longname' => 'GMT+09:00', 'shortname' => 'GMT+09:00', 'hasdst' => false ), 'JST' => array( 'offset' => 32400000, 'longname' => 'Japan Standard Time', 'shortname' => 'JST', 'hasdst' => false ), 'Japan' => array( 'offset' => 32400000, 'longname' => 'Japan Standard Time', 'shortname' => 'JST', 'hasdst' => false ), 'Pacific/Palau' => array( 'offset' => 32400000, 'longname' => 'Palau Time', 'shortname' => 'PWT', 'hasdst' => false ), 'ROK' => array( 'offset' => 32400000, 'longname' => 'Korea Standard Time', 'shortname' => 'KST', 'hasdst' => false ), 'ACT' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (Northern Territory)', 'shortname' => 'CST', 'hasdst' => false ), 'Australia/Adelaide' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (South Australia)', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Summer Time (South Australia)', 'dstshortname' => 'CST' ), 'Australia/Broken_Hill' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (South Australia/New South Wales)', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Summer Time (South Australia/New South Wales)', 'dstshortname' => 'CST' ), 'Australia/Darwin' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (Northern Territory)', 'shortname' => 'CST', 'hasdst' => false ), 'Australia/North' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (Northern Territory)', 'shortname' => 'CST', 'hasdst' => false ), 'Australia/South' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (South Australia)', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Summer Time (South Australia)', 'dstshortname' => 'CST' ), 'Australia/Yancowinna' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (South Australia/New South Wales)', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Summer Time (South Australia/New South Wales)', 'dstshortname' => 'CST' ), 'AET' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (New South Wales)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (New South Wales)', 'dstshortname' => 'EST' ), 'Antarctica/DumontDUrville' => array( 'offset' => 36000000, 'longname' => 'Dumont-d\'Urville Time', 'shortname' => 'DDUT', 'hasdst' => false ), 'Asia/Sakhalin' => array( 'offset' => 36000000, 'longname' => 'Sakhalin Time', 'shortname' => 'SAKT', 'hasdst' => true, 'dstlongname' => 'Sakhalin Summer Time', 'dstshortname' => 'SAKST' ), 'Asia/Vladivostok' => array( 'offset' => 36000000, 'longname' => 'Vladivostok Time', 'shortname' => 'VLAT', 'hasdst' => true, 'dstlongname' => 'Vladivostok Summer Time', 'dstshortname' => 'VLAST' ), 'Australia/ACT' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (New South Wales)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (New South Wales)', 'dstshortname' => 'EST' ), 'Australia/Brisbane' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Queensland)', 'shortname' => 'EST', 'hasdst' => false ), 'Australia/Canberra' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (New South Wales)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (New South Wales)', 'dstshortname' => 'EST' ), 'Australia/Hobart' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Tasmania)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (Tasmania)', 'dstshortname' => 'EST' ), 'Australia/Lindeman' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Queensland)', 'shortname' => 'EST', 'hasdst' => false ), 'Australia/Melbourne' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Victoria)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (Victoria)', 'dstshortname' => 'EST' ), 'Australia/NSW' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (New South Wales)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (New South Wales)', 'dstshortname' => 'EST' ), 'Australia/Queensland' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Queensland)', 'shortname' => 'EST', 'hasdst' => false ), 'Australia/Sydney' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (New South Wales)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (New South Wales)', 'dstshortname' => 'EST' ), 'Australia/Tasmania' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Tasmania)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (Tasmania)', 'dstshortname' => 'EST' ), 'Australia/Victoria' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Victoria)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (Victoria)', 'dstshortname' => 'EST' ), 'Etc/GMT-10' => array( 'offset' => 36000000, 'longname' => 'GMT+10:00', 'shortname' => 'GMT+10:00', 'hasdst' => false ), 'Pacific/Guam' => array( 'offset' => 36000000, 'longname' => 'Chamorro Standard Time', 'shortname' => 'ChST', 'hasdst' => false ), 'Pacific/Port_Moresby' => array( 'offset' => 36000000, 'longname' => 'Papua New Guinea Time', 'shortname' => 'PGT', 'hasdst' => false ), 'Pacific/Saipan' => array( 'offset' => 36000000, 'longname' => 'Chamorro Standard Time', 'shortname' => 'ChST', 'hasdst' => false ), 'Pacific/Truk' => array( 'offset' => 36000000, 'longname' => 'Truk Time', 'shortname' => 'TRUT', 'hasdst' => false ), 'Pacific/Yap' => array( 'offset' => 36000000, 'longname' => 'Yap Time', 'shortname' => 'YAPT', 'hasdst' => false ), 'Australia/LHI' => array( 'offset' => 37800000, 'longname' => 'Load Howe Standard Time', 'shortname' => 'LHST', 'hasdst' => true, 'dstlongname' => 'Load Howe Summer Time', 'dstshortname' => 'LHST' ), 'Australia/Lord_Howe' => array( 'offset' => 37800000, 'longname' => 'Load Howe Standard Time', 'shortname' => 'LHST', 'hasdst' => true, 'dstlongname' => 'Load Howe Summer Time', 'dstshortname' => 'LHST' ), 'Asia/Magadan' => array( 'offset' => 39600000, 'longname' => 'Magadan Time', 'shortname' => 'MAGT', 'hasdst' => true, 'dstlongname' => 'Magadan Summer Time', 'dstshortname' => 'MAGST' ), 'Etc/GMT-11' => array( 'offset' => 39600000, 'longname' => 'GMT+11:00', 'shortname' => 'GMT+11:00', 'hasdst' => false ), 'Pacific/Efate' => array( 'offset' => 39600000, 'longname' => 'Vanuatu Time', 'shortname' => 'VUT', 'hasdst' => false ), 'Pacific/Guadalcanal' => array( 'offset' => 39600000, 'longname' => 'Solomon Is. Time', 'shortname' => 'SBT', 'hasdst' => false ), 'Pacific/Kosrae' => array( 'offset' => 39600000, 'longname' => 'Kosrae Time', 'shortname' => 'KOST', 'hasdst' => false ), 'Pacific/Noumea' => array( 'offset' => 39600000, 'longname' => 'New Caledonia Time', 'shortname' => 'NCT', 'hasdst' => false ), 'Pacific/Ponape' => array( 'offset' => 39600000, 'longname' => 'Ponape Time', 'shortname' => 'PONT', 'hasdst' => false ), 'SST' => array( 'offset' => 39600000, 'longname' => 'Solomon Is. Time', 'shortname' => 'SBT', 'hasdst' => false ), 'Pacific/Norfolk' => array( 'offset' => 41400000, 'longname' => 'Norfolk Time', 'shortname' => 'NFT', 'hasdst' => false ), 'Antarctica/McMurdo' => array( 'offset' => 43200000, 'longname' => 'New Zealand Standard Time', 'shortname' => 'NZST', 'hasdst' => true, 'dstlongname' => 'New Zealand Daylight Time', 'dstshortname' => 'NZDT' ), 'Antarctica/South_Pole' => array( 'offset' => 43200000, 'longname' => 'New Zealand Standard Time', 'shortname' => 'NZST', 'hasdst' => true, 'dstlongname' => 'New Zealand Daylight Time', 'dstshortname' => 'NZDT' ), 'Asia/Anadyr' => array( 'offset' => 43200000, 'longname' => 'Anadyr Time', 'shortname' => 'ANAT', 'hasdst' => true, 'dstlongname' => 'Anadyr Summer Time', 'dstshortname' => 'ANAST' ), 'Asia/Kamchatka' => array( 'offset' => 43200000, 'longname' => 'Petropavlovsk-Kamchatski Time', 'shortname' => 'PETT', 'hasdst' => true, 'dstlongname' => 'Petropavlovsk-Kamchatski Summer Time', 'dstshortname' => 'PETST' ), 'Etc/GMT-12' => array( 'offset' => 43200000, 'longname' => 'GMT+12:00', 'shortname' => 'GMT+12:00', 'hasdst' => false ), 'Kwajalein' => array( 'offset' => 43200000, 'longname' => 'Marshall Islands Time', 'shortname' => 'MHT', 'hasdst' => false ), 'NST' => array( 'offset' => 43200000, 'longname' => 'New Zealand Standard Time', 'shortname' => 'NZST', 'hasdst' => true, 'dstlongname' => 'New Zealand Daylight Time', 'dstshortname' => 'NZDT' ), 'NZ' => array( 'offset' => 43200000, 'longname' => 'New Zealand Standard Time', 'shortname' => 'NZST', 'hasdst' => true, 'dstlongname' => 'New Zealand Daylight Time', 'dstshortname' => 'NZDT' ), 'Pacific/Auckland' => array( 'offset' => 43200000, 'longname' => 'New Zealand Standard Time', 'shortname' => 'NZST', 'hasdst' => true, 'dstlongname' => 'New Zealand Daylight Time', 'dstshortname' => 'NZDT' ), 'Pacific/Fiji' => array( 'offset' => 43200000, 'longname' => 'Fiji Time', 'shortname' => 'FJT', 'hasdst' => false ), 'Pacific/Funafuti' => array( 'offset' => 43200000, 'longname' => 'Tuvalu Time', 'shortname' => 'TVT', 'hasdst' => false ), 'Pacific/Kwajalein' => array( 'offset' => 43200000, 'longname' => 'Marshall Islands Time', 'shortname' => 'MHT', 'hasdst' => false ), 'Pacific/Majuro' => array( 'offset' => 43200000, 'longname' => 'Marshall Islands Time', 'shortname' => 'MHT', 'hasdst' => false ), 'Pacific/Nauru' => array( 'offset' => 43200000, 'longname' => 'Nauru Time', 'shortname' => 'NRT', 'hasdst' => false ), 'Pacific/Tarawa' => array( 'offset' => 43200000, 'longname' => 'Gilbert Is. Time', 'shortname' => 'GILT', 'hasdst' => false ), 'Pacific/Wake' => array( 'offset' => 43200000, 'longname' => 'Wake Time', 'shortname' => 'WAKT', 'hasdst' => false ), 'Pacific/Wallis' => array( 'offset' => 43200000, 'longname' => 'Wallis & Futuna Time', 'shortname' => 'WFT', 'hasdst' => false ), 'NZ-CHAT' => array( 'offset' => 45900000, 'longname' => 'Chatham Standard Time', 'shortname' => 'CHAST', 'hasdst' => true, 'dstlongname' => 'Chatham Daylight Time', 'dstshortname' => 'CHADT' ), 'Pacific/Chatham' => array( 'offset' => 45900000, 'longname' => 'Chatham Standard Time', 'shortname' => 'CHAST', 'hasdst' => true, 'dstlongname' => 'Chatham Daylight Time', 'dstshortname' => 'CHADT' ), 'Etc/GMT-13' => array( 'offset' => 46800000, 'longname' => 'GMT+13:00', 'shortname' => 'GMT+13:00', 'hasdst' => false ), 'Pacific/Enderbury' => array( 'offset' => 46800000, 'longname' => 'Phoenix Is. Time', 'shortname' => 'PHOT', 'hasdst' => false ), 'Pacific/Tongatapu' => array( 'offset' => 46800000, 'longname' => 'Tonga Time', 'shortname' => 'TOT', 'hasdst' => false ), 'Etc/GMT-14' => array( 'offset' => 50400000, 'longname' => 'GMT+14:00', 'shortname' => 'GMT+14:00', 'hasdst' => false ), 'Pacific/Kiritimati' => array( 'offset' => 50400000, 'longname' => 'Line Is. Time', 'shortname' => 'LINT', 'hasdst' => false ), 'GMT-12:00' => array( 'offset' => -43200000, 'longname' => 'GMT-12:00', 'shortname' => 'GMT-12:00', 'hasdst' => false ), 'GMT-11:00' => array( 'offset' => -39600000, 'longname' => 'GMT-11:00', 'shortname' => 'GMT-11:00', 'hasdst' => false ), 'West Samoa Time' => array( 'offset' => -39600000, 'longname' => 'West Samoa Time', 'shortname' => 'WST', 'hasdst' => false ), 'Samoa Standard Time' => array( 'offset' => -39600000, 'longname' => 'Samoa Standard Time', 'shortname' => 'SST', 'hasdst' => false ), 'Niue Time' => array( 'offset' => -39600000, 'longname' => 'Niue Time', 'shortname' => 'NUT', 'hasdst' => false ), 'Hawaii-Aleutian Standard Time' => array( 'offset' => -36000000, 'longname' => 'Hawaii-Aleutian Standard Time', 'shortname' => 'HAST', 'hasdst' => true, 'dstlongname' => 'Hawaii-Aleutian Daylight Time', 'dstshortname' => 'HADT' ), 'GMT-10:00' => array( 'offset' => -36000000, 'longname' => 'GMT-10:00', 'shortname' => 'GMT-10:00', 'hasdst' => false ), 'Hawaii Standard Time' => array( 'offset' => -36000000, 'longname' => 'Hawaii Standard Time', 'shortname' => 'HST', 'hasdst' => false ), 'Tokelau Time' => array( 'offset' => -36000000, 'longname' => 'Tokelau Time', 'shortname' => 'TKT', 'hasdst' => false ), 'Cook Is. Time' => array( 'offset' => -36000000, 'longname' => 'Cook Is. Time', 'shortname' => 'CKT', 'hasdst' => false ), 'Tahiti Time' => array( 'offset' => -36000000, 'longname' => 'Tahiti Time', 'shortname' => 'TAHT', 'hasdst' => false ), 'Marquesas Time' => array( 'offset' => -34200000, 'longname' => 'Marquesas Time', 'shortname' => 'MART', 'hasdst' => false ), 'Alaska Standard Time' => array( 'offset' => -32400000, 'longname' => 'Alaska Standard Time', 'shortname' => 'AKST', 'hasdst' => true, 'dstlongname' => 'Alaska Daylight Time', 'dstshortname' => 'AKDT' ), 'GMT-09:00' => array( 'offset' => -32400000, 'longname' => 'GMT-09:00', 'shortname' => 'GMT-09:00', 'hasdst' => false ), 'Gambier Time' => array( 'offset' => -32400000, 'longname' => 'Gambier Time', 'shortname' => 'GAMT', 'hasdst' => false ), 'Pacific Standard Time' => array( 'offset' => -28800000, 'longname' => 'Pacific Standard Time', 'shortname' => 'PST', 'hasdst' => true, 'dstlongname' => 'Pacific Daylight Time', 'dstshortname' => 'PDT' ), 'GMT-08:00' => array( 'offset' => -28800000, 'longname' => 'GMT-08:00', 'shortname' => 'GMT-08:00', 'hasdst' => false ), 'Pitcairn Standard Time' => array( 'offset' => -28800000, 'longname' => 'Pitcairn Standard Time', 'shortname' => 'PST', 'hasdst' => false ), 'Mountain Standard Time' => array( 'offset' => -25200000, 'longname' => 'Mountain Standard Time', 'shortname' => 'MST', 'hasdst' => true, 'dstlongname' => 'Mountain Daylight Time', 'dstshortname' => 'MDT' ), 'GMT-07:00' => array( 'offset' => -25200000, 'longname' => 'GMT-07:00', 'shortname' => 'GMT-07:00', 'hasdst' => false ), 'Central Standard Time' => array( 'offset' => -18000000, 'longname' => 'Central Standard Time', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Daylight Time', 'dstshortname' => 'CDT' ), 'Eastern Standard Time' => array( 'offset' => -18000000, 'longname' => 'Eastern Standard Time', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Daylight Time', 'dstshortname' => 'EDT' ), 'Easter Is. Time' => array( 'offset' => -21600000, 'longname' => 'Easter Is. Time', 'shortname' => 'EAST', 'hasdst' => true, 'dstlongname' => 'Easter Is. Summer Time', 'dstshortname' => 'EASST' ), 'GMT-06:00' => array( 'offset' => -21600000, 'longname' => 'GMT-06:00', 'shortname' => 'GMT-06:00', 'hasdst' => false ), 'Galapagos Time' => array( 'offset' => -21600000, 'longname' => 'Galapagos Time', 'shortname' => 'GALT', 'hasdst' => false ), 'Colombia Time' => array( 'offset' => -18000000, 'longname' => 'Colombia Time', 'shortname' => 'COT', 'hasdst' => false ), 'Acre Time' => array( 'offset' => -18000000, 'longname' => 'Acre Time', 'shortname' => 'ACT', 'hasdst' => false ), 'Ecuador Time' => array( 'offset' => -18000000, 'longname' => 'Ecuador Time', 'shortname' => 'ECT', 'hasdst' => false ), 'Peru Time' => array( 'offset' => -18000000, 'longname' => 'Peru Time', 'shortname' => 'PET', 'hasdst' => false ), 'GMT-05:00' => array( 'offset' => -18000000, 'longname' => 'GMT-05:00', 'shortname' => 'GMT-05:00', 'hasdst' => false ), 'Atlantic Standard Time' => array( 'offset' => -14400000, 'longname' => 'Atlantic Standard Time', 'shortname' => 'AST', 'hasdst' => true, 'dstlongname' => 'Atlantic Daylight Time', 'dstshortname' => 'ADT' ), 'Paraguay Time' => array( 'offset' => -14400000, 'longname' => 'Paraguay Time', 'shortname' => 'PYT', 'hasdst' => true, 'dstlongname' => 'Paraguay Summer Time', 'dstshortname' => 'PYST' ), 'Amazon Standard Time' => array( 'offset' => -14400000, 'longname' => 'Amazon Standard Time', 'shortname' => 'AMT', 'hasdst' => false ), 'Venezuela Time' => array( 'offset' => -14400000, 'longname' => 'Venezuela Time', 'shortname' => 'VET', 'hasdst' => false ), 'Guyana Time' => array( 'offset' => -14400000, 'longname' => 'Guyana Time', 'shortname' => 'GYT', 'hasdst' => false ), 'Bolivia Time' => array( 'offset' => -14400000, 'longname' => 'Bolivia Time', 'shortname' => 'BOT', 'hasdst' => false ), 'Chile Time' => array( 'offset' => -14400000, 'longname' => 'Chile Time', 'shortname' => 'CLT', 'hasdst' => true, 'dstlongname' => 'Chile Summer Time', 'dstshortname' => 'CLST' ), 'Falkland Is. Time' => array( 'offset' => -14400000, 'longname' => 'Falkland Is. Time', 'shortname' => 'FKT', 'hasdst' => true, 'dstlongname' => 'Falkland Is. Summer Time', 'dstshortname' => 'FKST' ), 'GMT-04:00' => array( 'offset' => -14400000, 'longname' => 'GMT-04:00', 'shortname' => 'GMT-04:00', 'hasdst' => false ), 'Newfoundland Standard Time' => array( 'offset' => -12600000, 'longname' => 'Newfoundland Standard Time', 'shortname' => 'NST', 'hasdst' => true, 'dstlongname' => 'Newfoundland Daylight Time', 'dstshortname' => 'NDT' ), 'Argentine Time' => array( 'offset' => -10800000, 'longname' => 'Argentine Time', 'shortname' => 'ART', 'hasdst' => false ), 'Brazil Time' => array( 'offset' => -10800000, 'longname' => 'Brazil Time', 'shortname' => 'BRT', 'hasdst' => true, 'dstlongname' => 'Brazil Summer Time', 'dstshortname' => 'BRST' ), 'French Guiana Time' => array( 'offset' => -10800000, 'longname' => 'French Guiana Time', 'shortname' => 'GFT', 'hasdst' => false ), 'Western Greenland Time' => array( 'offset' => -10800000, 'longname' => 'Western Greenland Time', 'shortname' => 'WGT', 'hasdst' => true, 'dstlongname' => 'Western Greenland Summer Time', 'dstshortname' => 'WGST' ), 'Pierre & Miquelon Standard Time' => array( 'offset' => -10800000, 'longname' => 'Pierre & Miquelon Standard Time', 'shortname' => 'PMST', 'hasdst' => true, 'dstlongname' => 'Pierre & Miquelon Daylight Time', 'dstshortname' => 'PMDT' ), 'Uruguay Time' => array( 'offset' => -10800000, 'longname' => 'Uruguay Time', 'shortname' => 'UYT', 'hasdst' => false ), 'Suriname Time' => array( 'offset' => -10800000, 'longname' => 'Suriname Time', 'shortname' => 'SRT', 'hasdst' => false ), 'GMT-03:00' => array( 'offset' => -10800000, 'longname' => 'GMT-03:00', 'shortname' => 'GMT-03:00', 'hasdst' => false ), 'Fernando de Noronha Time' => array( 'offset' => -7200000, 'longname' => 'Fernando de Noronha Time', 'shortname' => 'FNT', 'hasdst' => false ), 'South Georgia Standard Time' => array( 'offset' => -7200000, 'longname' => 'South Georgia Standard Time', 'shortname' => 'GST', 'hasdst' => false ), 'GMT-02:00' => array( 'offset' => -7200000, 'longname' => 'GMT-02:00', 'shortname' => 'GMT-02:00', 'hasdst' => false ), 'Eastern Greenland Time' => array( 'offset' => 3600000, 'longname' => 'Eastern Greenland Time', 'shortname' => 'EGT', 'hasdst' => true, 'dstlongname' => 'Eastern Greenland Summer Time', 'dstshortname' => 'EGST' ), 'Azores Time' => array( 'offset' => -3600000, 'longname' => 'Azores Time', 'shortname' => 'AZOT', 'hasdst' => true, 'dstlongname' => 'Azores Summer Time', 'dstshortname' => 'AZOST' ), 'Cape Verde Time' => array( 'offset' => -3600000, 'longname' => 'Cape Verde Time', 'shortname' => 'CVT', 'hasdst' => false ), 'GMT-01:00' => array( 'offset' => -3600000, 'longname' => 'GMT-01:00', 'shortname' => 'GMT-01:00', 'hasdst' => false ), 'Greenwich Mean Time' => array( 'offset' => 0, 'longname' => 'Greenwich Mean Time', 'shortname' => 'GMT', 'hasdst' => false ), 'Western European Time' => array( 'offset' => 0, 'longname' => 'Western European Time', 'shortname' => 'WET', 'hasdst' => true, 'dstlongname' => 'Western European Summer Time', 'dstshortname' => 'WEST' ), 'GMT+00:00' => array( 'offset' => 0, 'longname' => 'GMT+00:00', 'shortname' => 'GMT+00:00', 'hasdst' => false ), 'Coordinated Universal Time' => array( 'offset' => 0, 'longname' => 'Coordinated Universal Time', 'shortname' => 'UTC', 'hasdst' => false ), 'Central European Time' => array( 'offset' => 3600000, 'longname' => 'Central European Time', 'shortname' => 'CET', 'hasdst' => true, 'dstlongname' => 'Central European Summer Time', 'dstshortname' => 'CEST' ), 'Western African Time' => array( 'offset' => 3600000, 'longname' => 'Western African Time', 'shortname' => 'WAT', 'hasdst' => true, 'dstlongname' => 'Western African Summer Time', 'dstshortname' => 'WAST' ), 'GMT+01:00' => array( 'offset' => 3600000, 'longname' => 'GMT+01:00', 'shortname' => 'GMT+01:00', 'hasdst' => false ), 'Middle Europe Time' => array( 'offset' => 3600000, 'longname' => 'Middle Europe Time', 'shortname' => 'MET', 'hasdst' => true, 'dstlongname' => 'Middle Europe Summer Time', 'dstshortname' => 'MEST' ), 'Eastern European Time' => array( 'offset' => 7200000, 'longname' => 'Eastern European Time', 'shortname' => 'EET', 'hasdst' => true, 'dstlongname' => 'Eastern European Summer Time', 'dstshortname' => 'EEST' ), 'Central African Time' => array( 'offset' => 7200000, 'longname' => 'Central African Time', 'shortname' => 'CAT', 'hasdst' => false ), 'South Africa Standard Time' => array( 'offset' => 7200000, 'longname' => 'South Africa Standard Time', 'shortname' => 'SAST', 'hasdst' => false ), 'Israel Standard Time' => array( 'offset' => 7200000, 'longname' => 'Israel Standard Time', 'shortname' => 'IST', 'hasdst' => true, 'dstlongname' => 'Israel Daylight Time', 'dstshortname' => 'IDT' ), 'GMT+02:00' => array( 'offset' => 7200000, 'longname' => 'GMT+02:00', 'shortname' => 'GMT+02:00', 'hasdst' => false ), 'Eastern African Time' => array( 'offset' => 10800000, 'longname' => 'Eastern African Time', 'shortname' => 'EAT', 'hasdst' => false ), 'Syowa Time' => array( 'offset' => 10800000, 'longname' => 'Syowa Time', 'shortname' => 'SYOT', 'hasdst' => false ), 'Arabia Standard Time' => array( 'offset' => 10800000, 'longname' => 'Arabia Standard Time', 'shortname' => 'AST', 'hasdst' => false ), 'GMT+03:00' => array( 'offset' => 10800000, 'longname' => 'GMT+03:00', 'shortname' => 'GMT+03:00', 'hasdst' => false ), 'Moscow Standard Time' => array( 'offset' => 10800000, 'longname' => 'Moscow Standard Time', 'shortname' => 'MSK', 'hasdst' => true, 'dstlongname' => 'Moscow Daylight Time', 'dstshortname' => 'MSD' ), 'GMT+03:07' => array( 'offset' => 11224000, 'longname' => 'GMT+03:07', 'shortname' => 'GMT+03:07', 'hasdst' => false ), 'Iran Time' => array( 'offset' => 12600000, 'longname' => 'Iran Time', 'shortname' => 'IRT', 'hasdst' => true, 'dstlongname' => 'Iran Sumer Time', 'dstshortname' => 'IRST' ), 'Aqtau Time' => array( 'offset' => 14400000, 'longname' => 'Aqtau Time', 'shortname' => 'AQTT', 'hasdst' => true, 'dstlongname' => 'Aqtau Summer Time', 'dstshortname' => 'AQTST' ), 'Azerbaijan Time' => array( 'offset' => 14400000, 'longname' => 'Azerbaijan Time', 'shortname' => 'AZT', 'hasdst' => true, 'dstlongname' => 'Azerbaijan Summer Time', 'dstshortname' => 'AZST' ), 'Gulf Standard Time' => array( 'offset' => 14400000, 'longname' => 'Gulf Standard Time', 'shortname' => 'GST', 'hasdst' => false ), 'Georgia Time' => array( 'offset' => 14400000, 'longname' => 'Georgia Time', 'shortname' => 'GET', 'hasdst' => true, 'dstlongname' => 'Georgia Summer Time', 'dstshortname' => 'GEST' ), 'Armenia Time' => array( 'offset' => 14400000, 'longname' => 'Armenia Time', 'shortname' => 'AMT', 'hasdst' => true, 'dstlongname' => 'Armenia Summer Time', 'dstshortname' => 'AMST' ), 'GMT+04:00' => array( 'offset' => 14400000, 'longname' => 'GMT+04:00', 'shortname' => 'GMT+04:00', 'hasdst' => false ), 'Samara Time' => array( 'offset' => 14400000, 'longname' => 'Samara Time', 'shortname' => 'SAMT', 'hasdst' => true, 'dstlongname' => 'Samara Summer Time', 'dstshortname' => 'SAMST' ), 'Seychelles Time' => array( 'offset' => 14400000, 'longname' => 'Seychelles Time', 'shortname' => 'SCT', 'hasdst' => false ), 'Mauritius Time' => array( 'offset' => 14400000, 'longname' => 'Mauritius Time', 'shortname' => 'MUT', 'hasdst' => false ), 'Reunion Time' => array( 'offset' => 14400000, 'longname' => 'Reunion Time', 'shortname' => 'RET', 'hasdst' => false ), 'Afghanistan Time' => array( 'offset' => 16200000, 'longname' => 'Afghanistan Time', 'shortname' => 'AFT', 'hasdst' => false ), 'Aqtobe Time' => array( 'offset' => 18000000, 'longname' => 'Aqtobe Time', 'shortname' => 'AQTT', 'hasdst' => true, 'dstlongname' => 'Aqtobe Summer Time', 'dstshortname' => 'AQTST' ), 'Turkmenistan Time' => array( 'offset' => 18000000, 'longname' => 'Turkmenistan Time', 'shortname' => 'TMT', 'hasdst' => false ), 'Kirgizstan Time' => array( 'offset' => 18000000, 'longname' => 'Kirgizstan Time', 'shortname' => 'KGT', 'hasdst' => true, 'dstlongname' => 'Kirgizstan Summer Time', 'dstshortname' => 'KGST' ), 'Tajikistan Time' => array( 'offset' => 18000000, 'longname' => 'Tajikistan Time', 'shortname' => 'TJT', 'hasdst' => false ), 'Pakistan Time' => array( 'offset' => 18000000, 'longname' => 'Pakistan Time', 'shortname' => 'PKT', 'hasdst' => false ), 'Uzbekistan Time' => array( 'offset' => 18000000, 'longname' => 'Uzbekistan Time', 'shortname' => 'UZT', 'hasdst' => false ), 'Yekaterinburg Time' => array( 'offset' => 18000000, 'longname' => 'Yekaterinburg Time', 'shortname' => 'YEKT', 'hasdst' => true, 'dstlongname' => 'Yekaterinburg Summer Time', 'dstshortname' => 'YEKST' ), 'GMT+05:00' => array( 'offset' => 18000000, 'longname' => 'GMT+05:00', 'shortname' => 'GMT+05:00', 'hasdst' => false ), 'French Southern & Antarctic Lands Time' => array( 'offset' => 18000000, 'longname' => 'French Southern & Antarctic Lands Time', 'shortname' => 'TFT', 'hasdst' => false ), 'Maldives Time' => array( 'offset' => 18000000, 'longname' => 'Maldives Time', 'shortname' => 'MVT', 'hasdst' => false ), 'India Standard Time' => array( 'offset' => 19800000, 'longname' => 'India Standard Time', 'shortname' => 'IST', 'hasdst' => false ), 'Nepal Time' => array( 'offset' => 20700000, 'longname' => 'Nepal Time', 'shortname' => 'NPT', 'hasdst' => false ), 'Mawson Time' => array( 'offset' => 21600000, 'longname' => 'Mawson Time', 'shortname' => 'MAWT', 'hasdst' => false ), 'Vostok time' => array( 'offset' => 21600000, 'longname' => 'Vostok time', 'shortname' => 'VOST', 'hasdst' => false ), 'Alma-Ata Time' => array( 'offset' => 21600000, 'longname' => 'Alma-Ata Time', 'shortname' => 'ALMT', 'hasdst' => true, 'dstlongname' => 'Alma-Ata Summer Time', 'dstshortname' => 'ALMST' ), 'Sri Lanka Time' => array( 'offset' => 21600000, 'longname' => 'Sri Lanka Time', 'shortname' => 'LKT', 'hasdst' => false ), 'Bangladesh Time' => array( 'offset' => 21600000, 'longname' => 'Bangladesh Time', 'shortname' => 'BDT', 'hasdst' => false ), 'Novosibirsk Time' => array( 'offset' => 21600000, 'longname' => 'Novosibirsk Time', 'shortname' => 'NOVT', 'hasdst' => true, 'dstlongname' => 'Novosibirsk Summer Time', 'dstshortname' => 'NOVST' ), 'Omsk Time' => array( 'offset' => 21600000, 'longname' => 'Omsk Time', 'shortname' => 'OMST', 'hasdst' => true, 'dstlongname' => 'Omsk Summer Time', 'dstshortname' => 'OMSST' ), 'Bhutan Time' => array( 'offset' => 21600000, 'longname' => 'Bhutan Time', 'shortname' => 'BTT', 'hasdst' => false ), 'GMT+06:00' => array( 'offset' => 21600000, 'longname' => 'GMT+06:00', 'shortname' => 'GMT+06:00', 'hasdst' => false ), 'Indian Ocean Territory Time' => array( 'offset' => 21600000, 'longname' => 'Indian Ocean Territory Time', 'shortname' => 'IOT', 'hasdst' => false ), 'Myanmar Time' => array( 'offset' => 23400000, 'longname' => 'Myanmar Time', 'shortname' => 'MMT', 'hasdst' => false ), 'Cocos Islands Time' => array( 'offset' => 23400000, 'longname' => 'Cocos Islands Time', 'shortname' => 'CCT', 'hasdst' => false ), 'Davis Time' => array( 'offset' => 25200000, 'longname' => 'Davis Time', 'shortname' => 'DAVT', 'hasdst' => false ), 'Indochina Time' => array( 'offset' => 25200000, 'longname' => 'Indochina Time', 'shortname' => 'ICT', 'hasdst' => false ), 'Hovd Time' => array( 'offset' => 25200000, 'longname' => 'Hovd Time', 'shortname' => 'HOVT', 'hasdst' => false ), 'West Indonesia Time' => array( 'offset' => 25200000, 'longname' => 'West Indonesia Time', 'shortname' => 'WIT', 'hasdst' => false ), 'Krasnoyarsk Time' => array( 'offset' => 25200000, 'longname' => 'Krasnoyarsk Time', 'shortname' => 'KRAT', 'hasdst' => true, 'dstlongname' => 'Krasnoyarsk Summer Time', 'dstshortname' => 'KRAST' ), 'GMT+07:00' => array( 'offset' => 25200000, 'longname' => 'GMT+07:00', 'shortname' => 'GMT+07:00', 'hasdst' => false ), 'Christmas Island Time' => array( 'offset' => 25200000, 'longname' => 'Christmas Island Time', 'shortname' => 'CXT', 'hasdst' => false ), 'Western Standard Time (Australia)' => array( 'offset' => 28800000, 'longname' => 'Western Standard Time (Australia)', 'shortname' => 'WST', 'hasdst' => false ), 'Brunei Time' => array( 'offset' => 28800000, 'longname' => 'Brunei Time', 'shortname' => 'BNT', 'hasdst' => false ), 'China Standard Time' => array( 'offset' => 28800000, 'longname' => 'China Standard Time', 'shortname' => 'CST', 'hasdst' => false ), 'Hong Kong Time' => array( 'offset' => 28800000, 'longname' => 'Hong Kong Time', 'shortname' => 'HKT', 'hasdst' => false ), 'Irkutsk Time' => array( 'offset' => 28800000, 'longname' => 'Irkutsk Time', 'shortname' => 'IRKT', 'hasdst' => true, 'dstlongname' => 'Irkutsk Summer Time', 'dstshortname' => 'IRKST' ), 'Malaysia Time' => array( 'offset' => 28800000, 'longname' => 'Malaysia Time', 'shortname' => 'MYT', 'hasdst' => false ), 'Philippines Time' => array( 'offset' => 28800000, 'longname' => 'Philippines Time', 'shortname' => 'PHT', 'hasdst' => false ), 'Singapore Time' => array( 'offset' => 28800000, 'longname' => 'Singapore Time', 'shortname' => 'SGT', 'hasdst' => false ), 'Central Indonesia Time' => array( 'offset' => 28800000, 'longname' => 'Central Indonesia Time', 'shortname' => 'CIT', 'hasdst' => false ), 'Ulaanbaatar Time' => array( 'offset' => 28800000, 'longname' => 'Ulaanbaatar Time', 'shortname' => 'ULAT', 'hasdst' => false ), 'GMT+08:00' => array( 'offset' => 28800000, 'longname' => 'GMT+08:00', 'shortname' => 'GMT+08:00', 'hasdst' => false ), 'Choibalsan Time' => array( 'offset' => 32400000, 'longname' => 'Choibalsan Time', 'shortname' => 'CHOT', 'hasdst' => false ), 'East Timor Time' => array( 'offset' => 32400000, 'longname' => 'East Timor Time', 'shortname' => 'TPT', 'hasdst' => false ), 'East Indonesia Time' => array( 'offset' => 32400000, 'longname' => 'East Indonesia Time', 'shortname' => 'EIT', 'hasdst' => false ), 'Korea Standard Time' => array( 'offset' => 32400000, 'longname' => 'Korea Standard Time', 'shortname' => 'KST', 'hasdst' => false ), 'Japan Standard Time' => array( 'offset' => 32400000, 'longname' => 'Japan Standard Time', 'shortname' => 'JST', 'hasdst' => false ), 'Yakutsk Time' => array( 'offset' => 32400000, 'longname' => 'Yakutsk Time', 'shortname' => 'YAKT', 'hasdst' => true, 'dstlongname' => 'Yaktsk Summer Time', 'dstshortname' => 'YAKST' ), 'GMT+09:00' => array( 'offset' => 32400000, 'longname' => 'GMT+09:00', 'shortname' => 'GMT+09:00', 'hasdst' => false ), 'Palau Time' => array( 'offset' => 32400000, 'longname' => 'Palau Time', 'shortname' => 'PWT', 'hasdst' => false ), 'Central Standard Time (Northern Territory)' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (Northern Territory)', 'shortname' => 'CST', 'hasdst' => false ), 'Central Standard Time (South Australia)' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (South Australia)', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Summer Time (South Australia)', 'dstshortname' => 'CST' ), 'Central Standard Time (South Australia/New South Wales)' => array( 'offset' => 34200000, 'longname' => 'Central Standard Time (South Australia/New South Wales)', 'shortname' => 'CST', 'hasdst' => true, 'dstlongname' => 'Central Summer Time (South Australia/New South Wales)', 'dstshortname' => 'CST' ), 'Eastern Standard Time (New South Wales)' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (New South Wales)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (New South Wales)', 'dstshortname' => 'EST' ), 'Dumont-d\'Urville Time' => array( 'offset' => 36000000, 'longname' => 'Dumont-d\'Urville Time', 'shortname' => 'DDUT', 'hasdst' => false ), 'Sakhalin Time' => array( 'offset' => 36000000, 'longname' => 'Sakhalin Time', 'shortname' => 'SAKT', 'hasdst' => true, 'dstlongname' => 'Sakhalin Summer Time', 'dstshortname' => 'SAKST' ), 'Vladivostok Time' => array( 'offset' => 36000000, 'longname' => 'Vladivostok Time', 'shortname' => 'VLAT', 'hasdst' => true, 'dstlongname' => 'Vladivostok Summer Time', 'dstshortname' => 'VLAST' ), 'Eastern Standard Time (Queensland)' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Queensland)', 'shortname' => 'EST', 'hasdst' => false ), 'Eastern Standard Time (Tasmania)' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Tasmania)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (Tasmania)', 'dstshortname' => 'EST' ), 'Eastern Standard Time (Victoria)' => array( 'offset' => 36000000, 'longname' => 'Eastern Standard Time (Victoria)', 'shortname' => 'EST', 'hasdst' => true, 'dstlongname' => 'Eastern Summer Time (Victoria)', 'dstshortname' => 'EST' ), 'GMT+10:00' => array( 'offset' => 36000000, 'longname' => 'GMT+10:00', 'shortname' => 'GMT+10:00', 'hasdst' => false ), 'Chamorro Standard Time' => array( 'offset' => 36000000, 'longname' => 'Chamorro Standard Time', 'shortname' => 'ChST', 'hasdst' => false ), 'Papua New Guinea Time' => array( 'offset' => 36000000, 'longname' => 'Papua New Guinea Time', 'shortname' => 'PGT', 'hasdst' => false ), 'Truk Time' => array( 'offset' => 36000000, 'longname' => 'Truk Time', 'shortname' => 'TRUT', 'hasdst' => false ), 'Yap Time' => array( 'offset' => 36000000, 'longname' => 'Yap Time', 'shortname' => 'YAPT', 'hasdst' => false ), 'Load Howe Standard Time' => array( 'offset' => 37800000, 'longname' => 'Load Howe Standard Time', 'shortname' => 'LHST', 'hasdst' => true, 'dstlongname' => 'Load Howe Summer Time', 'dstshortname' => 'LHST' ), 'Magadan Time' => array( 'offset' => 39600000, 'longname' => 'Magadan Time', 'shortname' => 'MAGT', 'hasdst' => true, 'dstlongname' => 'Magadan Summer Time', 'dstshortname' => 'MAGST' ), 'GMT+11:00' => array( 'offset' => 39600000, 'longname' => 'GMT+11:00', 'shortname' => 'GMT+11:00', 'hasdst' => false ), 'Vanuatu Time' => array( 'offset' => 39600000, 'longname' => 'Vanuatu Time', 'shortname' => 'VUT', 'hasdst' => false ), 'Solomon Is. Time' => array( 'offset' => 39600000, 'longname' => 'Solomon Is. Time', 'shortname' => 'SBT', 'hasdst' => false ), 'Kosrae Time' => array( 'offset' => 39600000, 'longname' => 'Kosrae Time', 'shortname' => 'KOST', 'hasdst' => false ), 'New Caledonia Time' => array( 'offset' => 39600000, 'longname' => 'New Caledonia Time', 'shortname' => 'NCT', 'hasdst' => false ), 'Ponape Time' => array( 'offset' => 39600000, 'longname' => 'Ponape Time', 'shortname' => 'PONT', 'hasdst' => false ), 'Norfolk Time' => array( 'offset' => 41400000, 'longname' => 'Norfolk Time', 'shortname' => 'NFT', 'hasdst' => false ), 'New Zealand Standard Time' => array( 'offset' => 43200000, 'longname' => 'New Zealand Standard Time', 'shortname' => 'NZST', 'hasdst' => true, 'dstlongname' => 'New Zealand Daylight Time', 'dstshortname' => 'NZDT' ), 'Anadyr Time' => array( 'offset' => 43200000, 'longname' => 'Anadyr Time', 'shortname' => 'ANAT', 'hasdst' => true, 'dstlongname' => 'Anadyr Summer Time', 'dstshortname' => 'ANAST' ), 'Petropavlovsk-Kamchatski Time' => array( 'offset' => 43200000, 'longname' => 'Petropavlovsk-Kamchatski Time', 'shortname' => 'PETT', 'hasdst' => true, 'dstlongname' => 'Petropavlovsk-Kamchatski Summer Time', 'dstshortname' => 'PETST' ), 'GMT+12:00' => array( 'offset' => 43200000, 'longname' => 'GMT+12:00', 'shortname' => 'GMT+12:00', 'hasdst' => false ), 'Marshall Islands Time' => array( 'offset' => 43200000, 'longname' => 'Marshall Islands Time', 'shortname' => 'MHT', 'hasdst' => false ), 'Fiji Time' => array( 'offset' => 43200000, 'longname' => 'Fiji Time', 'shortname' => 'FJT', 'hasdst' => false ), 'Tuvalu Time' => array( 'offset' => 43200000, 'longname' => 'Tuvalu Time', 'shortname' => 'TVT', 'hasdst' => false ), 'Nauru Time' => array( 'offset' => 43200000, 'longname' => 'Nauru Time', 'shortname' => 'NRT', 'hasdst' => false ), 'Gilbert Is. Time' => array( 'offset' => 43200000, 'longname' => 'Gilbert Is. Time', 'shortname' => 'GILT', 'hasdst' => false ), 'Wake Time' => array( 'offset' => 43200000, 'longname' => 'Wake Time', 'shortname' => 'WAKT', 'hasdst' => false ), 'Wallis & Futuna Time' => array( 'offset' => 43200000, 'longname' => 'Wallis & Futuna Time', 'shortname' => 'WFT', 'hasdst' => false ), 'Chatham Standard Time' => array( 'offset' => 45900000, 'longname' => 'Chatham Standard Time', 'shortname' => 'CHAST', 'hasdst' => true, 'dstlongname' => 'Chatham Daylight Time', 'dstshortname' => 'CHADT' ), 'GMT+13:00' => array( 'offset' => 46800000, 'longname' => 'GMT+13:00', 'shortname' => 'GMT+13:00', 'hasdst' => false ), 'Phoenix Is. Time' => array( 'offset' => 46800000, 'longname' => 'Phoenix Is. Time', 'shortname' => 'PHOT', 'hasdst' => false ), 'Tonga Time' => array( 'offset' => 46800000, 'longname' => 'Tonga Time', 'shortname' => 'TOT', 'hasdst' => false ), 'GMT+14:00' => array( 'offset' => 50400000, 'longname' => 'GMT+14:00', 'shortname' => 'GMT+14:00', 'hasdst' => false ), 'Line Is. Time' => array( 'offset' => 50400000, 'longname' => 'Line Is. Time', 'shortname' => 'LINT', 'hasdst' => false ), ); /** * Initialize default timezone * * First try _DATE_TIMEZONE_DEFAULT global, then PHP_TZ environment var, * then TZ environment var */ if(isset($GLOBALS['_DATE_TIMEZONE_DEFAULT']) && Date_TimeZone::isValidID($GLOBALS['_DATE_TIMEZONE_DEFAULT'])) { Date_TimeZone::setDefault($GLOBALS['_DATE_TIMEZONE_DEFAULT']); } elseif (getenv('PHP_TZ') && Date_TimeZone::isValidID(getenv('PHP_TZ'))) { Date_TimeZone::setDefault(getenv('PHP_TZ')); } elseif (getenv('TZ') && Date_TimeZone::isValidID(getenv('TZ'))) { Date_TimeZone::setDefault(getenv('TZ')); } elseif (Date_TimeZone::isValidID(date('T'))) { Date_TimeZone::setDefault(date('T')); } else { Date_TimeZone::setDefault('UTC'); } /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>Date-1.4.7/docs/LICENSE100666 0 0 2767 10530726050 7403 Copyright (c) 1997-2006 Baba Buehler, Pierre-Alain Joye All rights reserved Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of Baba Buehler, Pierre-Alain Joye nor the names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Date-1.4.7/docs/TODO100666 0 0 671 10530726050 7036 $Id: TODO,v 1.1 2006/11/21 05:40:20 firman Exp $ TODO - Fix once the timezone problem - Once TZ works nicely, update the testunit_date and use the real timezone and dct to check the expected time offset - Clean the test cases and atomic display instead of a global ok or failed - Write the docs.... - More strict complaint againts ISO 8601 - Complaint againts RFC 822 Date and Time Specification - Complaint againts ISO 3339 Date-1.4.7/tests/bugs/bug-674.phpt100666 0 0 3156 10530726050 11531 --TEST-- Bug #674: strange (wrong?) result of Date_Calc::endOfWeek --FILE-- --EXPECT-- Parameters: 17-3-2003 Begin of week = 20030323, End of week = 20030317, Begin of next week = 20030324, Begin of previous week = 20030310 Parameters: 20-3-2003 Begin of week = 20030323, End of week = 20030317, Begin of next week = 20030324, Begin of previous week = 20030310 Parameters: 23-3-2003 Begin of week = 20030323, End of week = 20030317, Begin of next week = 20030324, Begin of previous week = 20030310 Date-1.4.7/tests/bugs/bug-727-1.phpt100666 0 0 3017 10530726050 11662 --TEST-- Bug #727: Date_Calc::weeksInMonth() wrong result Tests for weeksInMonth, february with 4 weeks Monday as 1st day of week --FILE-- --EXPECT-- 1999/2 = 4 weeks 2010/2 = 4 weeks 2021/2 = 4 weeks 2027/2 = 4 weeks 1937/2 = 4 weeks 1943/2 = 4 weeks 1802/2 = 4 weeks 1813/2 = 4 weeks 1819/2 = 4 weeks 1830/2 = 4 weeks 1841/2 = 4 weeks 1847/2 = 4 weeks 1858/2 = 4 weeks 1869/2 = 4 weeks 1875/2 = 4 weeks 1886/2 = 4 weeks 1897/2 = 4 weeks 1909/2 = 4 weeks 1915/2 = 4 weeks 1926/2 = 4 weeks Date-1.4.7/tests/bugs/bug-727-2.phpt100666 0 0 3017 10530726050 11663 --TEST-- Bug #727: Date_Calc::weeksInMonth() wrong result Tests for weeksInMonth, february with 4 weeks Sunday as 1st day of week --FILE-- --EXPECT-- 2009/2 = 4 weeks 2015/2 = 4 weeks 2026/2 = 4 weeks 2037/2 = 4 weeks 1931/2 = 4 weeks 1942/2 = 4 weeks 1801/2 = 4 weeks 1807/2 = 4 weeks 1818/2 = 4 weeks 1829/2 = 4 weeks 1835/2 = 4 weeks 1846/2 = 4 weeks 1857/2 = 4 weeks 1863/2 = 4 weeks 1874/2 = 4 weeks 1885/2 = 4 weeks 1891/2 = 4 weeks 1903/2 = 4 weeks 1914/2 = 4 weeks 1925/2 = 4 weeks Date-1.4.7/tests/bugs/bug-727-3.phpt100666 0 0 34777 10530726052 11727 --TEST-- Bug #727: Date_Calc::weeksInMonth() wrong result Tests for weeksInMonth "random" Sunday as 1st day of week --FILE-- --EXPECT-- 1999/12 = 5 weeks 2000/11 = 5 weeks 2001/11 = 5 weeks 2002/12 = 5 weeks 2003/12 = 5 weeks 2004/12 = 5 weeks 2005/12 = 5 weeks 2006/11 = 5 weeks 2007/11 = 5 weeks 2008/12 = 5 weeks 2009/12 = 5 weeks 2010/12 = 5 weeks 2011/12 = 5 weeks 2012/11 = 5 weeks 2013/12 = 5 weeks 2014/12 = 5 weeks 2015/12 = 5 weeks 2016/12 = 5 weeks 2017/11 = 5 weeks 2018/11 = 5 weeks 2019/12 = 5 weeks 2020/12 = 5 weeks 2021/12 = 5 weeks 2022/12 = 5 weeks 2023/11 = 5 weeks 2024/12 = 5 weeks 2025/12 = 5 weeks 2026/12 = 5 weeks 2027/12 = 5 weeks 2028/11 = 5 weeks 2029/11 = 5 weeks 2030/12 = 5 weeks 2031/12 = 5 weeks 2032/12 = 5 weeks 2033/12 = 5 weeks 2034/11 = 5 weeks 2035/11 = 5 weeks 2036/12 = 5 weeks 2037/12 = 5 weeks 1930/12 = 5 weeks 1931/12 = 5 weeks 1932/12 = 5 weeks 1933/11 = 5 weeks 1934/11 = 5 weeks 1935/12 = 5 weeks 1936/12 = 5 weeks 1937/12 = 5 weeks 1938/12 = 5 weeks 1939/11 = 5 weeks 1940/12 = 5 weeks 1941/12 = 5 weeks 1942/12 = 5 weeks 1943/12 = 5 weeks 1944/11 = 5 weeks 1945/11 = 5 weeks 1946/12 = 5 weeks 1947/12 = 5 weeks 1948/12 = 5 weeks 1949/12 = 5 weeks 1800/12 = 5 weeks 1801/12 = 5 weeks 1802/12 = 5 weeks 1803/12 = 5 weeks 1804/11 = 5 weeks 1805/12 = 5 weeks 1806/12 = 5 weeks 1807/12 = 5 weeks 1808/12 = 5 weeks 1809/11 = 5 weeks 1810/11 = 5 weeks 1811/12 = 5 weeks 1812/12 = 5 weeks 1813/12 = 5 weeks 1814/12 = 5 weeks 1815/11 = 5 weeks 1816/12 = 5 weeks 1817/12 = 5 weeks 1818/12 = 5 weeks 1819/12 = 5 weeks 1820/11 = 5 weeks 1821/11 = 5 weeks 1822/12 = 5 weeks 1823/12 = 5 weeks 1824/12 = 5 weeks 1825/12 = 5 weeks 1826/11 = 5 weeks 1827/11 = 5 weeks 1828/12 = 5 weeks 1829/12 = 5 weeks 1830/12 = 5 weeks 1831/12 = 5 weeks 1832/11 = 5 weeks 1833/12 = 5 weeks 1834/12 = 5 weeks 1835/12 = 5 weeks 1836/12 = 5 weeks 1837/11 = 5 weeks 1838/11 = 5 weeks 1839/12 = 5 weeks 1840/12 = 5 weeks 1841/12 = 5 weeks 1842/12 = 5 weeks 1843/11 = 5 weeks 1844/12 = 5 weeks 1845/12 = 5 weeks 1846/12 = 5 weeks 1847/12 = 5 weeks 1848/11 = 5 weeks 1849/11 = 5 weeks 1850/12 = 5 weeks 1851/12 = 5 weeks 1852/12 = 5 weeks 1853/12 = 5 weeks 1854/11 = 5 weeks 1855/11 = 5 weeks 1856/12 = 5 weeks 1857/12 = 5 weeks 1858/12 = 5 weeks 1859/12 = 5 weeks 1860/11 = 5 weeks 1861/12 = 5 weeks 1862/12 = 5 weeks 1863/12 = 5 weeks 1864/12 = 5 weeks 1865/11 = 5 weeks 1866/11 = 5 weeks 1867/12 = 5 weeks 1868/12 = 5 weeks 1869/12 = 5 weeks 1870/12 = 5 weeks 1871/11 = 5 weeks 1872/12 = 5 weeks 1873/12 = 5 weeks 1874/12 = 5 weeks 1875/12 = 5 weeks 1876/11 = 5 weeks 1877/11 = 5 weeks 1878/12 = 5 weeks 1879/12 = 5 weeks 1880/12 = 5 weeks 1881/12 = 5 weeks 1882/11 = 5 weeks 1883/11 = 5 weeks 1884/12 = 5 weeks 1885/12 = 5 weeks 1886/12 = 5 weeks 1887/12 = 5 weeks 1888/11 = 5 weeks 1889/12 = 5 weeks 1890/12 = 5 weeks 1891/12 = 5 weeks 1892/12 = 5 weeks 1893/11 = 5 weeks 1894/11 = 5 weeks 1895/12 = 5 weeks 1896/12 = 5 weeks 1897/12 = 5 weeks 1898/12 = 5 weeks 1899/11 = 5 weeks 1900/11 = 5 weeks 1901/12 = 5 weeks 1902/12 = 5 weeks 1903/12 = 5 weeks 1904/12 = 5 weeks 1905/11 = 5 weeks 1906/11 = 5 weeks 1907/12 = 5 weeks 1908/12 = 5 weeks 1909/12 = 5 weeks 1910/12 = 5 weeks 1911/11 = 5 weeks 1912/12 = 5 weeks 1913/12 = 5 weeks 1914/12 = 5 weeks 1915/12 = 5 weeks 1916/11 = 5 weeks 1917/11 = 5 weeks 1918/12 = 5 weeks 1919/12 = 5 weeks 1920/12 = 5 weeks 1921/12 = 5 weeks 1922/11 = 5 weeks 1923/11 = 5 weeks 1924/12 = 5 weeks 1925/12 = 5 weeks 1926/12 = 5 weeks 1927/12 = 5 weeks 1928/11 = 5 weeks 1929/12 = 5 weeks 1999/10 = 6 weeks 2000/12 = 6 weeks 2001/12 = 6 weeks 2002/6 = 6 weeks 2003/11 = 6 weeks 2004/10 = 6 weeks 2005/10 = 6 weeks 2006/12 = 6 weeks 2007/12 = 6 weeks 2008/11 = 6 weeks 2009/8 = 6 weeks 2010/10 = 6 weeks 2011/10 = 6 weeks 2012/12 = 6 weeks 2013/6 = 6 weeks 2014/11 = 6 weeks 2015/8 = 6 weeks 2016/10 = 6 weeks 2017/12 = 6 weeks 2018/12 = 6 weeks 2019/6 = 6 weeks 2020/8 = 6 weeks 2021/10 = 6 weeks 2022/10 = 6 weeks 2023/12 = 6 weeks 2024/6 = 6 weeks 2025/11 = 6 weeks 2026/8 = 6 weeks 2027/10 = 6 weeks 2028/12 = 6 weeks 2029/12 = 6 weeks 2030/6 = 6 weeks 2031/11 = 6 weeks 2032/10 = 6 weeks 2033/10 = 6 weeks 2034/12 = 6 weeks 2035/12 = 6 weeks 2036/11 = 6 weeks 2037/8 = 6 weeks 1930/11 = 6 weeks 1931/8 = 6 weeks 1932/10 = 6 weeks 1933/12 = 6 weeks 1934/12 = 6 weeks 1935/6 = 6 weeks 1936/8 = 6 weeks 1937/10 = 6 weeks 1938/10 = 6 weeks 1939/12 = 6 weeks 1940/6 = 6 weeks 1941/11 = 6 weeks 1942/8 = 6 weeks 1943/10 = 6 weeks 1944/12 = 6 weeks 1945/12 = 6 weeks 1946/6 = 6 weeks 1947/11 = 6 weeks 1948/10 = 6 weeks 1949/10 = 6 weeks 1800/11 = 6 weeks 1801/8 = 6 weeks 1802/10 = 6 weeks 1803/10 = 6 weeks 1804/12 = 6 weeks 1805/6 = 6 weeks 1806/11 = 6 weeks 1807/8 = 6 weeks 1808/10 = 6 weeks 1809/12 = 6 weeks 1810/12 = 6 weeks 1811/6 = 6 weeks 1812/8 = 6 weeks 1813/10 = 6 weeks 1814/10 = 6 weeks 1815/12 = 6 weeks 1816/6 = 6 weeks 1817/11 = 6 weeks 1818/8 = 6 weeks 1819/10 = 6 weeks 1820/12 = 6 weeks 1821/12 = 6 weeks 1822/6 = 6 weeks 1823/11 = 6 weeks 1824/10 = 6 weeks 1825/10 = 6 weeks 1826/12 = 6 weeks 1827/12 = 6 weeks 1828/11 = 6 weeks 1829/8 = 6 weeks 1830/10 = 6 weeks 1831/10 = 6 weeks 1832/12 = 6 weeks 1833/6 = 6 weeks 1834/11 = 6 weeks 1835/8 = 6 weeks 1836/10 = 6 weeks 1837/12 = 6 weeks 1838/12 = 6 weeks 1839/6 = 6 weeks 1840/8 = 6 weeks 1841/10 = 6 weeks 1842/10 = 6 weeks 1843/12 = 6 weeks 1844/6 = 6 weeks 1845/11 = 6 weeks 1846/8 = 6 weeks 1847/10 = 6 weeks 1848/12 = 6 weeks 1849/12 = 6 weeks 1850/6 = 6 weeks 1851/11 = 6 weeks 1852/10 = 6 weeks 1853/10 = 6 weeks 1854/12 = 6 weeks 1855/12 = 6 weeks 1856/11 = 6 weeks 1857/8 = 6 weeks 1858/10 = 6 weeks 1859/10 = 6 weeks 1860/12 = 6 weeks 1861/6 = 6 weeks 1862/11 = 6 weeks 1863/8 = 6 weeks 1864/10 = 6 weeks 1865/12 = 6 weeks 1866/12 = 6 weeks 1867/6 = 6 weeks 1868/8 = 6 weeks 1869/10 = 6 weeks 1870/10 = 6 weeks 1871/12 = 6 weeks 1872/6 = 6 weeks 1873/11 = 6 weeks 1874/8 = 6 weeks 1875/10 = 6 weeks 1876/12 = 6 weeks 1877/12 = 6 weeks 1878/6 = 6 weeks 1879/11 = 6 weeks 1880/10 = 6 weeks 1881/10 = 6 weeks 1882/12 = 6 weeks 1883/12 = 6 weeks 1884/11 = 6 weeks 1885/8 = 6 weeks 1886/10 = 6 weeks 1887/10 = 6 weeks 1888/12 = 6 weeks 1889/6 = 6 weeks 1890/11 = 6 weeks 1891/8 = 6 weeks 1892/10 = 6 weeks 1893/12 = 6 weeks 1894/12 = 6 weeks 1895/6 = 6 weeks 1896/8 = 6 weeks 1897/10 = 6 weeks 1898/10 = 6 weeks 1899/12 = 6 weeks 1900/12 = 6 weeks 1901/6 = 6 weeks 1902/11 = 6 weeks 1903/8 = 6 weeks 1904/10 = 6 weeks 1905/12 = 6 weeks 1906/12 = 6 weeks 1907/6 = 6 weeks 1908/8 = 6 weeks 1909/10 = 6 weeks 1910/10 = 6 weeks 1911/12 = 6 weeks 1912/6 = 6 weeks 1913/11 = 6 weeks 1914/8 = 6 weeks 1915/10 = 6 weeks 1916/12 = 6 weeks 1917/12 = 6 weeks 1918/6 = 6 weeks 1919/11 = 6 weeks 1920/10 = 6 weeks 1921/10 = 6 weeks 1922/12 = 6 weeks 1923/12 = 6 weeks 1924/11 = 6 weeks 1925/8 = 6 weeks 1926/10 = 6 weeks 1927/10 = 6 weeks 1928/12 = 6 weeks 1929/6 = 6 weeks Date-1.4.7/tests/bugs/bug-727-4.phpt100666 0 0 35001 10530726052 11705 --TEST-- Bug #727: Date_Calc::weeksInMonth() wrong result Tests for weeksInMonth "random" Monday as 1st day of week --FILE-- --EXPECT-- 1999/8 = 6 weeks 2000/10 = 6 weeks 2001/12 = 6 weeks 2002/12 = 6 weeks 2003/6 = 6 weeks 2004/8 = 6 weeks 2005/10 = 6 weeks 2006/10 = 6 weeks 2007/12 = 6 weeks 2008/6 = 6 weeks 2009/11 = 6 weeks 2010/8 = 6 weeks 2011/10 = 6 weeks 2012/12 = 6 weeks 2013/12 = 6 weeks 2014/6 = 6 weeks 2015/11 = 6 weeks 2016/10 = 6 weeks 2017/10 = 6 weeks 2018/12 = 6 weeks 2019/12 = 6 weeks 2020/11 = 6 weeks 2021/8 = 6 weeks 2022/10 = 6 weeks 2023/10 = 6 weeks 2024/12 = 6 weeks 2025/6 = 6 weeks 2026/11 = 6 weeks 2027/8 = 6 weeks 2028/10 = 6 weeks 2029/12 = 6 weeks 2030/12 = 6 weeks 2031/6 = 6 weeks 2032/8 = 6 weeks 2033/10 = 6 weeks 2034/10 = 6 weeks 2035/12 = 6 weeks 2036/6 = 6 weeks 2037/11 = 6 weeks 1930/6 = 6 weeks 1931/11 = 6 weeks 1932/10 = 6 weeks 1933/10 = 6 weeks 1934/12 = 6 weeks 1935/12 = 6 weeks 1936/11 = 6 weeks 1937/8 = 6 weeks 1938/10 = 6 weeks 1939/10 = 6 weeks 1940/12 = 6 weeks 1941/6 = 6 weeks 1942/11 = 6 weeks 1943/8 = 6 weeks 1944/10 = 6 weeks 1945/12 = 6 weeks 1946/12 = 6 weeks 1947/6 = 6 weeks 1948/8 = 6 weeks 1949/10 = 6 weeks 1800/6 = 6 weeks 1801/11 = 6 weeks 1802/8 = 6 weeks 1803/10 = 6 weeks 1804/12 = 6 weeks 1805/12 = 6 weeks 1806/6 = 6 weeks 1807/11 = 6 weeks 1808/10 = 6 weeks 1809/10 = 6 weeks 1810/12 = 6 weeks 1811/12 = 6 weeks 1812/11 = 6 weeks 1813/8 = 6 weeks 1814/10 = 6 weeks 1815/10 = 6 weeks 1816/12 = 6 weeks 1817/6 = 6 weeks 1818/11 = 6 weeks 1819/8 = 6 weeks 1820/10 = 6 weeks 1821/12 = 6 weeks 1822/12 = 6 weeks 1823/6 = 6 weeks 1824/8 = 6 weeks 1825/10 = 6 weeks 1826/10 = 6 weeks 1827/12 = 6 weeks 1828/6 = 6 weeks 1829/11 = 6 weeks 1830/8 = 6 weeks 1831/10 = 6 weeks 1832/12 = 6 weeks 1833/12 = 6 weeks 1834/6 = 6 weeks 1835/11 = 6 weeks 1836/10 = 6 weeks 1837/10 = 6 weeks 1838/12 = 6 weeks 1839/12 = 6 weeks 1840/11 = 6 weeks 1841/8 = 6 weeks 1842/10 = 6 weeks 1843/10 = 6 weeks 1844/12 = 6 weeks 1845/6 = 6 weeks 1846/11 = 6 weeks 1847/8 = 6 weeks 1848/10 = 6 weeks 1849/12 = 6 weeks 1850/12 = 6 weeks 1851/6 = 6 weeks 1852/8 = 6 weeks 1853/10 = 6 weeks 1854/10 = 6 weeks 1855/12 = 6 weeks 1856/6 = 6 weeks 1857/11 = 6 weeks 1858/8 = 6 weeks 1859/10 = 6 weeks 1860/12 = 6 weeks 1861/12 = 6 weeks 1862/6 = 6 weeks 1863/11 = 6 weeks 1864/10 = 6 weeks 1865/10 = 6 weeks 1866/12 = 6 weeks 1867/12 = 6 weeks 1868/11 = 6 weeks 1869/8 = 6 weeks 1870/10 = 6 weeks 1871/10 = 6 weeks 1872/12 = 6 weeks 1873/6 = 6 weeks 1874/11 = 6 weeks 1875/8 = 6 weeks 1876/10 = 6 weeks 1877/12 = 6 weeks 1878/12 = 6 weeks 1879/6 = 6 weeks 1880/8 = 6 weeks 1881/10 = 6 weeks 1882/10 = 6 weeks 1883/12 = 6 weeks 1884/6 = 6 weeks 1885/11 = 6 weeks 1886/8 = 6 weeks 1887/10 = 6 weeks 1888/12 = 6 weeks 1889/12 = 6 weeks 1890/6 = 6 weeks 1891/11 = 6 weeks 1892/10 = 6 weeks 1893/10 = 6 weeks 1894/12 = 6 weeks 1895/12 = 6 weeks 1896/11 = 6 weeks 1897/8 = 6 weeks 1898/10 = 6 weeks 1899/10 = 6 weeks 1900/12 = 6 weeks 1901/12 = 6 weeks 1902/6 = 6 weeks 1903/11 = 6 weeks 1904/10 = 6 weeks 1905/10 = 6 weeks 1906/12 = 6 weeks 1907/12 = 6 weeks 1908/11 = 6 weeks 1909/8 = 6 weeks 1910/10 = 6 weeks 1911/10 = 6 weeks 1912/12 = 6 weeks 1913/6 = 6 weeks 1914/11 = 6 weeks 1915/8 = 6 weeks 1916/10 = 6 weeks 1917/12 = 6 weeks 1918/12 = 6 weeks 1919/6 = 6 weeks 1920/8 = 6 weeks 1921/10 = 6 weeks 1922/10 = 6 weeks 1923/12 = 6 weeks 1924/6 = 6 weeks 1925/11 = 6 weeks 1926/8 = 6 weeks 1927/10 = 6 weeks 1928/12 = 6 weeks 1929/12 = 6 weeks 1999/12 = 5 weeks 2000/12 = 5 weeks 2001/11 = 5 weeks 2002/11 = 5 weeks 2003/12 = 5 weeks 2004/12 = 5 weeks 2005/12 = 5 weeks 2006/12 = 5 weeks 2007/11 = 5 weeks 2008/12 = 5 weeks 2009/12 = 5 weeks 2010/12 = 5 weeks 2011/12 = 5 weeks 2012/11 = 5 weeks 2013/11 = 5 weeks 2014/12 = 5 weeks 2015/12 = 5 weeks 2016/12 = 5 weeks 2017/12 = 5 weeks 2018/11 = 5 weeks 2019/11 = 5 weeks 2020/12 = 5 weeks 2021/12 = 5 weeks 2022/12 = 5 weeks 2023/12 = 5 weeks 2024/11 = 5 weeks 2025/12 = 5 weeks 2026/12 = 5 weeks 2027/12 = 5 weeks 2028/12 = 5 weeks 2029/11 = 5 weeks 2030/11 = 5 weeks 2031/12 = 5 weeks 2032/12 = 5 weeks 2033/12 = 5 weeks 2034/12 = 5 weeks 2035/11 = 5 weeks 2036/12 = 5 weeks 2037/12 = 5 weeks 1930/12 = 5 weeks 1931/12 = 5 weeks 1932/12 = 5 weeks 1933/12 = 5 weeks 1934/11 = 5 weeks 1935/11 = 5 weeks 1936/12 = 5 weeks 1937/12 = 5 weeks 1938/12 = 5 weeks 1939/12 = 5 weeks 1940/11 = 5 weeks 1941/12 = 5 weeks 1942/12 = 5 weeks 1943/12 = 5 weeks 1944/12 = 5 weeks 1945/11 = 5 weeks 1946/11 = 5 weeks 1947/12 = 5 weeks 1948/12 = 5 weeks 1949/12 = 5 weeks 1800/12 = 5 weeks 1801/12 = 5 weeks 1802/12 = 5 weeks 1803/12 = 5 weeks 1804/11 = 5 weeks 1805/11 = 5 weeks 1806/12 = 5 weeks 1807/12 = 5 weeks 1808/12 = 5 weeks 1809/12 = 5 weeks 1810/11 = 5 weeks 1811/11 = 5 weeks 1812/12 = 5 weeks 1813/12 = 5 weeks 1814/12 = 5 weeks 1815/12 = 5 weeks 1816/11 = 5 weeks 1817/12 = 5 weeks 1818/12 = 5 weeks 1819/12 = 5 weeks 1820/12 = 5 weeks 1821/11 = 5 weeks 1822/11 = 5 weeks 1823/12 = 5 weeks 1824/12 = 5 weeks 1825/12 = 5 weeks 1826/12 = 5 weeks 1827/11 = 5 weeks 1828/12 = 5 weeks 1829/12 = 5 weeks 1830/12 = 5 weeks 1831/12 = 5 weeks 1832/11 = 5 weeks 1833/11 = 5 weeks 1834/12 = 5 weeks 1835/12 = 5 weeks 1836/12 = 5 weeks 1837/12 = 5 weeks 1838/11 = 5 weeks 1839/11 = 5 weeks 1840/12 = 5 weeks 1841/12 = 5 weeks 1842/12 = 5 weeks 1843/12 = 5 weeks 1844/11 = 5 weeks 1845/12 = 5 weeks 1846/12 = 5 weeks 1847/12 = 5 weeks 1848/12 = 5 weeks 1849/11 = 5 weeks 1850/11 = 5 weeks 1851/12 = 5 weeks 1852/12 = 5 weeks 1853/12 = 5 weeks 1854/12 = 5 weeks 1855/11 = 5 weeks 1856/12 = 5 weeks 1857/12 = 5 weeks 1858/12 = 5 weeks 1859/12 = 5 weeks 1860/11 = 5 weeks 1861/11 = 5 weeks 1862/12 = 5 weeks 1863/12 = 5 weeks 1864/12 = 5 weeks 1865/12 = 5 weeks 1866/11 = 5 weeks 1867/11 = 5 weeks 1868/12 = 5 weeks 1869/12 = 5 weeks 1870/12 = 5 weeks 1871/12 = 5 weeks 1872/11 = 5 weeks 1873/12 = 5 weeks 1874/12 = 5 weeks 1875/12 = 5 weeks 1876/12 = 5 weeks 1877/11 = 5 weeks 1878/11 = 5 weeks 1879/12 = 5 weeks 1880/12 = 5 weeks 1881/12 = 5 weeks 1882/12 = 5 weeks 1883/11 = 5 weeks 1884/12 = 5 weeks 1885/12 = 5 weeks 1886/12 = 5 weeks 1887/12 = 5 weeks 1888/11 = 5 weeks 1889/11 = 5 weeks 1890/12 = 5 weeks 1891/12 = 5 weeks 1892/12 = 5 weeks 1893/12 = 5 weeks 1894/11 = 5 weeks 1895/11 = 5 weeks 1896/12 = 5 weeks 1897/12 = 5 weeks 1898/12 = 5 weeks 1899/12 = 5 weeks 1900/11 = 5 weeks 1901/11 = 5 weeks 1902/12 = 5 weeks 1903/12 = 5 weeks 1904/12 = 5 weeks 1905/12 = 5 weeks 1906/11 = 5 weeks 1907/11 = 5 weeks 1908/12 = 5 weeks 1909/12 = 5 weeks 1910/12 = 5 weeks 1911/12 = 5 weeks 1912/11 = 5 weeks 1913/12 = 5 weeks 1914/12 = 5 weeks 1915/12 = 5 weeks 1916/12 = 5 weeks 1917/11 = 5 weeks 1918/11 = 5 weeks 1919/12 = 5 weeks 1920/12 = 5 weeks 1921/12 = 5 weeks 1922/12 = 5 weeks 1923/11 = 5 weeks 1924/12 = 5 weeks 1925/12 = 5 weeks 1926/12 = 5 weeks 1927/12 = 5 weeks 1928/11 = 5 weeks 1929/11 = 5 weeks Date-1.4.7/tests/bugs/bug-967.phpt100666 0 0 2127 10530726052 11535 --TEST-- Bug #967: Date_TimeZone uses a bad global variable --FILE-- id . "\n"; // Sets default timezone via Date_TimeZone::setDefault(). Date_TimeZone::setDefault('CST'); $default = 'EST'; $tz = Date_TimeZone::getDefault(); echo 'Date_TimeZone::$id = ' . $tz->id . "\n"; echo '$GLOBALS[\'_DATE_TIMEZONE_DEFAULT\'] = ' . $_DATE_TIMEZONE_DEFAULT . "\n"; ?> --EXPECT-- Date_TimeZone::$id = Pacific/Chatham Date_TimeZone::$id = CST $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = CST Date-1.4.7/tests/bugs/bug-8912.phpt100666 0 0 3467 10530726052 11623 --TEST-- Bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows --FILE-- getTime() . "\n"; $timezone = new Date_TimeZone($state); $new_date->setTZ($originalTimezone); $new_date->convertTZ($timezone); print $state . ': ' . $new_date->getTime() . "\n"; print "\n"; } ?> --EXPECT-- Original Time (Australia/Adelaide): (timestamp) Australia/Adelaide: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Canberra: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Darwin: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Brisbane: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Hobart: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Melbourne: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Perth: (timestamp) Original Time (Australia/Adelaide): (timestamp) Australia/Sydney: (timestamp) Date-1.4.7/tests/bugs/bug-9213.phpt100666 0 0 1445 10530726052 11610 --TEST-- Bug #9213: Date_Calc doesn't like including Date.php --FILE-- beginOfWeek(1, 6, 2006) . "\n"; print $calc->beginOfWeek(1, 6, 2006) . "\n"; print $calc->beginOfNextWeek(1, 6, 2006) . "\n"; print $calc->beginOfWeek() . "\n"; ?> --EXPECT-- 20060529 20060529 20060605 (timestamp) Date-1.4.7/tests/bugs/bug-9414.phpt100666 0 0 2174 10530726052 11613 --TEST-- Bug #9414: Date::addSeconds() fails to work properly with negative numbers --FILE-- format("%Y-%m-%d %H:%M") . "\n"; $date->addSeconds(-1 * 86400 * 7); # subtract 1 week (negative value) print 'After subtracting a week\'s worth of seconds, date is: ' . $date->format("%Y-%m-%d %H:%M") . "\n"; $date->subtractSeconds(-1 * 86400 * 7); # add 1 week (negative value) print 'After subtracting a week\'s worth of seconds, date is: ' . $date->format("%Y-%m-%d %H:%M") . "\n"; ?> --EXPECT-- Date is now: 2006-11-21 00:00 After subtracting a week's worth of seconds, date is: 2006-11-14 00:00 After subtracting a week's worth of seconds, date is: 2006-11-21 00:00 Date-1.4.7/tests/calc.php100666 0 0 45267 10530726052 10247 | // +----------------------------------------------------------------------+ // | This source file is subject to the New BSD license, That is bundled | // | with this package in the file LICENSE, and is available through | // | the world-wide-web at | // | http://www.opensource.org/licenses/bsd-license.php | // | If you did not receive a copy of the new BSDlicense and are unable | // | to obtain it through the world-wide-web, please send a note to | // | pear-dev@lists.php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Daniel Convissor | // +----------------------------------------------------------------------+ /** * Tests for the Date_Calc class * * Any individual tests that fail will have their name, expected result * and actual result printed out. So seeing no output when executing * this file is a good thing. * * Can be run via CLI or a web server. * * This test senses whether it is from an installation of PEAR::Date or if * it's from CVS or a .tar file. If it's an installed version, use the * installed version of Date_Calc. Otherwise, use the local development * copy of Date_Calc. * * @category Date and Time * @package Date * @author Daniel Convissor * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License * @version CVS: $Id: calc.php,v 1.8 2005/11/15 00:16:40 pajoye Exp $ * @link http://pear.php.net/package/Date * @since File available since Release 1.5 */ if ('@include_path@' != '@'.'include_path'.'@') { ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '.' ); } else { ini_set('include_path', realpath(dirname(__FILE__) . '/../') . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } /** * Get the needed class */ require_once 'Date/Calc.php'; /** * Compare the test result to the expected result * * If the test fails, echo out the results. * * @param mixed $expect the scalar or array you expect from the test * @param mixed $actual the scalar or array results from the test * @param string $test_name the name of the test * * @return void */ function compare($expect, $actual, $test_name) { if (is_array($expect)) { if (count(array_diff($actual, $expect))) { echo "$test_name failed. Expect:\n"; print_r($expect); echo "Actual:\n"; print_r($actual); } } else { if ($expect != $actual) { echo "$test_name failed. Expect: $expect. Actual: $actual\n"; } } } if (php_sapi_name() != 'cli') { echo "
\n";
}


compare('20001122', Date_Calc::dateFormat(22, 11, 2000, '%Y%m%d'), 'dateFormat');
compare('20001122', Date_Calc::dateFormat('22', '11', '2000', '%Y%m%d'), 'dateFormat str');

compare('2001', Date_Calc::defaultCentury('1'), 'defaultCentury 1 str');
compare('2001', Date_Calc::defaultCentury(1), 'defaultCentury 1');
compare('1960', Date_Calc::defaultCentury(60), 'defaultCentury 2');
compare('2010', Date_Calc::defaultCentury(10), 'defaultCentury 3');

compare(2451871, Date_Calc::dateToDays('22', '11', '2000'), 'dateToDays str');
compare(2451871, Date_Calc::dateToDays(22, 11, 2000), 'dateToDays');
compare('20001122', Date_Calc::daysToDate(2451871), 'daysToDate');

compare('2000-47-3', Date_Calc::gregorianToISO('22', '11', '2000'), 'gregorianToISO str');
compare('2000-47-3', Date_Calc::gregorianToISO(22, 11, 2000), 'gregorianToISO');
compare(2451716.56767, Date_Calc::dateSeason('SUMMERSOLSTICE', 2000), 'dateSeason');

compare(date('Ymd'), Date_Calc::dateNow(), 'dateNow');
compare(date('Y'), Date_Calc::getYear(), 'getYear');
compare(date('m'), Date_Calc::getMonth(), 'getMonth');
compare(date('d'), Date_Calc::getDay(), 'getDay');

compare(327, Date_Calc::julianDate(22, 11, 2000), 'julianDate');
compare('November', Date_Calc::getMonthFullname(11), 'getMonthFullname');
compare('Nov', Date_Calc::getMonthAbbrname(11), 'getMonthAbbrname');
compare('Saturday', Date_Calc::getWeekdayFullname(1, 1, 2005), 'getWeekdayFullname');
compare('Sat', Date_Calc::getWeekdayAbbrname(1, 1, 2005), 'getWeekdayAbbrname');
compare(11, Date_Calc::getMonthFromFullName('November'), 'getMonthFromFullName');

compare(327, Date_Calc::julianDate('22', '11', '2000'), 'julianDate str');
compare('November', Date_Calc::getMonthFullname('11'), 'getMonthFullname str');
compare('Nov', Date_Calc::getMonthAbbrname('11'), 'getMonthAbbrname str');
compare('Saturday', Date_Calc::getWeekdayFullname('01', '01', '2005'), 'getWeekdayFullname str');
compare('Sat', Date_Calc::getWeekdayAbbrname('01', '01', '2005'), 'getWeekdayAbbrname str');

$exp = array(
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December'
);
compare($exp, Date_Calc::getMonthNames(), 'getMonthNames');

$exp = array(
    'Monday',
    'Tuesday',
    'Wednesday',
    'Thursday',
    'Friday',
    'Saturday',
    'Sunday'
);
compare($exp, Date_Calc::getWeekDays(), 'getWeekDays');

compare(3, Date_Calc::dayOfWeek(22, 11, 2000), 'dayOfWeek');
compare(47, Date_Calc::weekOfYear(22, 11, 2000), 'weekOfYear');
compare(4, Date_Calc::quarterOfYear(22, 11, 2000), 'quarterOfYear');

compare(3, Date_Calc::dayOfWeek('22', '11', '2000'), 'dayOfWeek str');
compare(47, Date_Calc::weekOfYear('22', '11', '2000'), 'weekOfYear str');
compare(4, Date_Calc::quarterOfYear('22', '11', '2000'), 'quarterOfYear str');

compare(28, Date_Calc::daysInMonth(2, 1900), 'daysInMonth 1');
compare(29, Date_Calc::daysInMonth(2, 1996), 'daysInMonth 2');
compare(29, Date_Calc::daysInMonth(2, 2000), 'daysInMonth 3');
compare(28, Date_Calc::daysInMonth(2, 2001), 'daysInMonth 4');
compare(30, Date_Calc::daysInMonth(11, 2000), 'daysInMonth 5');

compare(28, Date_Calc::daysInMonth('02', 1900), 'daysInMonth 1 str');
compare(29, Date_Calc::daysInMonth('02', 1996), 'daysInMonth 2 str');
compare(29, Date_Calc::daysInMonth('02', 2000), 'daysInMonth 3 str');
compare(28, Date_Calc::daysInMonth('02', 2001), 'daysInMonth 4 str');
compare(30, Date_Calc::daysInMonth('11', '2000'), 'daysInMonth 5 str');

compare(5, Date_Calc::weeksInMonth(11, 2000), 'weeksInMonth');
compare(5, Date_Calc::weeksInMonth('11', '2000'), 'weeksInMonth str');


$exp = array(
    '19000226',
    '19000227',
    '19000228',
    '19000301',
    '19000302',
    '19000303',
    '19000304',
);
compare($exp, Date_Calc::getCalendarWeek(27, 2, 1900), 'getCalendarWeek 1');

$exp = array(
    '20000228',
    '20000229',
    '20000301',
    '20000302',
    '20000303',
    '20000304',
    '20000305',
);
compare($exp, Date_Calc::getCalendarWeek(28, 2, 2000), 'getCalendarWeek 2');

$exp = array(
    '20001127',
    '20001128',
    '20001129',
    '20001130',
    '20001201',
    '20001202',
    '20001203'
);
compare($exp, Date_Calc::getCalendarWeek(27, 11, 2000), 'getCalendarWeek 3');
compare($exp, Date_Calc::getCalendarWeek('27', '11', '2000'), 'getCalendarWeek 3 str');

$exp = array(
    array(
        '20001030',
        '20001031',
        '20001101',
        '20001102',
        '20001103',
        '20001104',
    ),
    array(
        '20001105',
        '20001106',
        '20001107',
        '20001108',
        '20001109',
        '20001110',
        '20001111',
    ),
    array(
        '20001112',
        '20001113',
        '20001114',
        '20001115',
        '20001116',
        '20001117',
        '20001118',
    ),
    array(
        '20001119',
        '20001121',
        '20001122',
        '20001123',
        '20001124',
        '20001125',
        '20001126',
    ),
    array(
        '20001127',
        '20001128',
        '20001129',
        '20001130',
        '20001201',
        '20001202',
        '20001203'
    )
);
compare($exp, Date_Calc::getCalendarMonth(11, 2000), 'getCalendarMonth');
compare($exp, Date_Calc::getCalendarMonth('11', '2000'), 'getCalendarMonth str');

// I don't feel like dealing with this right now...
//compare('', Date_Calc::getCalendarYear(2000), 'getCalendarYear');

compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay');
compare('20001123', Date_Calc::nextDay(22, 11, 2000), 'nextDay');
compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay str');
compare('20001123', Date_Calc::nextDay('22', '11', '2000'), 'nextDay str');

compare('20001117', Date_Calc::prevWeekday('19', '11', '2000'), 'prevWeekday 1 str');
compare('20001117', Date_Calc::prevWeekday(19, 11, 2000), 'prevWeekday 1');
compare('20001121', Date_Calc::prevWeekday(22, 11, 2000), 'prevWeekday 2');
compare('20001123', Date_Calc::nextWeekday(22, 11, 2000), 'nextWeekday 1');
compare('20001127', Date_Calc::nextWeekday(24, 11, 2000), 'nextWeekday 2');
compare('20001127', Date_Calc::nextWeekday('24', '11', '2000'), 'nextWeekday 2 str');

compare('20001121', Date_Calc::prevDayOfWeek('2', '22', '11', '2000'), 'prevDayOfWeek 1 str');
compare('20001121', Date_Calc::prevDayOfWeek(2, 22, 11, 2000), 'prevDayOfWeek 1');
compare('20001115', Date_Calc::prevDayOfWeek(3, 22, 11, 2000), 'prevDayOfWeek 2');
compare('20001122', Date_Calc::prevDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'prevDayOfWeek 3');
compare('20001122', Date_Calc::nextDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'nextDayOfWeek 1');
compare('20001129', Date_Calc::nextDayOfWeek(3, 22, 11, 2000), 'nextDayOfWeek 2');
compare('20001123', Date_Calc::nextDayOfWeek(4, 22, 11, 2000), 'nextDayOfWeek 3');
compare('20001123', Date_Calc::nextDayOfWeek('4', '22', '11', '2000'), 'nextDayOfWeek 3 str');

compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore('2', '22', '11', '2000'), 'prevDayOfWeekOnOrBefore 1 str');
compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore(2, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 1');
compare('20001122', Date_Calc::prevDayOfWeekOnOrBefore(3, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 2');
compare('20001122', Date_Calc::nextDayOfWeekOnOrAfter(3, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 1');
compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter(4, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 2');
compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter('4', '22', '11', '2000'), 'nextDayOfWeekOnOrAfter 2 str');

compare('20001120', Date_Calc::beginOfWeek('22', '11', '2000'), 'beginOfWeek str');
compare('20001120', Date_Calc::beginOfWeek(22, 11, 2000), 'beginOfWeek');
compare('20001126', Date_Calc::endOfWeek(22, 11, 2000), 'endOfWeek');
compare('20001126', Date_Calc::endOfWeek('22', '11', '2000'), 'endOfWeek str');

compare('20001113', Date_Calc::beginOfPrevWeek(22, 11, 2000), 'beginOfPrevWeek');
compare('20001127', Date_Calc::beginOfNextWeek(22, 11, 2000), 'beginOfNextWeek');
compare('20001113', Date_Calc::beginOfPrevWeek('22', '11', '2000'), 'beginOfPrevWeek str');
compare('20001127', Date_Calc::beginOfNextWeek('22', '11', '2000'), 'beginOfNextWeek str');

compare('20001101', Date_Calc::beginOfMonth(11, 2000), 'beginOfMonth');
compare('20001101', Date_Calc::beginOfMonth('11', '2000'), 'beginOfMonth str');

compare('20001001', Date_Calc::beginOfPrevMonth(22, 11, 2000), 'beginOfPrevMonth');
compare('20001031', Date_Calc::endOfPrevMonth(22, 11, 2000), 'endOfPrevMonth');
compare('20001001', Date_Calc::beginOfPrevMonth('22', '11', '2000'), 'beginOfPrevMonth str');
compare('20001031', Date_Calc::endOfPrevMonth('22', '11', '2000'), 'endOfPrevMonth str');

compare('20001201', Date_Calc::beginOfNextMonth(22, 11, 2000), 'beginOfNextMonth');
compare('20001231', Date_Calc::endOfNextMonth(22, 11, 2000), 'endOfNextMonth');
compare('20001201', Date_Calc::beginOfNextMonth('22', '11', '2000'), 'beginOfNextMonth str');
compare('20001231', Date_Calc::endOfNextMonth('22', '11', '2000'), 'endOfNextMonth str');

compare('19991001', Date_Calc::beginOfMonthBySpan(-13, 11, 2000), 'beginOfMonthBySpan 1');
compare('20001001', Date_Calc::beginOfMonthBySpan(-1, 11, 2000), 'beginOfMonthBySpan 2');
compare('20001101', Date_Calc::beginOfMonthBySpan(0, 11, 2000), 'beginOfMonthBySpan 3');
compare('20001201', Date_Calc::beginOfMonthBySpan(1, 11, 2000), 'beginOfMonthBySpan 4');
compare('20011201', Date_Calc::beginOfMonthBySpan(13, 11, 2000), 'beginOfMonthBySpan 5');

compare('19990101', Date_Calc::beginOfMonthBySpan('-13', '02', '2000'), 'beginOfMonthBySpan 6 str');
compare('19990101', Date_Calc::beginOfMonthBySpan(-13, 2, 2000), 'beginOfMonthBySpan 6');
compare('20000101', Date_Calc::beginOfMonthBySpan(-1, 2, 2000), 'beginOfMonthBySpan 7');
compare('20000201', Date_Calc::beginOfMonthBySpan(0, 2, 2000), 'beginOfMonthBySpan 8');
compare('20000301', Date_Calc::beginOfMonthBySpan(1, 2, 2000), 'beginOfMonthBySpan 9');
compare('20010301', Date_Calc::beginOfMonthBySpan(13, 2, 2000), 'beginOfMonthBySpan 10');
compare('20010301', Date_Calc::beginOfMonthBySpan('13', '02', '2000'), 'beginOfMonthBySpan 10 str');

compare('19991031', Date_Calc::endOfMonthBySpan(-13, 11, 2000), 'endOfMonthBySpan 1');
compare('20001031', Date_Calc::endOfMonthBySpan(-1, 11, 2000), 'endOfMonthBySpan 2');
compare('20001130', Date_Calc::endOfMonthBySpan(0, 11, 2000), 'endOfMonthBySpan 3');
compare('20001231', Date_Calc::endOfMonthBySpan(1, 11, 2000), 'endOfMonthBySpan 4');
compare('20011231', Date_Calc::endOfMonthBySpan(13, 11, 2000), 'endOfMonthBySpan 5');

compare('19990131', Date_Calc::endOfMonthBySpan('-13', '02', '2000'), 'endOfMonthBySpan 6 str');
compare('19990131', Date_Calc::endOfMonthBySpan(-13, 2, 2000), 'endOfMonthBySpan 6');
compare('20000131', Date_Calc::endOfMonthBySpan(-1, 2, 2000), 'endOfMonthBySpan 7');
compare('20000229', Date_Calc::endOfMonthBySpan(0, 2, 2000), 'endOfMonthBySpan 8');
compare('20000331', Date_Calc::endOfMonthBySpan(1, 2, 2000), 'endOfMonthBySpan 9');
compare('20010331', Date_Calc::endOfMonthBySpan(13, 2, 2000), 'endOfMonthBySpan 10');
compare('20010331', Date_Calc::endOfMonthBySpan('13', '02', '2000'), 'endOfMonthBySpan 10 str');

compare(3, Date_Calc::firstOfMonthWeekday(11, 2000), 'firstOfMonthWeekday');
compare(3, Date_Calc::firstOfMonthWeekday('11', '2000'), 'firstOfMonthWeekday str');

compare('20050101', Date_Calc::NWeekdayOfMonth(1, 6, 1, 2005), 'NWeekdayOfMonth 161');
compare('20050102', Date_Calc::NWeekdayOfMonth(1, 0, 1, 2005), 'NWeekdayOfMonth 101');
compare('20050103', Date_Calc::NWeekdayOfMonth(1, 1, 1, 2005), 'NWeekdayOfMonth 111');
compare('20050104', Date_Calc::NWeekdayOfMonth(1, 2, 1, 2005), 'NWeekdayOfMonth 121');
compare('20050105', Date_Calc::NWeekdayOfMonth(1, 3, 1, 2005), 'NWeekdayOfMonth 131');
compare('20050106', Date_Calc::NWeekdayOfMonth(1, 4, 1, 2005), 'NWeekdayOfMonth 141');
compare('20050107', Date_Calc::NWeekdayOfMonth(1, 5, 1, 2005), 'NWeekdayOfMonth 151');

compare('20050108', Date_Calc::NWeekdayOfMonth('2', '6', '01', '2005'), 'NWeekdayOfMonth 261');
compare('20050109', Date_Calc::NWeekdayOfMonth('2', '0', '01', '2005'), 'NWeekdayOfMonth 201');
compare('20050110', Date_Calc::NWeekdayOfMonth('2', '1', '01', '2005'), 'NWeekdayOfMonth 211');
compare('20050111', Date_Calc::NWeekdayOfMonth('2', '2', '01', '2005'), 'NWeekdayOfMonth 221');
compare('20050112', Date_Calc::NWeekdayOfMonth('2', '3', '01', '2005'), 'NWeekdayOfMonth 231');
compare('20050113', Date_Calc::NWeekdayOfMonth('2', '4', '01', '2005'), 'NWeekdayOfMonth 241');
compare('20050114', Date_Calc::NWeekdayOfMonth('2', '5', '01', '2005'), 'NWeekdayOfMonth 251');

compare('20050131', Date_Calc::NWeekdayOfMonth('last', 1, 1, 2005), 'NWeekdayOfMonth l11');
compare('20050130', Date_Calc::NWeekdayOfMonth('last', 0, 1, 2005), 'NWeekdayOfMonth l01');
compare('20050129', Date_Calc::NWeekdayOfMonth('last', 6, 1, 2005), 'NWeekdayOfMonth l61');
compare('20050128', Date_Calc::NWeekdayOfMonth('last', 5, 1, 2005), 'NWeekdayOfMonth l51');
compare('20050127', Date_Calc::NWeekdayOfMonth('last', 4, 1, 2005), 'NWeekdayOfMonth l41');
compare('20050126', Date_Calc::NWeekdayOfMonth('last', 3, 1, 2005), 'NWeekdayOfMonth l31');
compare('20050125', Date_Calc::NWeekdayOfMonth('last', 2, 1, 2005), 'NWeekdayOfMonth l21');

compare('20050331', Date_Calc::NWeekdayOfMonth('last', 4, 3, 2005), 'NWeekdayOfMonth l43');
compare('20050330', Date_Calc::NWeekdayOfMonth('last', 3, 3, 2005), 'NWeekdayOfMonth l33');
compare('20050329', Date_Calc::NWeekdayOfMonth('last', 2, 3, 2005), 'NWeekdayOfMonth l23');
compare('20050328', Date_Calc::NWeekdayOfMonth('last', 1, 3, 2005), 'NWeekdayOfMonth l13');
compare('20050327', Date_Calc::NWeekdayOfMonth('last', 0, 3, 2005), 'NWeekdayOfMonth l03');
compare('20050326', Date_Calc::NWeekdayOfMonth('last', 6, 3, 2005), 'NWeekdayOfMonth l63');
compare('20050325', Date_Calc::NWeekdayOfMonth('last', 5, 3, 2005), 'NWeekdayOfMonth l53');


compare(false, Date_Calc::isValidDate(29, 2, 1900), 'isValidDate 1');
compare(true, Date_Calc::isValidDate(29, 2, 2000), 'isValidDate 2');
compare(true, Date_Calc::isValidDate('29', '02', '2000'), 'isValidDate 2 str');

compare(false, Date_Calc::isLeapYear(1900), 'isLeapYear 1');
compare(true, Date_Calc::isLeapYear(1996), 'isLeapYear 2');
compare(true, Date_Calc::isLeapYear(2000), 'isLeapYear 3');
compare(false, Date_Calc::isLeapYear(2001), 'isLeapYear 4');
compare(false, Date_Calc::isLeapYear('2001'), 'isLeapYear 4 str');

compare(false, Date_Calc::isFutureDate('22', '11', '2000'), 'isFutureDate 1 str');
compare(false, Date_Calc::isFutureDate(22, 11, 2000), 'isFutureDate 1');
compare(true, Date_Calc::isFutureDate(22, 11, date('Y') + 1), 'isFutureDate 2');

compare(false, Date_Calc::isPastDate(22, 11, date('Y') + 1), 'isPastDate 1');
compare(true, Date_Calc::isPastDate(22, 11, 2000), 'isPastDate 2');
compare(true, Date_Calc::isPastDate('22', '11', '2000'), 'isPastDate 2 str');

compare(10, Date_Calc::dateDiff(22, 11, 2000, 12, 11, 2000), 'dateDiff 1');
compare(10, Date_Calc::dateDiff(12, 11, 2000, 22, 11, 2000), 'dateDiff 2');
compare(61, Date_Calc::dateDiff(22, 11, 2000, 22, 1, 2001), 'dateDiff 3');
compare(61, Date_Calc::dateDiff('22', '11', '2000', '22', '01', '2001'), 'dateDiff 3 str');

compare(-1, Date_Calc::compareDates(12, 11, 2000, 22, 11, 2000), 'compareDates 1');
compare(0, Date_Calc::compareDates(22, 11, 2000, 22, 11, 2000), 'compareDates 2');
compare(1, Date_Calc::compareDates(22, 11, 2000, 12, 11, 2000), 'compareDates 3');
compare(1, Date_Calc::compareDates('22', '11', '2000', '12', '11', '2000'), 'compareDates 3 str');
Date-1.4.7/tests/testunit.php100666      0      0        3005 10530726052  11164                                |
// +----------------------------------------------------------------------+
//
// $Id: testunit.php,v 1.2 2005/11/15 00:16:40 pajoye Exp $

/**
 * Displays all test cases on the same page
 *
 * @package Date
 * @author Marshall Roch 
 */


echo "
";
require_once 'PHPUnit.php';
require_once 'testunit_date.php';
require_once 'testunit_date_span.php';
echo "
"; ?> Date-1.4.7/tests/testunit_date.php100666 0 0 20503 10530726052 12203 | // +----------------------------------------------------------------------+ // // $Id: testunit_date.php,v 1.3 2005/11/15 00:16:40 pajoye Exp $ // require_once 'Date.php'; require_once 'PHPUnit.php'; class myDate extends Date { function myDate($date) { $this->Date($date); } } /** * Test case for Date * * @package Date * @author Marshall Roch */ class Date_Test extends PHPUnit_TestCase { var $time; function Date_Test($name) { $this->PHPUnit_TestCase($name); } function setUp() { $this->time = new Date("2003-10-04 14:03:24"); } function tearDown() { unset($this->time); } function testDateNull() { $time = new Date(); $this->assertEquals( date('Y-m-d H:i:s'), sprintf('%04d-%02d-%02d %02d:%02d:%02d', $time->year, $time->month, $time->day, $time->hour, $time->minute, $time->second) ); } function testAbstraction() { $d = new Date(); $my = new myDate($d); $this->assertEquals($d->getDate(),$my->getDate()); } function testDateCopy() { $temp = new Date($this->time); $this->assertEquals($temp, $this->time); } function testDateISO() { $temp = new Date("2003-10-04 14:03:24"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $temp->year, $temp->month, $temp->day, $temp->hour, $temp->minute, $temp->second) ); } function testDateISOBasic() { $temp = new Date("20031004T140324"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $temp->year, $temp->month, $temp->day, $temp->hour, $temp->minute, $temp->second) ); } function testDateISOExtended() { $temp = new Date("2003-10-04T14:03:24"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $temp->year, $temp->month, $temp->day, $temp->hour, $temp->minute, $temp->second) ); } function testDateISOTimestamp() { $temp = new Date("20031004140324"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $temp->year, $temp->month, $temp->day, $temp->hour, $temp->minute, $temp->second) ); } function testDateUnixtime() { $temp = new Date(strtotime("2003-10-04 14:03:24")); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $temp->year, $temp->month, $temp->day, $temp->hour, $temp->minute, $temp->second) ); } function testSetDateISO() { $this->time->setDate("2003-10-04 14:03:24"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $this->time->year, $this->time->month, $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetDateISOBasic() { $this->time->setDate("20031004T140324"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $this->time->year, $this->time->month, $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetDateISOExtended() { $this->time->setDate("2003-10-04T14:03:24"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $this->time->year, $this->time->month, $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetDateTimestamp() { $this->time->setDate("20031004140324"); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $this->time->year, $this->time->month, $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetDateUnixtime() { $this->time->setDate(strtotime("2003-10-04 14:03:24")); $this->assertEquals( '2003-10-04 14:03:24', sprintf('%04d-%02d-%02d %02d:%02d:%02d', $this->time->year, $this->time->month, $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testGetDateISO() { $date = $this->time->getDate(DATE_FORMAT_ISO); $this->assertEquals('2003-10-04 14:03:24', $date); } function testGetDateISOBasic() { $date = $this->time->getDate(DATE_FORMAT_ISO_BASIC); $this->assertEquals('20031004T140324Z', $date); } function testGetDateISOExtended() { $date = $this->time->getDate(DATE_FORMAT_ISO_EXTENDED); $this->assertEquals('2003-10-04T14:03:24Z', $date); } function testGetDateTimestamp() { $date = $this->time->getDate(DATE_FORMAT_TIMESTAMP); $this->assertEquals('20031004140324', $date); } function testGetDateUnixtime() { $date = $this->time->getDate(DATE_FORMAT_UNIXTIME); $this->assertEquals(strtotime('2003-10-04 14:03:24'), $date); } function testFormat() { $codes = array( 'a' => 'Sat', 'A' => 'Saturday', 'b' => 'Oct', 'B' => 'October', 'C' => '20', 'd' => '04', 'D' => '10/04/2003', 'e' => '4', 'H' => '14', 'I' => '02', 'j' => '277', 'm' => '10', 'M' => '03', 'n' => "\n", 'O' => '+00:00', 'o' => '+00:00', 'p' => 'pm', 'P' => 'PM', 'r' => '02:03:24 PM', 'R' => '14:03', 'S' => '24', 't' => "\t", 'T' => '14:03:24', 'w' => '6', 'U' => '40', 'y' => '03', 'Y' => '2003', '%' => '%' ); foreach ($codes as $code => $expected) { $this->assertEquals( "$code: $expected", $this->time->format("$code: %$code") ); } } function testToUTCbyOffset() { $this->time->setTZbyID('EST'); $this->time->toUTC(); $temp = new Date("2003-10-04 14:03:24"); $temp->toUTCbyOffset("-05:00"); $this->assertEquals($temp, $this->time); } } // runs the tests $suite = new PHPUnit_TestSuite("Date_Test"); $result = PHPUnit::run($suite); // prints the tests echo $result->toString(); ?> Date-1.4.7/tests/testunit_date_span.php100666 0 0 13260 10530726052 13226 | // +----------------------------------------------------------------------+ // // $Id: testunit_date_span.php,v 1.4 2005/11/15 00:16:40 pajoye Exp $ // require_once 'Date.php'; require_once 'Date/Span.php'; require_once 'PHPUnit.php'; /** * Test case for Date_Span * * @package Date * @author Leandro Lucarella */ class Date_SpanTest extends PHPUnit_TestCase { var $time; function Date_SpanTest($name) { $this->PHPUnit_TestCase($name); } function setUp() { $this->time = new Date_Span(97531); } function tearDown() { unset($this->time); } function testSetFromArray() { $this->time->setFromArray(array(5, 48.5, 28.5, 31)); $this->assertEquals( '7:0:59:1', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetFromString() { $this->time->setFromString('5:00:59:31'); $this->assertEquals( '5:0:59:31', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetFromSeconds() { $this->time->setFromSeconds(434344); $this->assertEquals( '5:0:39:4', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetFromMinutes() { $this->time->setFromMinutes(7860.0166666666); $this->assertEquals( '5:11:0:1', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetFromHours() { $this->time->setFromHours(50.12345); $this->assertEquals( '2:2:7:24', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetFromDays() { $this->time->setFromDays(pi()); $this->assertEquals( '3:3:23:54', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testSetFromDateDiff() { $this->time->setFromDateDiff( new Date('2004-03-10 01:15:59'), new Date('2003-03-10 00:10:50') ); $this->assertEquals( '366:1:5:9', sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second) ); } function testCopy() { $time = new Date_Span(); $time->copy($this->time); $this->assertEquals( sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour, $this->time->minute, $this->time->second), sprintf('%d:%d:%d:%d', $time->day, $time->hour, $time->minute, $time->second) ); } function testFormat() { $codes = array( 'C' => '1, 03:05:31', 'd' => '1.1288310185185', 'D' => '1', 'e' => '27.091944444444', 'f' => '1625.5166666667', 'g' => '97531', 'h' => '3', 'H' => '03', 'i' => '3', 'I' => '03', 'm' => '5', 'M' => '05', 'n' => "\n", 'p' => 'am', 'P' => 'AM', 'r' => '03:05:31 am', 'R' => '03:05', 's' => '31', 'S' => '31', 't' => "\t", 'T' => '03:05:31', '%' => '%', ); foreach ($codes as $code => $expected) { $this->assertEquals( "$code: $expected", $this->time->format("$code: %$code") ); } } function testAdd() { $this->time->add(new Date_Span(6000)); $result = $this->time->toSeconds(); $expected = 103531; $this->assertEquals($expected, $result); } function testSubtract() { $this->time->subtract(new Date_Span(6000)); $result = $this->time->toSeconds(); $expected = 91531; $this->assertEquals($expected, $result); } } // runs the tests $suite = new PHPUnit_TestSuite("Date_SpanTest"); $result = PHPUnit::run($suite); // prints the tests echo $result->toString(); ?> Date-1.4.7/tests/test_calc.php100666 0 0 2502 10530726052 11247 $iso){ $year = substr($date,0,4); $month = substr($date,4,2); $day = substr($date,6); $iso9601 = Date_Calc::gregorianToISO($day,$month,$year); if($iso9601!=$iso){ $failed_test_data = true; echo $date . '(' . $iso . ') =>' . $year.'-'.$month.'-'.$day .'=>' . $iso9601 . " : failed\n"; } } /** * Bugs #19788 */ $failed_test_19788 = false; $pass1 = 2==Date_Calc::weekOfYear(5,1,1998)?true:false; $pass2 = 2==Date_Calc::weekOfYear(6,1,1998)?true:false; $pass3 = 2==Date_Calc::weekOfYear(5,1,2004)?true:false; $pass4 = 2==Date_Calc::weekOfYear(6,1,2004)?true:false; if( !($pass1 && $pass2 && $pass3 && $pass4) ){ $failed_test_19788 = true; } if($failed_test_19788 || $failed_test_data){ echo "Bug #19788: failed\n"; } else { echo "Bug #19788: OK\n"; } ?> Date-1.4.7/tests/test_date_methods_span.php100666 0 0 5345 10530726052 14036 | // +----------------------------------------------------------------------+ // // $Id: test_date_methods_span.php,v 1.2 2005/11/15 00:16:40 pajoye Exp $ // require_once 'Date.php'; require_once 'Date/Span.php'; $date = new Date(); $tmp = new Date($date); printf("Actual date: %s\n", $date->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('0:00:00:05')); printf("Subtracting 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('0:00:20:00')); printf("Subtracting 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('0:10:00:00')); printf("Subtracting 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('3:00:00:00')); printf("Subtracting 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('3:10:20:05')); printf("Subtracting 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('0:00:00:05')); printf("Adding 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('0:00:20:00')); printf("Adding 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('0:10:00:00')); printf("Adding 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('3:00:00:00')); printf("Adding 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('3:10:20:05')); printf("Adding 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); ?> Date-1.4.7/Date.php100666 0 0 122557 10530726052 7076 * @author Pierre-Alain Joye * @author Firman Wandayandi * @copyright 1997-2006 Baba Buehler, Pierre-Alain Joye * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version CVS: $Id: Date.php,v 1.41 2006/11/22 00:28:03 firman Exp $ * @link http://pear.php.net/package/Date */ // }}} // {{{ Includes /** * Load Date_TimeZone. */ require_once 'Date/TimeZone.php'; /** * Load Date_Calc. */ require_once 'Date/Calc.php'; /** * Load Date_Span. */ require_once 'Date/Span.php'; // }}} // {{{ Constants // {{{ Output formats Pass this to getDate(). /** * "YYYY-MM-DD HH:MM:SS" */ define('DATE_FORMAT_ISO', 1); /** * "YYYYMMSSTHHMMSS(Z|(+/-)HHMM)?" */ define('DATE_FORMAT_ISO_BASIC', 2); /** * "YYYY-MM-SSTHH:MM:SS(Z|(+/-)HH:MM)?" */ define('DATE_FORMAT_ISO_EXTENDED', 3); /** * "YYYY-MM-SSTHH:MM:SS(.S*)?(Z|(+/-)HH:MM)?" */ define('DATE_FORMAT_ISO_EXTENDED_MICROTIME', 6); /** * "YYYYMMDDHHMMSS" */ define('DATE_FORMAT_TIMESTAMP', 4); /** * long int, seconds since the unix epoch */ define('DATE_FORMAT_UNIXTIME', 5); // }}} // }}} // {{{ Class: Date /** * Generic date handling class for PEAR * * Generic date handling class for PEAR. Attempts to be time zone aware * through the Date::TimeZone class. Supports several operations from * Date::Calc on Date objects. * * @author Baba Buehler * @author Pierre-Alain Joye * @author Firman Wandayandi * @copyright 1997-2006 Baba Buehler, Pierre-Alain Joye * @license http://www.opensource.org/licenses/bsd-license.php * BSD License * @version Release: 1.4.7 * @link http://pear.php.net/package/Date */ class Date { // {{{ Properties /** * the year * @var int */ var $year; /** * the month * @var int */ var $month; /** * the day * @var int */ var $day; /** * the hour * @var int */ var $hour; /** * the minute * @var int */ var $minute; /** * the second * @var int */ var $second; /** * the parts of a second * @var float */ var $partsecond; /** * timezone for this date * @var object Date_TimeZone */ var $tz; /** * define the default weekday abbreviation length * used by ::format() * @var int */ var $getWeekdayAbbrnameLength = 3; // }}} // {{{ Constructor /** * Constructor * * Creates a new Date Object initialized to the current date/time in the * system-default timezone by default. A date optionally * passed in may be in the ISO 8601, TIMESTAMP or UNIXTIME format, * or another Date object. If no date is passed, the current date/time * is used. * * @access public * @see setDate() * @param mixed $date optional - date/time to initialize * @return object Date the new Date object */ function Date($date = null) { $this->tz = Date_TimeZone::getDefault(); if (is_null($date)) { $this->setDate(date("Y-m-d H:i:s")); } elseif (is_a($date, 'Date')) { $this->copy($date); } else { $this->setDate($date); } } // }}} // {{{ setDate() /** * Set the fields of a Date object based on the input date and format * * Set the fields of a Date object based on the input date and format, * which is specified by the DATE_FORMAT_* constants. * * @access public * @param string $date input date * @param int $format Optional format constant (DATE_FORMAT_*) of the input date. * This parameter isn't really needed anymore, but you could * use it to force DATE_FORMAT_UNIXTIME. */ function setDate($date, $format = DATE_FORMAT_ISO) { if ( preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)?$/i', $date, $regs) && $format != DATE_FORMAT_UNIXTIME) { // DATE_FORMAT_ISO, ISO_BASIC, ISO_EXTENDED, and TIMESTAMP // These formats are extremely close to each other. This regex // is very loose and accepts almost any butchered format you could // throw at it. e.g. 2003-10-07 19:45:15 and 2003-10071945:15 // are the same thing in the eyes of this regex, even though the // latter is not a valid ISO 8601 date. $this->year = $regs[1]; $this->month = $regs[2]; $this->day = $regs[3]; $this->hour = isset($regs[5])?$regs[5]:0; $this->minute = isset($regs[6])?$regs[6]:0; $this->second = isset($regs[7])?$regs[7]:0; $this->partsecond = isset($regs[8])?(float)$regs[8]:(float)0; // if an offset is defined, convert time to UTC // Date currently can't set a timezone only by offset, // so it has to store it as UTC if (isset($regs[9])) { $this->toUTCbyOffset($regs[9]); } } elseif (is_numeric($date)) { // UNIXTIME $this->setDate(date("Y-m-d H:i:s", $date)); } else { // unknown format $this->year = 0; $this->month = 1; $this->day = 1; $this->hour = 0; $this->minute = 0; $this->second = 0; $this->partsecond = (float)0; } } // }}} // {{{ getDate() /** * Get a string (or other) representation of this date * * Get a string (or other) representation of this date in the * format specified by the DATE_FORMAT_* constants. * * @access public * @param int $format format constant (DATE_FORMAT_*) of the output date * @return string the date in the requested format */ function getDate($format = DATE_FORMAT_ISO) { switch ($format) { case DATE_FORMAT_ISO: return $this->format("%Y-%m-%d %T"); break; case DATE_FORMAT_ISO_BASIC: $format = "%Y%m%dT%H%M%S"; if ($this->tz->getID() == 'UTC') { $format .= "Z"; } return $this->format($format); break; case DATE_FORMAT_ISO_EXTENDED: $format = "%Y-%m-%dT%H:%M:%S"; if ($this->tz->getID() == 'UTC') { $format .= "Z"; } return $this->format($format); break; case DATE_FORMAT_ISO_EXTENDED_MICROTIME: $format = "%Y-%m-%dT%H:%M:%s"; if ($this->tz->getID() == 'UTC') { $format .= "Z"; } return $this->format($format); break; case DATE_FORMAT_TIMESTAMP: return $this->format("%Y%m%d%H%M%S"); break; case DATE_FORMAT_UNIXTIME: return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year); break; } } // }}} // {{{ copy() /** * Copy values from another Date object * * Makes this Date a copy of another Date object. * * @access public * @param object Date $date Date to copy from */ function copy($date) { $this->year = $date->year; $this->month = $date->month; $this->day = $date->day; $this->hour = $date->hour; $this->minute = $date->minute; $this->second = $date->second; $this->tz = $date->tz; } // }}} // {{{ format() /** * Date pretty printing, similar to strftime() * * Formats the date in the given format, much like * strftime(). Most strftime() options are supported.

* * formatting options:

* * %a abbreviated weekday name (Sun, Mon, Tue)
* %A full weekday name (Sunday, Monday, Tuesday)
* %b abbreviated month name (Jan, Feb, Mar)
* %B full month name (January, February, March)
* %C century number (the year divided by 100 and truncated to an integer, range 00 to 99)
* %d day of month (range 00 to 31)
* %D same as "%m/%d/%y"
* %e day of month, single digit (range 0 to 31)
* %E number of days since unspecified epoch (integer, Date_Calc::dateToDays())
* %H hour as decimal number (00 to 23)
* %I hour as decimal number on 12-hour clock (01 to 12)
* %j day of year (range 001 to 366)
* %m month as decimal number (range 01 to 12)
* %M minute as a decimal number (00 to 59)
* %n newline character (\n)
* %O dst-corrected timezone offset expressed as "+/-HH:MM"
* %o raw timezone offset expressed as "+/-HH:MM"
* %p either 'am' or 'pm' depending on the time
* %P either 'AM' or 'PM' depending on the time
* %r time in am/pm notation, same as "%I:%M:%S %p"
* %R time in 24-hour notation, same as "%H:%M"
* %s seconds including the decimal representation smaller than one second
* %S seconds as a decimal number (00 to 59)
* %t tab character (\t)
* %T current time, same as "%H:%M:%S"
* %w weekday as decimal (0 = Sunday)
* %U week number of current year, first sunday as first week
* %y year as decimal (range 00 to 99)
* %Y year as decimal including century (range 0000 to 9999)
* %% literal '%'
*
* * @access public * @param string format the format string for returned date/time * @return string date/time in given format */ function format($format) { $output = ""; for($strpos = 0; $strpos < strlen($format); $strpos++) { $char = substr($format,$strpos,1); if ($char == "%") { $nextchar = substr($format,$strpos + 1,1); switch ($nextchar) { case "a": $output .= Date_Calc::getWeekdayAbbrname($this->day,$this->month,$this->year, $this->getWeekdayAbbrnameLength); break; case "A": $output .= Date_Calc::getWeekdayFullname($this->day,$this->month,$this->year); break; case "b": $output .= Date_Calc::getMonthAbbrname($this->month); break; case "B": $output .= Date_Calc::getMonthFullname($this->month); break; case "C": $output .= sprintf("%02d",intval($this->year/100)); break; case "d": $output .= sprintf("%02d",$this->day); break; case "D": $output .= sprintf("%02d/%02d/%02d",$this->month,$this->day,$this->year); break; case "e": $output .= $this->day * 1; // get rid of leading zero break; case "E": $output .= Date_Calc::dateToDays($this->day,$this->month,$this->year); break; case "H": $output .= sprintf("%02d", $this->hour); break; case 'h': $output .= sprintf("%d", $this->hour); break; case "I": $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour; $output .= sprintf("%02d", $hour==0 ? 12 : $hour); break; case "i": $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour; $output .= sprintf("%d", $hour==0 ? 12 : $hour); break; case "j": $output .= Date_Calc::julianDate($this->day,$this->month,$this->year); break; case "m": $output .= sprintf("%02d",$this->month); break; case "M": $output .= sprintf("%02d",$this->minute); break; case "n": $output .= "\n"; break; case "O": $offms = $this->tz->getOffset($this); $direction = $offms >= 0 ? "+" : "-"; $offmins = abs($offms) / 1000 / 60; $hours = $offmins / 60; $minutes = $offmins % 60; $output .= sprintf("%s%02d:%02d", $direction, $hours, $minutes); break; case "o": $offms = $this->tz->getRawOffset($this); $direction = $offms >= 0 ? "+" : "-"; $offmins = abs($offms) / 1000 / 60; $hours = $offmins / 60; $minutes = $offmins % 60; $output .= sprintf("%s%02d:%02d", $direction, $hours, $minutes); break; case "p": $output .= $this->hour >= 12 ? "pm" : "am"; break; case "P": $output .= $this->hour >= 12 ? "PM" : "AM"; break; case "r": $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour; $output .= sprintf("%02d:%02d:%02d %s", $hour==0 ? 12 : $hour, $this->minute, $this->second, $this->hour >= 12 ? "PM" : "AM"); break; case "R": $output .= sprintf("%02d:%02d", $this->hour, $this->minute); break; case "s": $output .= str_replace(',', '.', sprintf("%09f", (float)((float)$this->second + $this->partsecond))); break; case "S": $output .= sprintf("%02d", $this->second); break; case "t": $output .= "\t"; break; case "T": $output .= sprintf("%02d:%02d:%02d", $this->hour, $this->minute, $this->second); break; case "w": $output .= Date_Calc::dayOfWeek($this->day,$this->month,$this->year); break; case "U": $output .= Date_Calc::weekOfYear($this->day,$this->month,$this->year); break; case "y": $output .= substr($this->year,2,2); break; case "Y": $output .= $this->year; break; case "Z": $output .= $this->tz->inDaylightTime($this) ? $this->tz->getDSTShortName() : $this->tz->getShortName(); break; case "%": $output .= "%"; break; default: $output .= $char.$nextchar; } $strpos++; } else { $output .= $char; } } return $output; } // }}} // {{{ getTime() /** * Get this date/time in Unix time() format * * Get a representation of this date in Unix time() format. This may only be * valid for dates from 1970 to ~2038. * * @access public * @return int number of seconds since the unix epoch */ function getTime() { return $this->getDate(DATE_FORMAT_UNIXTIME); } // }}} // {{{ setTZ() /** * Sets the time zone of this Date * * Sets the time zone of this date with the given * Date_TimeZone object. Does not alter the date/time, * only assigns a new time zone. For conversion, use * convertTZ(). * * @access public * @param object Date_TimeZone $tz the Date_TimeZone object to use, if called * with a paramater that is not a Date_TimeZone object, will fall through to * setTZbyID(). */ function setTZ($tz) { if(is_a($tz, 'Date_Timezone')) { $this->tz = $tz; } else { $this->setTZbyID($tz); } } // }}} // {{{ setTZbyID() /** * Sets the time zone of this date with the given time zone id * * Sets the time zone of this date with the given * time zone id, or to the system default if the * given id is invalid. Does not alter the date/time, * only assigns a new time zone. For conversion, use * convertTZ(). * * @access public * @param string id a time zone id */ function setTZbyID($id) { if (Date_TimeZone::isValidID($id)) { $this->tz = new Date_TimeZone($id); } else { $this->tz = Date_TimeZone::getDefault(); } } // }}} // {{{ inDaylightTime() /** * Tests if this date/time is in DST * * Returns true if daylight savings time is in effect for * this date in this date's time zone. See Date_TimeZone::inDaylightTime() * for compatability information. * * @access public * @return boolean true if DST is in effect for this date */ function inDaylightTime() { return $this->tz->inDaylightTime($this); } // }}} // {{{ toUTC() /** * Converts this date to UTC and sets this date's timezone to UTC * * Converts this date to UTC and sets this date's timezone to UTC * * @access public */ function toUTC() { if ($this->tz->getOffset($this) > 0) { $this->subtractSeconds(intval($this->tz->getOffset($this) / 1000)); } else { $this->addSeconds(intval(abs($this->tz->getOffset($this)) / 1000)); } $this->tz = new Date_TimeZone('UTC'); } // }}} // {{{ convertTZ() /** * Converts this date to a new time zone * * Converts this date to a new time zone. * WARNING: This may not work correctly if your system does not allow * putenv() or if localtime() does not work in your environment. See * Date::TimeZone::inDaylightTime() for more information. * * @access public * @param object Date_TimeZone $tz the Date::TimeZone object for the conversion time zone */ function convertTZ($tz) { // convert to UTC if ($this->tz->getOffset($this) > 0) { $this->subtractSeconds(intval(abs($this->tz->getOffset($this)) / 1000)); } else { $this->addSeconds(intval(abs($this->tz->getOffset($this)) / 1000)); } // convert UTC to new timezone if ($tz->getOffset($this) > 0) { $this->addSeconds(intval(abs($tz->getOffset($this)) / 1000)); } else { $this->subtractSeconds(intval(abs($tz->getOffset($this)) / 1000)); } $this->tz = $tz; } // }}} // {{{ convertTZbyID() /** * Converts this date to a new time zone, given a valid time zone ID * * Converts this date to a new time zone, given a valid time zone ID * WARNING: This may not work correctly if your system does not allow * putenv() or if localtime() does not work in your environment. See * Date::TimeZone::inDaylightTime() for more information. * * @access public * @param string id a time zone id */ function convertTZbyID($id) { if (Date_TimeZone::isValidID($id)) { $tz = new Date_TimeZone($id); } else { $tz = Date_TimeZone::getDefault(); } $this->convertTZ($tz); } // }}} // {{{ toUTCbyOffset() function toUTCbyOffset($offset) { if ($offset == "Z" || $offset == "+00:00" || $offset == "+0000") { $this->toUTC(); return true; } if (preg_match('/([\+\-])(\d{2}):?(\d{2})/', $offset, $regs)) { // convert offset to seconds $hours = (int) isset($regs[2])?$regs[2]:0; $mins = (int) isset($regs[3])?$regs[3]:0; $offset = ($hours * 3600) + ($mins * 60); if (isset($regs[1]) && $regs[1] == "-") { $offset *= -1; } if ($offset > 0) { $this->subtractSeconds(intval($offset)); } else { $this->addSeconds(intval(abs($offset))); } $this->tz = new Date_TimeZone('UTC'); return true; } return false; } // }}} // {{{ addSeconds() /** * Adds a given number of seconds to the date * * Adds a given number of seconds to the date * * @access public * @param int $sec the number of seconds to add */ function addSeconds($sec) { settype($sec, 'int'); // Negative value given. if ($sec < 0) { $this->subtractSeconds(abs($sec)); return; } $this->addSpan(new Date_Span($sec)); } // }}} // {{{ addSpan() /** * Adds a time span to the date * * Adds a time span to the date * * @access public * @param object Date_Span $span the time span to add */ function addSpan($span) { if (!is_a($span, 'Date_Span')) { return; } $this->second += $span->second; if ($this->second >= 60) { $this->minute++; $this->second -= 60; } $this->minute += $span->minute; if ($this->minute >= 60) { $this->hour++; if ($this->hour >= 24) { list($this->year, $this->month, $this->day) = sscanf(Date_Calc::nextDay($this->day, $this->month, $this->year), "%04s%02s%02s"); $this->hour -= 24; } $this->minute -= 60; } $this->hour += $span->hour; if ($this->hour >= 24) { list($this->year, $this->month, $this->day) = sscanf(Date_Calc::nextDay($this->day, $this->month, $this->year), "%04s%02s%02s"); $this->hour -= 24; } $d = Date_Calc::dateToDays($this->day, $this->month, $this->year); $d += $span->day; list($this->year, $this->month, $this->day) = sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s"); $this->year = intval($this->year); $this->month = intval($this->month); $this->day = intval($this->day); } // }}} // {{{ subtractSeconds() /** * Subtracts a given number of seconds from the date * * Subtracts a given number of seconds from the date * * @access public * @param int $sec the number of seconds to subtract */ function subtractSeconds($sec) { settype($sec, 'int'); // Negative value given. if ($sec < 0) { $this->addSeconds(abs($sec)); return; } $this->subtractSpan(new Date_Span($sec)); } // }}} // {{{ subtractSpan() /** * Subtracts a time span to the date * * Subtracts a time span to the date * * @access public * @param object Date_Span $span the time span to subtract */ function subtractSpan($span) { if (!is_a($span, 'Date_Span')) { return; } if ($span->isEmpty()) { return; } $this->second -= $span->second; if ($this->second < 0) { $this->minute--; $this->second += 60; } $this->minute -= $span->minute; if ($this->minute < 0) { $this->hour--; if ($this->hour < 0) { list($this->year, $this->month, $this->day) = sscanf(Date_Calc::prevDay($this->day, $this->month, $this->year), "%04s%02s%02s"); $this->hour += 24; } $this->minute += 60; } $this->hour -= $span->hour; if ($this->hour < 0) { list($this->year, $this->month, $this->day) = sscanf(Date_Calc::prevDay($this->day, $this->month, $this->year), "%04s%02s%02s"); $this->hour += 24; } $d = Date_Calc::dateToDays($this->day, $this->month, $this->year); $d -= $span->day; list($this->year, $this->month, $this->day) = sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s"); $this->year = intval($this->year); $this->month = intval($this->month); $this->day = intval($this->day); } // }}} // {{{ compare() /** * Compares two dates * * Compares two dates. Suitable for use * in sorting functions. * * @access public * @param object Date $d1 the first date * @param object Date $d2 the second date * @return int 0 if the dates are equal, -1 if d1 is before d2, 1 if d1 is after d2 */ function compare($d1, $d2) { $d1->convertTZ(new Date_TimeZone('UTC')); $d2->convertTZ(new Date_TimeZone('UTC')); $days1 = Date_Calc::dateToDays($d1->day, $d1->month, $d1->year); $days2 = Date_Calc::dateToDays($d2->day, $d2->month, $d2->year); if ($days1 < $days2) return -1; if ($days1 > $days2) return 1; if ($d1->hour < $d2->hour) return -1; if ($d1->hour > $d2->hour) return 1; if ($d1->minute < $d2->minute) return -1; if ($d1->minute > $d2->minute) return 1; if ($d1->second < $d2->second) return -1; if ($d1->second > $d2->second) return 1; return 0; } // }}} // {{{ before() /** * Test if this date/time is before a certain date/time * * Test if this date/time is before a certain date/time * * @access public * @param object Date $when the date to test against * @return boolean true if this date is before $when */ function before($when) { if (Date::compare($this,$when) == -1) { return true; } else { return false; } } // }}} // {{{ after() /** * Test if this date/time is after a certian date/time * * Test if this date/time is after a certian date/time * * @access public * @param object Date $when the date to test against * @return boolean true if this date is after $when */ function after($when) { if (Date::compare($this,$when) == 1) { return true; } else { return false; } } // }}} // {{{ equals() /** * Test if this date/time is exactly equal to a certian date/time * * Test if this date/time is exactly equal to a certian date/time * * @access public * @param object Date $when the date to test against * @return boolean true if this date is exactly equal to $when */ function equals($when) { if (Date::compare($this,$when) == 0) { return true; } else { return false; } } // }}} // {{{ isFuture() /** * Determine if this date is in the future * * Determine if this date is in the future * * @access public * @return boolean true if this date is in the future */ function isFuture() { $now = new Date(); if ($this->after($now)) { return true; } else { return false; } } // }}} // {{{ isPast() /** * Determine if this date is in the past * * Determine if this date is in the past * * @access public * @return boolean true if this date is in the past */ function isPast() { $now = new Date(); if ($this->before($now)) { return true; } else { return false; } } // }}} // {{{ isLeapYear() /** * Determine if the year in this date is a leap year * * Determine if the year in this date is a leap year * * @access public * @return boolean true if this year is a leap year */ function isLeapYear() { return Date_Calc::isLeapYear($this->year); } // }}} // {{{ getJulianDate() /** * Get the Julian date for this date * * Get the Julian date for this date * * @access public * @return int the Julian date */ function getJulianDate() { return Date_Calc::julianDate($this->day, $this->month, $this->year); } // }}} // {{{ getDayOfWeek() /** * Gets the day of the week for this date * * Gets the day of the week for this date (0=Sunday) * * @access public * @return int the day of the week (0=Sunday) */ function getDayOfWeek() { return Date_Calc::dayOfWeek($this->day, $this->month, $this->year); } // }}} // {{{ getWeekOfYear() /** * Gets the week of the year for this date * * Gets the week of the year for this date * * @access public * @return int the week of the year */ function getWeekOfYear() { return Date_Calc::weekOfYear($this->day, $this->month, $this->year); } // }}} // {{{ getQuarterOfYear() /** * Gets the quarter of the year for this date * * Gets the quarter of the year for this date * * @access public * @return int the quarter of the year (1-4) */ function getQuarterOfYear() { return Date_Calc::quarterOfYear($this->day, $this->month, $this->year); } // }}} // {{{ getDaysInMonth() /** * Gets number of days in the month for this date * * Gets number of days in the month for this date * * @access public * @return int number of days in this month */ function getDaysInMonth() { return Date_Calc::daysInMonth($this->month, $this->year); } // }}} // {{{ getWeeksInMonth() /** * Gets the number of weeks in the month for this date * * Gets the number of weeks in the month for this date * * @access public * @return int number of weeks in this month */ function getWeeksInMonth() { return Date_Calc::weeksInMonth($this->month, $this->year); } // }}} // {{{ getDayName() /** * Gets the full name or abbriviated name of this weekday * * Gets the full name or abbriviated name of this weekday * * @access public * @param boolean $abbr abbrivate the name * @return string name of this day */ function getDayName($abbr = false, $length = 3) { if ($abbr) { return Date_Calc::getWeekdayAbbrname($this->day, $this->month, $this->year, $length); } else { return Date_Calc::getWeekdayFullname($this->day, $this->month, $this->year); } } // }}} // {{{ getMonthName() /** * Gets the full name or abbriviated name of this month * * Gets the full name or abbriviated name of this month * * @access public * @param boolean $abbr abbrivate the name * @return string name of this month */ function getMonthName($abbr = false) { if ($abbr) { return Date_Calc::getMonthAbbrname($this->month); } else { return Date_Calc::getMonthFullname($this->month); } } // }}} // {{{ getNextDay() /** * Get a Date object for the day after this one * * Get a Date object for the day after this one. * The time of the returned Date object is the same as this time. * * @access public * @return object Date Date representing the next day */ function getNextDay() { $day = Date_Calc::nextDay($this->day, $this->month, $this->year, "%Y-%m-%d"); $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second); $newDate = new Date(); $newDate->setDate($date); return $newDate; } // }}} // {{{ getPrevDay() /** * Get a Date object for the day before this one * * Get a Date object for the day before this one. * The time of the returned Date object is the same as this time. * * @access public * @return object Date Date representing the previous day */ function getPrevDay() { $day = Date_Calc::prevDay($this->day, $this->month, $this->year, "%Y-%m-%d"); $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second); $newDate = new Date(); $newDate->setDate($date); return $newDate; } // }}} // {{{ getNextWeekday() /** * Get a Date object for the weekday after this one * * Get a Date object for the weekday after this one. * The time of the returned Date object is the same as this time. * * @access public * @return object Date Date representing the next weekday */ function getNextWeekday() { $day = Date_Calc::nextWeekday($this->day, $this->month, $this->year, "%Y-%m-%d"); $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second); $newDate = new Date(); $newDate->setDate($date); return $newDate; } // }}} // {{{ getPrevWeekday() /** * Get a Date object for the weekday before this one * * Get a Date object for the weekday before this one. * The time of the returned Date object is the same as this time. * * @access public * @return object Date Date representing the previous weekday */ function getPrevWeekday() { $day = Date_Calc::prevWeekday($this->day, $this->month, $this->year, "%Y-%m-%d"); $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second); $newDate = new Date(); $newDate->setDate($date); return $newDate; } // }}} // {{{ getYear() /** * Returns the year field of the date object * * Returns the year field of the date object * * @access public * @return int the year */ function getYear() { return (int)$this->year; } // }}} // {{{ getMonth() /** * Returns the month field of the date object * * Returns the month field of the date object * * @access public * @return int the month */ function getMonth() { return (int)$this->month; } // }}} // {{{ getDay() /** * Returns the day field of the date object * * Returns the day field of the date object * * @access public * @return int the day */ function getDay() { return (int)$this->day; } // }}} // {{{ getHour() /** * Returns the hour field of the date object * * Returns the hour field of the date object * * @access public * @return int the hour */ function getHour() { return $this->hour; } // }}} // {{{ getMinute() /** * Returns the minute field of the date object * * Returns the minute field of the date object * * @access public * @return int the minute */ function getMinute() { return $this->minute; } // }}} // {{{ getSecond() /** * Returns the second field of the date object * * Returns the second field of the date object * * @access public * @return int the second */ function getSecond() { return $this->second; } // }}} // {{{ setYear() /** * Set the year field of the date object * * Set the year field of the date object, invalid years (not 0-9999) are set to 0. * * @access public * @param int $y the year */ function setYear($y) { if ($y < 0 || $y > 9999) { $this->year = 0; } else { $this->year = $y; } } // }}} // {{{ setMonth() /** * Set the month field of the date object * * Set the month field of the date object, invalid months (not 1-12) are set to 1. * * @access public * @param int $m the month */ function setMonth($m) { if ($m < 1 || $m > 12) { $this->month = 1; } else { $this->month = $m; } } // }}} // {{{ setDay() /** * Set the day field of the date object * * Set the day field of the date object, invalid days (not 1-31) are set to 1. * * @access public * @param int $d the day */ function setDay($d) { if ($d > 31 || $d < 1) { $this->day = 1; } else { $this->day = $d; } } // }}} // {{{ setHour() /** * Set the hour field of the date object * * Set the hour field of the date object in 24-hour format. * Invalid hours (not 0-23) are set to 0. * * @access public * @param int $h the hour */ function setHour($h) { if ($h > 23 || $h < 0) { $this->hour = 0; } else { $this->hour = $h; } } // }}} // {{{ setMinute() /** * Set the minute field of the date object * * Set the minute field of the date object, invalid minutes (not 0-59) are set to 0. * * @access public * @param int $m the minute */ function setMinute($m) { if ($m > 59 || $m < 0) { $this->minute = 0; } else { $this->minute = $m; } } // }}} // {{{ setSecond() /** * Set the second field of the date object * * Set the second field of the date object, invalid seconds (not 0-59) are set to 0. * * @access public * @param int $s the second */ function setSecond($s) { if ($s > 59 || $s < 0) { $this->second = 0; } else { $this->second = $s; } } // }}} } // }}} /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>