]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
[PEAR] Modernize Validate code
authorDiogo Cordeiro <diogo@fc.up.pt>
Sun, 7 Jul 2019 22:34:41 +0000 (23:34 +0100)
committerDiogo Cordeiro <diogo@fc.up.pt>
Sat, 3 Aug 2019 16:31:43 +0000 (17:31 +0100)
Upgraded IDNA to IDNA2
Added PEAR Date
> fixed: The each function is deprecated

58 files changed:
extlib/Date.php [new file with mode: 0644]
extlib/Date/Calc.php [new file with mode: 0644]
extlib/Date/Human.php [new file with mode: 0644]
extlib/Date/Span.php [new file with mode: 0644]
extlib/Date/TimeZone.php [new file with mode: 0644]
extlib/Date/docs/LICENSE [new file with mode: 0644]
extlib/Date/docs/TODO [new file with mode: 0644]
extlib/Date/docs/examples/example.php [new file with mode: 0644]
extlib/Date/tests/DateSpanTest.php [new file with mode: 0644]
extlib/Date/tests/DateTest.php [new file with mode: 0644]
extlib/Date/tests/bugs/bug-11313.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-13376.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-13545.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-19568.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-2378-1.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-2378.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-445.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-6246.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-674.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-727-1.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-727-2.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-727-3.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-727-4.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-8518.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-8912.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-9213.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-9414.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-9568.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-967.phpt [new file with mode: 0644]
extlib/Date/tests/bugs/bug-9801.phpt [new file with mode: 0644]
extlib/Date/tests/calc.php [new file with mode: 0755]
extlib/Date/tests/test_addseconds.php [new file with mode: 0644]
extlib/Date/tests/test_addseconds_Calcutta.php [new file with mode: 0644]
extlib/Date/tests/test_addseconds_Paris.php [new file with mode: 0644]
extlib/Date/tests/test_calc.php [new file with mode: 0644]
extlib/Date/tests/test_date_methods_span.php [new file with mode: 0644]
extlib/Date/tests/test_format.php [new file with mode: 0644]
extlib/Date/tests/test_julianday.php [new file with mode: 0644]
extlib/Date/tests/test_round_trunc.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_0.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_1.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_2.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_3.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_4.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_5.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_6.php [new file with mode: 0644]
extlib/Date/tests/test_weeknumbers_ISO.php [new file with mode: 0644]
extlib/Net/IDNA.php [deleted file]
extlib/Net/IDNA/php5.php [deleted file]
extlib/Net/IDNA2.php [new file with mode: 0644]
extlib/Net/IDNA2/Exception.php [new file with mode: 0644]
extlib/Net/IDNA2/Exception/Nameprep.php [new file with mode: 0644]
extlib/Net/IDNA2_tests/Net_IDNA2Test.php [new file with mode: 0644]
extlib/Net/IDNA2_tests/draft-josefsson-idn-test-vectors.php [new file with mode: 0644]
extlib/Validate.php
extlib/buildPackageXML.php [new file with mode: 0644]
lib/framework.php
lib/util.php

diff --git a/extlib/Date.php b/extlib/Date.php
new file mode 100644 (file)
index 0000000..71cbe64
--- /dev/null
@@ -0,0 +1,6672 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+// {{{ Header
+
+/**
+ * Generic date handling class for PEAR
+ *
+ * Handles time zones and changes from local standard to local Summer
+ * time (daylight-saving time) through the {@link Date_TimeZone} class.
+ * Supports several operations from {@link Date_Calc} on Date objects.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 1997-2008 Baba Buehler, Pierre-Alain Joye, Firman
+ * Wandayandi, C.A. Woodcock
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the BSD License.
+ *
+ * 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.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     Baba Buehler <baba@babaz.com>
+ * @author     Pierre-Alain Joye <pajoye@php.net>
+ * @author     Firman Wandayandi <firman@php.net>
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Date
+ */
+
+
+// }}}
+// {{{ Error constants
+
+define('DATE_ERROR_INVALIDDATE', 1);
+define('DATE_ERROR_INVALIDTIME', 2);
+define('DATE_ERROR_INVALIDTIMEZONE', 3);
+define('DATE_ERROR_INVALIDDATEFORMAT', 4);
+define('DATE_ERROR_INVALIDFORMATSTRING', 5);
+
+
+// }}}
+// {{{ Includes
+
+require_once 'PEAR.php';
+
+/**
+ * Load Date_TimeZone
+ */
+require_once 'Date/TimeZone.php';
+
+/**
+ * Load Date_Calc
+ */
+require_once 'Date/Calc.php';
+
+/**
+ * Load Date_Span
+ */
+require_once 'Date/Span.php';
+
+
+// }}}
+// {{{ General constants
+
+/**
+ * Whether to capture the micro-time (in microseconds) by default
+ * in calls to {@link Date::setNow()}.  Note that this makes a call to
+ * {@link http://www.php.net/gettimeofday gettimeofday()}, which may
+ * not work on all systems.
+ *
+ * @since    Constant available since Release 1.5.0
+ */
+define('DATE_CAPTURE_MICROTIME_BY_DEFAULT', false);
+
+/**
+ * Whether to correct, by adding the local Summer time offset, the
+ * specified time if it falls in the 'skipped hour' (encountered
+ * when the clocks go forward).
+ *
+ * N.B. if specified as 'false', and if a time zone that adjusts
+ * for Summer time is specified, then an object of this class will
+ * be set to a semi-invalid state if an invalid time is set.  That
+ * is, an error will not be returned, unless the user then calls
+ * a function, directly or indirectly, that accesses the time
+ * part of the object.  So, for example, if the user calls:
+ *
+ * <code>$date_object->formatLikeSQL('HH.MI.SS');</code>
+ *
+ * or:
+ *
+ * <code>$date_object->addSeconds(30);</code>
+ *
+ * an error will be returned if the time is invalid.  However,
+ * if the user calls:
+ *
+ * <code>$date_object->addDays(1);</code>
+ *
+ * for example, such that the time is no longer invalid, then the
+ * object will no longer be in this invalid state.  This behaviour
+ * is intended to minimize unexpected errors when a user uses the
+ * class to do addition with days only, and does not intend to
+ * access the time.
+ *
+ * Of course, this constant will be unused if the user chooses to
+ * work in UTC or a time zone without Summer time, in which case
+ * this situation will never arise.
+ *
+ * This constant is set to 'true' by default for backwards-compatibility
+ * reasons, however, you are recommended to set it to 'false'.  Note that the
+ * behaviour is not intended to match that of previous versions of the class
+ * in terms of ignoring the Summer time offset when making calculations which
+ * involve dates in both standard and Summer time - this was recognized as a
+ * bug - but in terms of returning a PEAR error object when the user sets the
+ * object to an invalid date (i.e. a time in the hour which is skipped when
+ * the clocks go forwards, which in Europe would be a time such as 01.30).
+ * Backwards compatibility here means that the behaviour is the same as it
+ * used to be, less the bug.
+ *
+ * Note that this problem is not an issue for the user if any of these
+ * conditions are satisfied:
+ *
+ * <ol>
+ *  <li>the user uses a time zone that does not observe Summer time, e.g. UTC</li>
+ *  <li>the user never accesses the time, that is, he never makes a call to
+ *       {@link Date::getHour()} or {@link Date::formatLikeStrftime()} using
+ *       format code '<b>%H</b>', for example, even if he sets the time to
+ *       something invalid</li>
+ *  <li>the user sets DATE_CORRECTINVALIDTIME_DEFAULT to true</li>
+ * </ol>
+ *
+ * @since    Constant available since Release 1.5.0
+ * @see      Date::isValidTime(), DATE_VALIDATE_DATE_BY_DEFAULT
+ */
+define('DATE_CORRECTINVALIDTIME_DEFAULT', true);
+
+/**
+ * Whether to validate dates (i.e. day/month/year, ignoring the time) by
+ * disallowing invalid dates (e.g. 31st February) being set by the following
+ * functions:
+ *
+ *  - {@link Date::setYear()}
+ *  - {@link Date::setMonth()}
+ *  - {@link Date::setDay()}
+ *
+ * If the constant is set to 'true', then the date will be checked (by
+ * default), and if invalid, an error will be returned with the Date object
+ * left unmodified.
+ *
+ * This constant is set to 'false' by default for backwards-compatibility
+ * reasons, however, you are recommended to set it to 'true'.
+ *
+ * Note that {@link Date::setHour()}, {@link Date::setMinute()},
+ * {@link Date::setSecond()} and {@link Date::setPartSecond()}
+ * allow an invalid date/time to be set regardless of the value of this
+ * constant.
+ *
+ * @see      Date::isValidDate(), Date::isValidTime(), Date::isNull(),
+ *            DATE_CORRECTINVALIDTIME_DEFAULT
+ * @since    Constant available since Release 1.5.0
+ */
+define('DATE_VALIDATE_DATE_BY_DEFAULT', false);
+
+/**
+ * Whether, by default, to accept times including leap seconds (i.e. '23.59.60')
+ * when setting the date/time, and whether to count leap seconds in the
+ * following functions:
+ *
+ *  - {@link Date::addSeconds()}
+ *  - {@link Date::subtractSeconds()}
+ *  - {@link Date_Calc::addSeconds()}
+ *  - {@link Date::round()}
+ *  - {@link Date::roundSeconds()}
+ *
+ * This constant is set to 'false' by default for backwards-compatibility
+ * reasons, however, you are recommended to set it to 'true'.
+ *
+ * Note that this constant does not affect {@link Date::addSpan()} and
+ * {@link Date::subtractSpan()} which will not count leap seconds in any case.
+ *
+ * @since    Constant available since Release 1.5.0
+ */
+define('DATE_COUNT_LEAP_SECONDS', false);
+
+/**
+ * Method to call when user invokes {@link Date::format()}
+ *
+ * @since    Constant available since Release 1.5.1
+ */
+define('DATE_FORMAT_METHOD', 'formatLikeStrftime');
+
+
+// }}}
+// {{{ Output format constants (used in {@link Date::getDate()})
+
+/**
+ * "YYYY-MM-DD HH:MM:SS"
+ */
+define('DATE_FORMAT_ISO', 1);
+
+/**
+ * "YYYYMMDDTHHMMSS(Z|(+/-)HHMM)?"
+ */
+define('DATE_FORMAT_ISO_BASIC', 2);
+
+/**
+ * "YYYY-MM-DDTHH:MM:SS(Z|(+/-)HH:MM)?"
+ */
+define('DATE_FORMAT_ISO_EXTENDED', 3);
+
+/**
+ * "YYYY-MM-DDTHH: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
+ *
+ * Supports time zones with the Date_TimeZone class.  Supports several
+ * operations from Date_Calc on Date objects.
+ *
+ * Note to developers: the class stores the local time and date in the
+ * local standard time.  That is, it does not store the time as the
+ * local Summer time when and if the time zone is in Summer time.  It
+ * is much easier to store local standard time and remember to offset
+ * it when the user requests it.
+ *
+ * @category  Date and Time
+ * @package   Date
+ * @author    Baba Buehler <baba@babaz.com>
+ * @author    Pierre-Alain Joye <pajoye@php.net>
+ * @author    Firman Wandayandi <firman@php.net>
+ * @author    C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock
+ * @license   http://www.opensource.org/licenses/bsd-license.php
+ *            BSD License
+ * @version   Release: 1.5.0a1
+ * @link      http://pear.php.net/package/Date
+ */
+class Date
+{
+
+    // {{{ Properties
+
+    /**
+     * The year
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $year;
+
+    /**
+     * The month
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $month;
+
+    /**
+     * The day
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $day;
+
+    /**
+     * The hour
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $hour;
+
+    /**
+     * The minute
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $minute;
+
+    /**
+     * The second
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $second;
+
+    /**
+     * The parts of a second
+     *
+     * @var      float
+     * @access   private
+     * @since    Property available since Release 1.4.3
+     */
+    public $partsecond;
+
+    /**
+     * The year in local standard time
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardyear;
+
+    /**
+     * The month in local standard time
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardmonth;
+
+    /**
+     * The day in local standard time
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardday;
+
+    /**
+     * The hour in local standard time
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardhour;
+
+    /**
+     * The minute in local standard time
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardminute;
+
+    /**
+     * The second in local standard time
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardsecond;
+
+    /**
+     * The part-second in local standard time
+     *
+     * @var      float
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_standardpartsecond;
+
+    /**
+     * Whether the object should accept and count leap seconds
+     *
+     * @var      bool
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $ob_countleapseconds;
+
+    /**
+     * Whether the time is valid as a local time (an invalid time
+     * is one that lies in the 'skipped hour' at the point that
+     * the clocks go forward)
+     *
+     * @var      bool
+     * @access   private
+     * @see      Date::isValidTime()
+     * @since    Property available since Release 1.5.0
+     */
+    public $ob_invalidtime = null;
+
+    /**
+     * Date_TimeZone object for this date
+     *
+     * @var      object     Date_TimeZone object
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $tz;
+
+    /**
+     * Defines the default weekday abbreviation length
+     *
+     * Formerly used by {@link Date::formatLikeStrftime()}, but now
+     * redundant - the abbreviation for the current locale of the machine
+     * is used.
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.4.4
+     */
+    public $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.
+     *
+     * If a date is passed and an exception is returned by {@link Date::setDate()}
+     * there is nothing that this function can do, so for this reason, it
+     * is advisable to pass no parameter and to make a separate call to
+     * Date::setDate().  A date/time should only be passed if known to be a
+     * valid ISO 8601 string or a valid Unix timestamp.
+     *
+     * @param mixed $date optional ISO 8601 date/time to initialize;
+     *                                    or, a Unix time stamp
+     * @param bool $pb_countleapseconds whether to count leap seconds
+     *                                    (defaults to
+     *                                    {@link DATE_COUNT_LEAP_SECONDS})
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDate()
+     */
+    public function Date(
+        $date = null,
+        $pb_countleapseconds = DATE_COUNT_LEAP_SECONDS
+    )
+    {
+        $this->ob_countleapseconds = $pb_countleapseconds;
+
+        if (is_a($date, 'Date')) {
+            $this->copy($date);
+        } else {
+            if (!is_null($date)) {
+                // 'setDate()' expects a time zone to be already set:
+                //
+                $this->_setTZToDefault();
+                $this->setDate($date);
+            } else {
+                $this->setNow();
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ copy()
+
+    /**
+     * Copy values from another Date object
+     *
+     * Makes this Date a copy of another Date object.  This is a
+     * PHP4-compatible implementation of {@link Date::__clone()} in PHP5.
+     *
+     * @param object $date Date object to copy
+     *
+     * @return   void
+     * @access   public
+     */
+    public 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->partsecond = $date->partsecond;
+
+        $this->on_standardyear = $date->on_standardyear;
+        $this->on_standardmonth = $date->on_standardmonth;
+        $this->on_standardday = $date->on_standardday;
+        $this->on_standardhour = $date->on_standardhour;
+        $this->on_standardminute = $date->on_standardminute;
+        $this->on_standardsecond = $date->on_standardsecond;
+        $this->on_standardpartsecond = $date->on_standardpartsecond;
+
+        $this->ob_countleapseconds = $date->ob_countleapseconds;
+        $this->ob_invalidtime = $date->ob_invalidtime;
+
+        $this->tz = new Date_TimeZone($date->getTZID());
+
+        $this->getWeekdayAbbrnameLength = $date->getWeekdayAbbrnameLength;
+    }
+
+
+    // }}}
+    // {{{ __clone()
+
+    /**
+     * Copy values from another Date object
+     *
+     * Makes this Date a copy of another Date object.  For PHP5
+     * only.
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::copy()
+     */
+    public function __clone()
+    {
+        // This line of code would be preferable, but will only
+        // compile in PHP5:
+        //
+        // $this->tz = clone $this->tz;
+
+        $this->tz = new Date_TimeZone($this->getTZID());
+    }
+
+
+    // }}}
+    // {{{ isNull()
+
+    /**
+     * Returns whether the object is null (i.e. no date has been set)
+     *
+     * If the object is set to an invalid date, then this function will
+     * still return 'false'.  To check whether the date is valid use
+     * either {@link Date::isValidDate()} (to check the day/month/year
+     * part of the object only) or {@link Date::isValidTime()} (to check
+     * the time, in addition to the day/month/year part).
+     *
+     * @return   bool
+     * @access   public
+     * @see      Date::setDate(), Date::isValidDate(), Date::isValidTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function isNull()
+    {
+        return is_null($this->year);
+    }
+
+
+    // }}}
+    // {{{ isValidDate()
+
+    /**
+     * Returns whether the date (i.e. day/month/year) is valid
+     *
+     * It is not possible to set the object to an invalid date using
+     * {@link Date::setDate()}, but it is possible to do so using the
+     * following functions:
+     *
+     *  - {@link Date::setYear()}
+     *  - {@link Date::setMonth()}
+     *  - {@link Date::setDay()}
+     *
+     * However you can prevent this possibility (by default) by setting
+     * {@link DATE_VALIDATE_DATE_BY_DEFAULT} to 'true', in which case
+     * these three functions will return an error if they specify an
+     * invalid date, and the object will be unmodified.
+     *
+     * Note that this function only checks the day/month/year part of
+     * the object.  Even if this is valid, it is still possible for the
+     * time to be invalid (see {@link DATE_CORRECTINVALIDTIME_DEFAULT}).
+     * To check the time as well, use {@link Date::isValidTime()}.
+     *
+     * @return   bool
+     * @access   public
+     * @see      Date::setDate(), Date::isNull(), Date::isValidTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function isValidDate()
+    {
+        return
+            !Date::isNull() &&
+            Date_Calc::isValidDate($this->year, $this->month, $this->day);
+    }
+
+
+    // }}}
+    // {{{ setDate()
+
+    /**
+     * Sets the date/time of the object based on the input date and format
+     *
+     * Accepts a string in three possible formats, and in this order of
+     * precedence:
+     *
+     *   - ISO 8601 date (see {@link http://en.wikipedia.org/wiki/ISO_8601})
+     *   - Time-Stamp (i.e. 'YYYYMMDDHHMMSS')
+     *   - Unix time-stamp (see {@link http://en.wikipedia.org/wiki/Unix_time})
+     *
+     * Note that if you want to pass a Unix time-stamp then you need to set
+     * the $format parameter to {@link DATE_FORMAT_UNIXTIME}, or else use the
+     * method {@link Date::setFromTime()}.
+     *
+     * The input string should be a date/time representation in one of the
+     * following general formats:
+     *
+     *   - <b><date>T<time><time-zone></b>
+     *   - <b><date> <time><time-zone></b> (non-ISO-standard)
+     *   - <b><date><time><time-zone></b> (non-ISO-standard)
+     *   - <b><date>T<time></b> i.e. without optional <time-zone> representation
+     *   - <b><date> <time></b>
+     *   - <b><date><time></b>
+     *   - <b><date></b> i.e. without optional <time> representation
+     *
+     * that is, the representation must be comprised of a <b><date></b> part,
+     * with an optional <b><time></b> part, which itself may include an optional
+     * <time-zone> part, each of which may consist of any one of the permitted
+     * formats detailed below.  The <b><date></b> and <b><time</b> representations
+     * should be divided with the time designator <b>T</b> according to the ISO 8601
+     * standard, although this method also permits representations divided by a
+     * space, or by no delimiter at all.
+     *
+     * The <b><date></b> representation should be in one of the following formats:
+     *
+     *   - <b>Calendar date</b>: <b>YYYY-MM-DD</b> (extended format) or
+     *                           <b>YYYYMMDD</b> (basic format), where [YYYY]
+     *                           indicates the four-digit year (0000-9999), [MM]
+     *                           indicates the month (01-12) and [DD] indicates the
+     *                           day of the month [01-31]
+     *   - <b>ISO week date</b>: <b>YYYY-Www-D</b> (extended format) or
+     *                           <b>YYYYWwwD</b> (basic format), where [YYYY]
+     *                           indicates the ISO year (slightly different from the
+     *                           calendar year (see below)), [Www] indicates the ISO
+     *                           week no prefixed by the letter 'W' (W01-W53) and
+     *                           [D] indicates the ISO week-day (1-7), beginning on
+     *                           Monday and ending on Sunday.  (Also see
+     *                           {@link http://en.wikipedia.org/wiki/ISO_week_date}.)
+     *   - <b>Ordinal date</b>: <b>YYYY-DDD</b> (extended format) or
+     *                          <b>YYYYDDD</b> (basic format), where [YYYY]
+     *                          indicates the four-digit year (0000-9999) and [DDD]
+     *                          indicates the day of the year (001-366)
+     *
+     * The <b><time></b> representation should be in one of the following formats:
+     *
+     *   - <b>hh:mm:ss</b> (extended format) or <b>hhmmss</b> (basic format)
+     *   - <b>hh:mm</b> (extended format) or <b>hhmm</b> (basic format)
+     *   - <b>hh</b> (extended format) or <b>hh</b> (basic format)
+     *
+     * where [hh] represents the hour (00-24), [mm] represents the minute (00-59)
+     * and [ss] represents the second (00-60)
+     *
+     * Format parameter should be one of the specified DATE_FORMAT_* constants:
+     *
+     *   - <b>{@link DATE_FORMAT_ISO}</b> - 'YYYY-MM-DD HH:MI:SS'
+     *   - <b>{@link DATE_FORMAT_ISO_BASIC}</b> - 'YYYYMMDDTHHMMSS(Z|(+/-)HHMM)?'
+     *   - <b>{@link DATE_FORMAT_ISO_EXTENDED}</b> - 'YYYY-MM-DDTHH:MM:SS(Z|(+/-)HH:MM)?'
+     *   - <b>{@link DATE_FORMAT_ISO_EXTENDED_MICROTIME}</b> - 'YYYY-MM-DDTHH:MM:SS(.S*)?(Z|(+/-)HH:MM)?'
+     *   - <b>{@link DATE_FORMAT_TIMESTAMP}</b> - 'YYYYMMDDHHMMSS'
+     *   - <b>{@link DATE_FORMAT_UNIXTIME}</b> - long integer of the no of seconds since
+     *                              the Unix Epoch
+     *                              (1st January 1970 00.00.00 GMT)
+     *
+     * @param string $date input date
+     * @param int $format optional format constant
+     *                                        (DATE_FORMAT_*) of the input date.
+     *                                        This parameter is not needed,
+     *                                        except to force the setting of the
+     *                                        date from a Unix time-stamp (for
+     *                                        which use
+     *                                        {@link DATE_FORMAT_UNIXTIME}).
+     *                                        (Defaults to
+     *                                        {@link DATE_FORMAT_ISO}.)
+     * @param bool $pb_repeatedhourdefault value to return if repeated
+     *                                        hour is specified (defaults
+     *                                        to false)
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::isNull(), Date::isValidDate(), Date::isValidTime(),
+     *            Date::setFromTime()
+     */
+    public function setDate(
+        $date,
+        $format = DATE_FORMAT_ISO,
+        $pb_repeatedhourdefault = false
+    )
+    {
+        if ($format == DATE_FORMAT_UNIXTIME) {
+            if (is_numeric($date)) {
+                // Assume Unix time-stamp:
+                //
+                $this->setFromTime((int)$date);
+            } else {
+                return PEAR::raiseError("'$date' not valid Unix time-stamp");
+            }
+        } elseif (preg_match('/^([0-9]{4,4})-?(' .
+            '(0[1-9]|1[0-2])-?(0[1-9]|[12][0-9]|3[01])|' . // [mm]-[dd]
+            'W(0[1-9]|[1-4][0-9]|5[0-3])-?([1-7])|' .       // ISO week date
+            '(0(0[1-9]|[1-9][0-9])|[12][0-9]{2,2}|3([0-5][0-9]|6[1-6]))' . // [ddd]
+            ')([T\s]?' .
+            '([01][0-9]|2[0-3])(:?' .            // [hh]
+            '([0-5][0-9])(:?' .                  // [mm]
+            '([0-5][0-9]|60)([,.][0-9]+)?)?)?' . // [ss]
+            '(Z|[+\-][0-9]{2,2}(:?[0-5][0-9])?)?)?$/i',    // offset
+            $date, $regs)
+        ) {
+            if (substr($regs[2], 0, 1) == "W") {
+                // ISO week date (YYYY-Www-D)
+                //
+
+                $hs_date = Date_Calc::isoWeekToDate(
+                    $regs[6],
+                    $regs[5],
+                    $regs[1],
+                    "%Y %m %d"
+                );
+                if (PEAR::isError($hs_date)) {
+                    return $hs_date;
+                }
+
+                list($hs_year, $hs_month, $hs_day) = explode(" ", $hs_date);
+            } elseif (strlen($regs[2]) == 3) {
+                // ISO ordinal date (YYYY-DDD)
+                //
+
+                $hn_jd = Date_Calc::firstDayOfYear($regs[1]) + $regs[2] - 1;
+                list($hs_year, $hs_month, $hs_day) =
+                    explode(" ", Date_Calc::daysToDate($hn_jd, "%Y %m %d"));
+            } else {
+                // ISO calendar date (YYYY-MM-DD)
+                //
+                // 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.
+                //
+
+                $hs_year = $regs[1];
+                $hs_month = $regs[3];
+                $hs_day = $regs[4];
+
+                if (!Date_Calc::isValidDate($hs_day, $hs_month, $hs_year)) {
+                    return PEAR::raiseError(
+                        "'" .
+                        Date_Calc::dateFormat(
+                            $hs_year,
+                            $hs_month,
+                            $hs_day,
+                            "%Y-%m-%d"
+                        ) .
+                        "' is invalid calendar date",
+                        DATE_ERROR_INVALIDDATE
+                    );
+                }
+            }
+
+            if (isset($regs[17])) {
+                if ($regs[17] == "Z") {
+                    $this->tz = new Date_TimeZone("UTC");
+                } else {
+                    $this->tz = new Date_TimeZone("UTC" . $regs[17]);
+                }
+            }
+
+            $this->setLocalTime(
+                $hs_day,
+                $hs_month,
+                $hs_year,
+                isset($regs[11]) && $regs[11] != "" ?
+                    $regs[11] : 0,
+                isset($regs[13]) && $regs[13] != "" ?
+                    $regs[13] : 0,
+                isset($regs[15]) && $regs[15] != "" ?
+                    $regs[15] : 0,
+                isset($regs[16]) && $regs[16] != "" ?
+                    $regs[16] : 0.0,
+                $pb_repeatedhourdefault
+            );
+        } else {
+            return PEAR::raiseError(
+                "Date '$date' not in ISO 8601 format",
+                DATE_ERROR_INVALIDDATEFORMAT
+            );
+        }
+    }
+
+
+    // }}}
+    // {{{ setNow()
+
+    /**
+     * Sets to local current time and time zone
+     *
+     * @param bool $pb_setmicrotime whether to set micro-time (defaults to the
+     *                               value of the constant
+     *                               {@link DATE_CAPTURE_MICROTIME_BY_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function setNow($pb_setmicrotime = DATE_CAPTURE_MICROTIME_BY_DEFAULT)
+    {
+        $this->_setTZToDefault();
+
+        if ($pb_setmicrotime) {
+            $ha_unixtime = gettimeofday();
+        } else {
+            $ha_unixtime = array("sec" => time());
+        }
+
+        $this->setDate(date("Y-m-d H:i:s", $ha_unixtime["sec"]) .
+            (isset($ha_unixtime["usec"]) ?
+                "." . sprintf("%06d", $ha_unixtime["usec"]) :
+                ""));
+    }
+
+
+    // }}}
+    // {{{ round()
+
+    /**
+     * Rounds the date according to the specified precision (defaults
+     * to nearest day)
+     *
+     * The precision parameter must be one of the following constants:
+     *
+     *   - <b>{@link DATE_PRECISION_YEAR}</b>
+     *   - <b>{@link DATE_PRECISION_MONTH}</b>
+     *   - <b>{@link DATE_PRECISION_DAY}</b> (default)
+     *   - <b>{@link DATE_PRECISION_HOUR}</b>
+     *   - <b>{@link DATE_PRECISION_10MINUTES}</b>
+     *   - <b>{@link DATE_PRECISION_MINUTE}</b>
+     *   - <b>{@link DATE_PRECISION_10SECONDS}</b>
+     *   - <b>{@link DATE_PRECISION_SECOND}</b>
+     *
+     * The precision can also be specified as an integral offset from
+     * one of these constants, where the offset reflects a precision
+     * of 10 to the power of the offset greater than the constant.
+     * For example:
+     *
+     *   - <b>(DATE_PRECISION_YEAR - 1)</b> - rounds the date to the nearest 10 years
+     *   - <b>(DATE_PRECISION_YEAR - 3)</b> - rounds the date to the nearest 1000
+     *                                         years
+     *   - <b>(DATE_PRECISION_SECOND + 1)</b> - rounds the date to 1 decimal
+     *                                    point of a second
+     *   - <b>(DATE_PRECISION_SECOND + 3)</b> - rounds the date to 3 decimal
+     *                                    points of a second
+     *   - <b>(DATE_PRECISION_SECOND - 1)</b> - rounds the date to the nearest 10
+     *                                    seconds (thus it is equivalent to
+     *                                    <b>DATE_PRECISION_10SECONDS</b>)
+     *
+     * @param int $pn_precision a 'DATE_PRECISION_*' constant (defaults to
+     *                                     {@link DATE_PRECISION_DAY})
+     * @param bool $pb_correctinvalidtime whether to correct, by adding the
+     *                                     local Summer time offset, the rounded
+     *                                     time if it falls in the skipped hour
+     *                                     (defaults to
+     *                                     {@link DATE_CORRECTINVALIDTIME_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function round(
+        $pn_precision = DATE_PRECISION_DAY,
+        $pb_correctinvalidtime = DATE_CORRECTINVALIDTIME_DEFAULT
+    )
+    {
+        if ($pn_precision <= DATE_PRECISION_DAY) {
+            list($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour,
+                $hn_minute,
+                $hn_secondraw) =
+                Date_Calc::round(
+                    $pn_precision,
+                    $this->day,
+                    $this->month,
+                    $this->year,
+                    $this->hour,
+                    $this->minute,
+                    $this->partsecond == 0.0 ?
+                        $this->second :
+                        $this->second + $this->partsecond,
+                    $this->ob_countleapseconds
+                );
+            if (is_float($hn_secondraw)) {
+                $hn_second = intval($hn_secondraw);
+                $hn_partsecond = $hn_secondraw - $hn_second;
+            } else {
+                $hn_second = $hn_secondraw;
+                $hn_partsecond = 0.0;
+            }
+
+            $this->setLocalTime(
+                $hn_day,
+                $hn_month,
+                $hn_year,
+                $hn_hour,
+                $hn_minute,
+                $hn_second,
+                $hn_partsecond,
+                true, // This is unlikely anyway, but the
+                // day starts with the repeated hour
+                // the first time around
+                $pb_correctinvalidtime
+            );
+            return;
+        }
+
+        // ($pn_precision >= DATE_PRECISION_HOUR)
+        //
+        if ($this->tz->getDSTSavings() % 3600000 == 0 ||
+            ($this->tz->getDSTSavings() % 60000 == 0 &&
+                $pn_precision >= DATE_PRECISION_MINUTE)
+        ) {
+            list($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour,
+                $hn_minute,
+                $hn_secondraw) =
+                Date_Calc::round(
+                    $pn_precision,
+                    $this->on_standardday,
+                    $this->on_standardmonth,
+                    $this->on_standardyear,
+                    $this->on_standardhour,
+                    $this->on_standardminute,
+                    $this->on_standardpartsecond == 0.0 ?
+                        $this->on_standardsecond :
+                        $this->on_standardsecond +
+                        $this->on_standardpartsecond,
+                    $this->ob_countleapseconds
+                );
+            if (is_float($hn_secondraw)) {
+                $hn_second = intval($hn_secondraw);
+                $hn_partsecond = $hn_secondraw - $hn_second;
+            } else {
+                $hn_second = $hn_secondraw;
+                $hn_partsecond = 0.0;
+            }
+
+            $this->setStandardTime(
+                $hn_day,
+                $hn_month,
+                $hn_year,
+                $hn_hour,
+                $hn_minute,
+                $hn_second,
+                $hn_partsecond
+            );
+            return;
+        }
+
+        // Very unlikely anyway (as I write, the only time zone like this
+        // is Lord Howe Island in Australia (offset of half an hour)):
+        //
+        // (This algorithm could be better)
+        //
+        list($hn_year,
+            $hn_month,
+            $hn_day,
+            $hn_hour,
+            $hn_minute,
+            $hn_secondraw) =
+            Date_Calc::round(
+                $pn_precision,
+                $this->day,
+                $this->month,
+                $this->year,
+                $this->hour,
+                $this->minute,
+                $this->partsecond == 0.0 ?
+                    $this->second :
+                    $this->second + $this->partsecond,
+                $this->ob_countleapseconds
+            );
+        if (is_float($hn_secondraw)) {
+            $hn_second = intval($hn_secondraw);
+            $hn_partsecond = $hn_secondraw - $hn_second;
+        } else {
+            $hn_second = $hn_secondraw;
+            $hn_partsecond = 0.0;
+        }
+
+        $this->setLocalTime(
+            $hn_day,
+            $hn_month,
+            $hn_year,
+            $hn_hour,
+            $hn_minute,
+            $hn_second,
+            $hn_partsecond,
+            false, // This will be right half the time
+            $pb_correctinvalidtime
+        );   // This will be right
+        // some of the time
+        // (depends on Summer
+        // time offset)
+    }
+
+
+    // }}}
+    // {{{ roundSeconds()
+
+    /**
+     * Rounds seconds up or down to the nearest specified unit
+     *
+     * N.B. this function is equivalent to calling:
+     *
+     * <code>$date_object->round(DATE_PRECISION_SECOND + $pn_precision);</code>
+     *
+     * @param int $pn_precision number of digits after the decimal point
+     * @param bool $pb_correctinvalidtime whether to correct, by adding the
+     *                                     local Summer time offset, the rounded
+     *                                     time if it falls in the skipped hour
+     *                                     (defaults to
+     *                                     {@link DATE_CORRECTINVALIDTIME_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function roundSeconds(
+        $pn_precision = 0,
+        $pb_correctinvalidtime = DATE_CORRECTINVALIDTIME_DEFAULT
+    )
+    {
+        $this->round(
+            DATE_PRECISION_SECOND + $pn_precision,
+            $pb_correctinvalidtime
+        );
+    }
+
+
+    // }}}
+    // {{{ trunc()
+
+    /**
+     * Truncates the date according to the specified precision (by
+     * default, it truncates the time part of the date)
+     *
+     * The precision parameter must be one of the following constants:
+     *
+     *   - {@link DATE_PRECISION_YEAR}
+     *   - {@link DATE_PRECISION_MONTH}
+     *   - {@link DATE_PRECISION_DAY} (default)
+     *   - {@link DATE_PRECISION_HOUR}
+     *   - {@link DATE_PRECISION_10MINUTES}
+     *   - {@link DATE_PRECISION_MINUTE}
+     *   - {@link DATE_PRECISION_10SECONDS}
+     *   - {@link DATE_PRECISION_SECOND}
+     *
+     * The precision can also be specified as an integral offset from
+     * one of these constants, where the offset reflects a precision
+     * of 10 to the power of the offset greater than the constant.
+     * For example:
+     *
+     *   - <b>DATE_PRECISION_YEAR</b> - truncates the month, day and time
+     *                            part of the year
+     *   - <b>(DATE_PRECISION_YEAR - 1)</b> - truncates the unit part of the
+     *                                  year, e.g. 1987 becomes 1980
+     *   - <b>(DATE_PRECISION_YEAR - 3)</b> - truncates the hundreds part of the
+     *                                  year, e.g. 1987 becomes 1000
+     *   - <b>(DATE_PRECISION_SECOND + 1)</b> - truncates the part of the second
+     *                                    less than 0.1 of a second, e.g.
+     *                                    3.26301 becomes 3.2 seconds
+     *   - <b>(DATE_PRECISION_SECOND + 3)</b> - truncates the part of the second
+     *                                    less than 0.001 of a second, e.g.
+     *                                    3.26301 becomes 3.263 seconds
+     *   - <b>(DATE_PRECISION_SECOND - 1)</b> - truncates the unit part of the
+     *                                    seconds (thus it is equivalent to
+     *                                    <b>DATE_PRECISION_10SECONDS</b>)
+     *
+     * @param int $pn_precision a 'DATE_PRECISION_*' constant (defaults
+     *                                     to {@link DATE_PRECISION_DAY})
+     * @param bool $pb_correctinvalidtime whether to correct, by adding the
+     *                                     local Summer time offset, the
+     *                                     truncated time if it falls in the
+     *                                     skipped hour (defaults to
+     *                                     {@link DATE_CORRECTINVALIDTIME_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function trunc(
+        $pn_precision = DATE_PRECISION_DAY,
+        $pb_correctinvalidtime = DATE_CORRECTINVALIDTIME_DEFAULT
+    )
+    {
+        if ($pn_precision <= DATE_PRECISION_DAY) {
+            if ($pn_precision <= DATE_PRECISION_YEAR) {
+                $hn_month = 0;
+                $hn_day = 0;
+                $hn_hour = 0;
+                $hn_minute = 0;
+                $hn_second = 0;
+                $hn_partsecond = 0.0;
+
+                $hn_invprecision = DATE_PRECISION_YEAR - $pn_precision;
+                if ($hn_invprecision > 0) {
+                    $hn_year = intval($this->year / pow(10, $hn_invprecision)) *
+                        pow(10, $hn_invprecision);
+                    //
+                    // (Conversion to int necessary for PHP <= 4.0.6)
+                } else {
+                    $hn_year = $this->year;
+                }
+            } elseif ($pn_precision == DATE_PRECISION_MONTH) {
+                $hn_year = $this->year;
+                $hn_month = $this->month;
+                $hn_day = 0;
+                $hn_hour = 0;
+                $hn_minute = 0;
+                $hn_second = 0;
+                $hn_partsecond = 0.0;
+            } elseif ($pn_precision == DATE_PRECISION_DAY) {
+                $hn_year = $this->year;
+                $hn_month = $this->month;
+                $hn_day = $this->day;
+                $hn_hour = 0;
+                $hn_minute = 0;
+                $hn_second = 0;
+                $hn_partsecond = 0.0;
+            }
+
+            $this->setLocalTime(
+                $hn_day,
+                $hn_month,
+                $hn_year,
+                $hn_hour,
+                $hn_minute,
+                $hn_second,
+                $hn_partsecond,
+                true, // This is unlikely anyway, but the
+                // day starts with the repeated
+                // hour the first time around
+                $pb_correctinvalidtime
+            );
+            return;
+        }
+
+        // Precision is at least equal to DATE_PRECISION_HOUR
+        //
+        if ($pn_precision == DATE_PRECISION_HOUR) {
+            $this->addSeconds($this->partsecond == 0.0 ?
+                -$this->second :
+                -$this->second - $this->partsecond);
+            //
+            // (leap seconds irrelevant)
+
+            $this->addMinutes(-$this->minute);
+        } elseif ($pn_precision <= DATE_PRECISION_MINUTE) {
+            if ($pn_precision == DATE_PRECISION_10MINUTES) {
+                $this->addMinutes(-$this->minute % 10);
+            }
+
+            $this->addSeconds($this->partsecond == 0.0 ?
+                -$this->second :
+                -$this->second - $this->partsecond);
+            //
+            // (leap seconds irrelevant)
+        } elseif ($pn_precision == DATE_PRECISION_10SECONDS) {
+            $this->addSeconds($this->partsecond == 0.0 ?
+                -$this->second % 10 :
+                (-$this->second % 10) - $this->partsecond);
+            //
+            // (leap seconds irrelevant)
+        } else {
+            // Assume Summer time offset cannot be composed of part-seconds:
+            //
+            $hn_precision = $pn_precision - DATE_PRECISION_SECOND;
+            $hn_partsecond = intval($this->on_standardpartsecond *
+                    pow(10, $hn_precision)) /
+                pow(10, $hn_precision);
+            $this->setStandardTime(
+                $this->on_standardday,
+                $this->on_standardmonth,
+                $this->on_standardyear,
+                $this->on_standardhour,
+                $this->on_standardminute,
+                $this->on_standardsecond,
+                $hn_partsecond
+            );
+        }
+    }
+
+
+    // }}}
+    // {{{ truncSeconds()
+
+    /**
+     * Truncates seconds according to the specified precision
+     *
+     * N.B. this function is equivalent to calling:
+     *
+     * <code>
+     *   $date_object->trunc(DATE_PRECISION_SECOND + $pn_precision);
+     * </code>
+     *
+     * @param int $pn_precision number of digits after the decimal point
+     * @param bool $pb_correctinvalidtime whether to correct, by adding the
+     *                                     local Summer time offset, the
+     *                                     truncated time if it falls in the
+     *                                     skipped hour (defaults to
+     *                                     {@link DATE_CORRECTINVALIDTIME_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function truncSeconds(
+        $pn_precision = 0,
+        $pb_correctinvalidtime = DATE_CORRECTINVALIDTIME_DEFAULT
+    )
+    {
+        $this->trunc(
+            DATE_PRECISION_SECOND + $pn_precision,
+            $pb_correctinvalidtime
+        );
+    }
+
+
+    // }}}
+    // {{{ getDate()
+
+    /**
+     * Gets a string (or other) representation of this date
+     *
+     * Returns a date in the format specified by the DATE_FORMAT_* constants,
+     * which should be one of the following:
+     *
+     *   - {@link DATE_FORMAT_ISO} (default)
+     *   - {@link DATE_FORMAT_ISO_BASIC}
+     *   - {@link DATE_FORMAT_ISO_EXTENDED}
+     *   - {@link DATE_FORMAT_ISO_EXTENDED_MICROTIME}
+     *   - {@link DATE_FORMAT_TIMESTAMP}
+     *   - {@link DATE_FORMAT_UNIXTIME}
+     *
+     * @param int $format format constant (DATE_FORMAT_*) of the output date
+     *
+     * @return   string     the date in the requested format (defaults to
+     *                       {@link DATE_FORMAT_ISO})
+     * @access   public
+     */
+    public function getDate($format = DATE_FORMAT_ISO)
+    {
+        $ret;
+        switch ($format) {
+            case DATE_FORMAT_ISO:
+                $ret = $this->formatLikeStrftime("%Y-%m-%d %T");
+                break;
+            case DATE_FORMAT_ISO_BASIC:
+                $format = "%Y%m%dT%H%M%S";
+                if ($this->getTZID() == 'UTC') {
+                    $format .= "Z";
+                }
+                $ret = $this->formatLikeStrftime($format);
+                break;
+            case DATE_FORMAT_ISO_EXTENDED:
+                $format = "%Y-%m-%dT%H:%M:%S";
+                if ($this->getTZID() == 'UTC') {
+                    $format .= "Z";
+                }
+                $ret = $this->formatLikeStrftime($format);
+                break;
+            case DATE_FORMAT_ISO_EXTENDED_MICROTIME:
+                $format = "%Y-%m-%dT%H:%M:%s";
+                if ($this->getTZID() == 'UTC') {
+                    $format .= "Z";
+                }
+                $ret = $this->formatLikeStrftime($format);
+                break;
+            case DATE_FORMAT_TIMESTAMP:
+                $ret = $this->formatLikeStrftime("%Y%m%d%H%M%S");
+                break;
+            case DATE_FORMAT_UNIXTIME:
+                $ret = $this->getTime();
+                if (!PEAR::isError($ret)) {
+                    $ret = (string)$ret;
+                }
+                break;
+        }
+
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ format()
+
+    /**
+     * Formats the date according to the specified formatting code string
+     *
+     * This function is an alias for the method specified by the constant
+     * {@link DATE_FORMAT_METHOD} (which defaults to 'formatLikeStrftime'
+     * for backwards-compatibility).
+     *
+     * @return   string     date/time in given format
+     * @access   public
+     * @see      Date::formatLikeStrftime(), Date::formatLikeDate(),
+     *            Date::formatLikeSQL()
+     */
+    public function format()
+    {
+        $ha_args = func_get_args();
+        return call_user_func_array(
+            array(&$this, DATE_FORMAT_METHOD),
+            $ha_args
+        );
+    }
+
+
+    // }}}
+    // {{{ formatLikeStrftime()
+
+    /**
+     * Formats the date according to the specified formatting code string,
+     * based on {@link http://www.php.net/strftime strftime()}
+     *
+     * Formats the date in the given format, much like
+     * strftime().  Most strftime() options are supported.
+     *
+     *
+     * Formatting options:
+     *
+     *   - <b>%a</b> - abbreviated weekday name (Sun, Mon, Tue)
+     *   - <b>%A</b> - full weekday name (Sunday, Monday, Tuesday)
+     *   - <b>%b</b> - abbreviated month name (Jan, Feb, Mar)
+     *   - <b>%B</b> - full month name (January, February, March)
+     *   - <b>%C</b> - century number (the year divided by 100 and truncated
+     *                     to an integer, range 00 to 99)
+     *   - <b>%d</b> - day of month (range 00 to 31)
+     *   - <b>%D</b> - equivalent to '<b>%m/%d/%y</b>'
+     *   - <b>%e</b> - day of month without leading noughts (range 0 to 31)
+     *   - <b>%E</b> - {@link http://en.wikipedia.org/wiki/Julian_day Julian day} -
+     *                 no of days since Monday, 24th November, 4714 B.C. (in
+     *                 the proleptic Gregorian calendar)
+     *   - <b>%g</b> - like '<b>%G</b>', but without the century
+     *   - <b>%G</b> - the 4-digit year corresponding to the ISO week
+     *                     number (see '<b>%V</b>'). This has the same
+     *                     format and value as '<b>%Y</b>', except that if
+     *                     the ISO week number belongs to the previous or
+     *                     next year, that year is used instead.
+     *   - <b>%h</b> - hour as decimal number without leading noughts (0
+     *                     to 23)
+     *   - <b>%H</b> - hour as decimal number (00 to 23)
+     *   - <b>%i</b> - hour as decimal number on 12-hour clock without
+     *                     leading noughts (1 to 12)
+     *   - <b>%I</b> - hour as decimal number on 12-hour clock (01 to 12)
+     *   - <b>%j</b> - day of year (range 001 to 366)
+     *   - <b>%m</b> - month as decimal number (range 01 to 12)
+     *   - <b>%M</b> - minute as a decimal number (00 to 59)
+     *   - <b>%n</b> - newline character ("\n")
+     *   - <b>%o</b> - raw timezone offset expressed as '+/-HH:MM'
+     *   - <b>%O</b> - dst-corrected timezone offset expressed as '+/-HH:MM'
+     *   - <b>%p</b> - either 'am' or 'pm' depending on the time
+     *   - <b>%P</b> - either 'AM' or 'PM' depending on the time
+     *   - <b>%r</b> - time in am/pm notation; equivalent to
+     *                  '<b>%I:%M:%S %p</b>'
+     *   - <b>%R</b> - time in 24-hour notation; equivalent to
+     *                  '<b>%H:%M</b>'
+     *   - <b>%s</b> - seconds including the micro-time (the decimal
+     *                     representation less than one second to six
+     *                     decimal places
+     *   - <b>%S</b> - seconds as a decimal number (00 to 59)
+     *   - <b>%t</b> - tab character ("\t")
+     *   - <b>%T</b> - current time; equivalent to '<b>%H:%M:%S</b>'
+     *   - <b>%u</b> - day of week as decimal (1 to 7; where 1 = Monday)
+     *   - <b>%U</b> - week number of the current year as a decimal
+     *                     number, starting with the first Sunday as the first
+     *                     day of the first week (i.e. the first full week of
+     *                     the year, and the week that contains 7th January)
+     *                     (00 to 53)
+     *   - <b>%V</b> - the {@link http://en.wikipedia.org/wiki/ISO_week_date ISO 8601:1988}
+     *                 week number of the current year
+     *                 as a decimal number, range 01 to 53, where week 1
+     *                 is the first week that has at least 4 days in the
+     *                 current year, and with Monday as the first day of
+     *                 the week.  (Use '<b>%G</b>' or '<b>%g</b>' for the
+     *                 year component that corresponds to the week number
+     *                 for the specified timestamp.)
+     *   - <b>%w</b> - day of week as decimal (0 to 6; where 0 = Sunday)
+     *   - <b>%W</b> - week number of the current year as a decimal
+     *                     number, starting with the first Monday as the first
+     *                     day of the first week (i.e. the first full week of
+     *                     the year, and the week that contains 7th January)
+     *                     (00 to 53)
+     *   - <b>%y</b> - year as decimal (range 00 to 99)
+     *   - <b>%Y</b> - year as decimal including century (range 0000 to
+     *                     9999)
+     *   - <b>%Z</b> - Abbreviated form of time zone name, e.g. 'GMT', or
+     *                     the abbreviation for Summer time if the date falls
+     *                     in Summer time, e.g. 'BST'.
+     *   - <b>%%</b> - literal '%'
+     *
+     *
+     * The following codes render a different output to that of
+     *  {@link http://www.php.net/strftime strftime()}:
+     *
+     *   - <b>%e</b> - in 'strftime()' a single digit is preceded by a space
+     *   - <b>%h</b> - in 'strftime()' is equivalent to '<b>%b</b>'
+     *   - <b>%U</b> - '<b>%U</b>' and '<b>%W</b>' are different in
+     *                  'strftime()' in that if week 1 does not start on 1st
+     *                  January, '00' is returned, whereas this function
+     *                  returns '53', that is, the week is counted as the
+     *                  last of the previous year.
+     *   - <b>%W</b>
+     *
+     * @param string $format the format string for returned date/time
+     *
+     * @return   string     date/time in given format
+     * @access   public
+     * @see      Date::format(), Date::formatLikeDate(), Date::formatLikeSQL()
+     * @since    Method available since Release 1.5.1
+     */
+    public function formatLikeStrftime($format)
+    {
+        $output = "";
+
+        $hn_isoyear = null;
+        $hn_isoweek = null;
+        $hn_isoday = null;
+
+        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;
+                        break;
+                    case "E":
+                        $output .= Date_Calc::dateToDays(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        break;
+                    case "g":
+                        if (is_null($hn_isoyear)) {
+                            list($hn_isoyear, $hn_isoweek, $hn_isoday) =
+                                Date_Calc::isoWeekDate(
+                                    $this->day,
+                                    $this->month,
+                                    $this->year
+                                );
+                        }
+
+                        $output .= sprintf("%02d", $hn_isoyear % 100);
+                        break;
+                    case "G":
+                        if (is_null($hn_isoyear)) {
+                            list($hn_isoyear, $hn_isoweek, $hn_isoday) =
+                                Date_Calc::isoWeekDate(
+                                    $this->day,
+                                    $this->month,
+                                    $this->year
+                                );
+                        }
+
+                        $output .= sprintf("%04d", $hn_isoyear);
+                        break;
+                    case 'h':
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $output .= sprintf("%d", $this->hour);
+                        break;
+                    case "H":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $output .= sprintf("%02d", $this->hour);
+                        break;
+                    case "i":
+                    case "I":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $hour = $this->hour + 1 > 12 ?
+                            $this->hour - 12 :
+                            $this->hour;
+                        $output .= $hour == 0 ?
+                            12 :
+                            ($nextchar == "i" ?
+                                $hour :
+                                sprintf('%02d', $hour));
+                        break;
+                    case "j":
+                        $output .= sprintf(
+                            "%03d",
+                            Date_Calc::dayOfYear(
+                                $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":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $offms = $this->getTZOffset();
+                        $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":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $output .= $this->hour >= 12 ? "pm" : "am";
+                        break;
+                    case "P":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $output .= $this->hour >= 12 ? "PM" : "AM";
+                        break;
+                    case "r":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $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":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $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":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $output .= sprintf(
+                            "%02d:%02d:%02d",
+                            $this->hour,
+                            $this->minute,
+                            $this->second
+                        );
+                        break;
+                    case "u":
+                        $hn_dayofweek = $this->getDayOfWeek();
+                        $output .= $hn_dayofweek == 0 ? 7 : $hn_dayofweek;
+                        break;
+                    case "U":
+                        $ha_week = Date_Calc::weekOfYear7th(
+                            $this->day,
+                            $this->month,
+                            $this->year,
+                            0
+                        );
+                        $output .= sprintf("%02d", $ha_week[1]);
+                        break;
+                    case "V":
+                        if (is_null($hn_isoyear)) {
+                            list($hn_isoyear, $hn_isoweek, $hn_isoday) =
+                                Date_Calc::isoWeekDate(
+                                    $this->day,
+                                    $this->month,
+                                    $this->year
+                                );
+                        }
+
+                        $output .= $hn_isoweek;
+                        break;
+                    case "w":
+                        $output .= $this->getDayOfWeek();
+                        break;
+                    case "W":
+                        $ha_week = Date_Calc::weekOfYear7th(
+                            $this->day,
+                            $this->month,
+                            $this->year,
+                            1
+                        );
+                        $output .= sprintf("%02d", $ha_week[1]);
+                        break;
+                    case 'y':
+                        $output .= sprintf(
+                            '%0' .
+                            ($this->year < 0 ? '3' : '2') .
+                            'd',
+                            $this->year % 100
+                        );
+                        break;
+                    case "Y":
+                        $output .= sprintf(
+                            '%0' .
+                            ($this->year < 0 ? '5' : '4') .
+                            'd',
+                            $this->year
+                        );
+                        break;
+                    case "Z":
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $output .= $this->getTZShortName();
+                        break;
+                    case "%":
+                        $output .= "%";
+                        break;
+                    default:
+                        $output .= $char . $nextchar;
+                }
+                $strpos++;
+            } else {
+                $output .= $char;
+            }
+        }
+        return $output;
+    }
+
+
+    // }}}
+    // {{{ _getOrdinalSuffix()
+
+    /**
+     * Returns appropriate ordinal suffix (i.e. 'th', 'st', 'nd' or 'rd')
+     *
+     * @param int $pn_num number with which to determine suffix
+     * @param bool $pb_uppercase boolean specifying if the suffix should be
+     *                            capitalized
+     *
+     * @return   string
+     * @access   private
+     * @since    Method available since Release 1.5.0
+     */
+    public function _getOrdinalSuffix($pn_num, $pb_uppercase = true)
+    {
+        switch (($pn_numabs = abs($pn_num)) % 100) {
+            case 11:
+            case 12:
+            case 13:
+                $hs_suffix = "th";
+                break;
+            default:
+                switch ($pn_numabs % 10) {
+                    case 1:
+                        $hs_suffix = "st";
+                        break;
+                    case 2:
+                        $hs_suffix = "nd";
+                        break;
+                    case 3:
+                        $hs_suffix = "rd";
+                        break;
+                    default:
+                        $hs_suffix = "th";
+                }
+        }
+
+        return $pb_uppercase ? strtoupper($hs_suffix) : $hs_suffix;
+    }
+
+
+    // }}}
+    // {{{ _spellNumber()
+
+    /**
+     * Converts a number to its word representation
+     *
+     * Private helper function, particularly for {@link Date::formatLikeSQL()}.
+     * N.B. The second argument is the 'SP' code which can be specified in the
+     * format string for 'formatLikeSQL()' and is interpreted as follows:
+     *
+     *  - <b>SP</b> - returns upper-case spelling, e.g. 'FOUR HUNDRED'
+     *  - <b>Sp</b> - returns spelling with first character of each word
+     *         capitalized, e.g. 'Four Hundred'
+     *  - <b>sp</b> - returns lower-case spelling, e.g. 'four hundred'
+     *
+     * @param int $pn_num number to be converted to words
+     * @param bool $pb_ordinal boolean specifying if the number should
+     *                                   be ordinal
+     * @param string $ps_capitalization string for specifying capitalization
+     *                                   options
+     * @param string $ps_locale language name abbreviation used for
+     *                                   formatting numbers as spelled-out words
+     *
+     * @return   string
+     * @access   private
+     * @since    Method available since Release 1.5.0
+     */
+    public function _spellNumber(
+        $pn_num,
+        $pb_ordinal = false,
+        $ps_capitalization = "SP",
+        $ps_locale = "en_GB"
+    )
+    {
+        include_once "Numbers/Words.php";
+        $hs_words = Numbers_Words::toWords($pn_num, $ps_locale);
+        if (Pear::isError($hs_words)) {
+            return $hs_words;
+        }
+
+        if ($pb_ordinal && substr($ps_locale, 0, 2) == "en") {
+            if (($pn_rem = ($pn_numabs = abs($pn_num)) % 100) == 12) {
+                $hs_words = substr($hs_words, 0, -2) . "fth";
+            } elseif ($pn_rem >= 11 && $pn_rem <= 15) {
+                $hs_words .= "th";
+            } else {
+                switch ($pn_numabs % 10) {
+                    case 1:
+                        $hs_words = substr($hs_words, 0, -3) . "first";
+                        break;
+                    case 2:
+                        $hs_words = substr($hs_words, 0, -3) . "second";
+                        break;
+                    case 3:
+                        $hs_words = substr($hs_words, 0, -3) . "ird";
+                        break;
+                    case 5:
+                        $hs_words = substr($hs_words, 0, -2) . "fth";
+                        break;
+                    default:
+                        switch (substr($hs_words, -1)) {
+                            case "e":
+                                $hs_words = substr($hs_words, 0, -1) . "th";
+                                break;
+                            case "t":
+                                $hs_words .= "h";
+                                break;
+                            case "y":
+                                $hs_words = substr($hs_words, 0, -1) . "ieth";
+                                break;
+                            default:
+                                $hs_words .= "th";
+                        }
+                }
+            }
+        }
+
+        if (($hs_char = substr($ps_capitalization, 0, 1)) ==
+            strtolower($hs_char)) {
+            $hb_upper = false;
+            $hs_words = strtolower($hs_words);
+        } elseif (($hs_char = substr($ps_capitalization, 1, 1)) ==
+            strtolower($hs_char)) {
+            $hb_upper = false;
+            $hs_words = ucwords($hs_words);
+        } else {
+            $hb_upper = true;
+            $hs_words = strtoupper($hs_words);
+        }
+
+        return $hs_words;
+    }
+
+
+    // }}}
+    // {{{ _formatNumber()
+
+    /**
+     * Formats a number according to the specified format string
+     *
+     * Private helper function, for {@link Date::formatLikeSQL()}, which
+     * interprets the codes '<b>SP</b>' and '<b>TH</b>' and the combination
+     * of the two as follows:
+     *
+     *   - <b>TH</b> - Ordinal number
+     *   - <b>SP</b> - Spelled cardinal number
+     *   - <b>SPTH</b> - Spelled ordinal number (combination of '<b>SP</b>'
+     *                   and '<b>TH</b>' in any order)
+     *   - <b>THSP</b>
+     *
+     * Code '<b>SP</b>' can have the following three variations (which
+     * can also be used in combination with '<b>TH</b>'):
+     *
+     *   - <b>SP</b> - returns upper-case spelling, e.g. 'FOUR HUNDRED'
+     *   - <b>Sp</b> - returns spelling with first character of each word
+     *                 capitalized, e.g. 'Four Hundred'
+     *   - <b>sp</b> - returns lower-case spelling, e.g. 'four hundred'
+     *
+     * Code '<b>TH</b>' can have the following two variations (although in
+     * combination with code '<b>SP</b>', the case specification of
+     * '<b>SP</b>' takes precedence):
+     *
+     *   - <b>TH</b> - returns upper-case ordinal suffix, e.g. 400TH
+     *   - <b>th</b> - returns lower-case ordinal suffix, e.g. 400th
+     *
+     * N.B. The format string is passed by reference, in order to pass back
+     * the part of the format string that matches the valid codes '<b>SP</b>'
+     * and '<b>TH</b>'.  If none of these are found, then it is set to an
+     * empty string;  If both codes are found then a string is returned with
+     * code '<b>SP</b>' preceding code '<b>TH</b>' (i.e. '<b>SPTH</b>',
+     * '<b>Spth</b>' or '<b>spth</b>').
+     *
+     * @param int $pn_num integer to be converted to words
+     * @param string &$ps_format string of formatting codes (max. length 4)
+     * @param int $pn_numofdigits no of digits to display if displayed as
+     *                                numeral (i.e. not spelled out), not
+     *                                including the sign (if negative); to
+     *                                allow all digits specify 0
+     * @param bool $pb_nopad boolean specifying whether to suppress
+     *                                padding with leading noughts (if displayed
+     *                                as numeral)
+     * @param bool $pb_nosign boolean specifying whether to suppress the
+     *                                display of the sign (if negative)
+     * @param string $ps_locale language name abbreviation used for
+     *                                formatting
+     * @param string $ps_thousandsep optional thousand-separator (e.g. a comma)
+     *                                numbers as spelled-out words
+     * @param int $pn_padtype optional integer to specify padding (if
+     *                                displayed as numeral) - can be
+     *                                STR_PAD_LEFT or STR_PAD_RIGHT
+     *
+     * @return   string
+     * @access   private
+     * @since    Method available since Release 1.5.0
+     */
+    public function _formatNumber(
+        $pn_num,
+        &$ps_format,
+        $pn_numofdigits,
+        $pb_nopad = false,
+        $pb_nosign = false,
+        $ps_locale = "en_GB",
+        $ps_thousandsep = null,
+        $pn_padtype = STR_PAD_LEFT
+    )
+    {
+        $hs_code1 = substr($ps_format, 0, 2);
+        $hs_code2 = substr($ps_format, 2, 2);
+
+        $hs_sp = null;
+        $hs_th = null;
+        if (strtoupper($hs_code1) == "SP") {
+            $hs_sp = $hs_code1;
+            if (strtoupper($hs_code2) == "TH") {
+                $hs_th = $hs_code2;
+            }
+        } elseif (strtoupper($hs_code1) == "TH") {
+            $hs_th = $hs_code1;
+            if (strtoupper($hs_code2) == "SP") {
+                $hs_sp = $hs_code2;
+            }
+        }
+
+        $hn_absnum = abs($pn_num);
+        if ($pn_numofdigits > 0 && strlen($hn_absnum) > $pn_numofdigits) {
+            $hn_absnum = intval(substr($hn_absnum, -$pn_numofdigits));
+        }
+        $hs_num = $hn_absnum;
+
+        if (!is_null($hs_sp)) {
+            // Spell out number:
+            //
+            $ps_format = $hs_sp .
+                (is_null($hs_th) ? "" : ($hs_sp == "SP" ? "TH" : "th"));
+            return $this->_spellNumber(
+                !$pb_nosign && $pn_num < 0 ?
+                    $hn_absnum * -1 :
+                    $hn_absnum,
+                !is_null($hs_th),
+                $hs_sp,
+                $ps_locale
+            );
+        } else {
+            // Display number as Arabic numeral:
+            //
+            if (!$pb_nopad) {
+                $hs_num = str_pad($hs_num, $pn_numofdigits, "0", $pn_padtype);
+            }
+
+            if (!is_null($ps_thousandsep)) {
+                for ($i = strlen($hs_num) - 3; $i > 0; $i -= 3) {
+                    $hs_num = substr($hs_num, 0, $i) .
+                        $ps_thousandsep .
+                        substr($hs_num, $i);
+                }
+            }
+
+            if (!$pb_nosign) {
+                if ($pn_num < 0) {
+                    $hs_num = "-" . $hs_num;
+                } elseif (!$pb_nopad) {
+                    $hs_num = " " . $hs_num;
+                }
+            }
+
+            if (!is_null($hs_th)) {
+                $ps_format = $hs_th;
+                return $hs_num .
+                    $this->_getOrdinalSuffix(
+                        $pn_num,
+                        substr($hs_th, 0, 1) == "T"
+                    );
+            } else {
+                $ps_format = "";
+                return $hs_num;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ formatLikeSQL()
+
+    /**
+     * Formats the date according to the specified formatting code string,
+     * based on SQL date-formatting codes
+     *
+     * Most codes reproduce the no of digits equal to the length of the
+     * code, for example, '<b>YYY</b>' will return the last 3 digits of
+     * the year, and so the year 2007 will produce '007', and the year 89
+     * will produce '089', unless the no-padding code is used as in
+     * '<b>NPYYY</b>', which will return '89'.
+     *
+     * For negative values, the sign will be discarded, unless the
+     * '<b>S</b>' code is used in combination, but note that for positive
+     * values the value will be padded with a leading space unless it
+     * is suppressed with the no-padding modifier, for example for 2007:
+     *
+     *   - <b>YYYY</b> - returns '2007'
+     *   - <b>SYYYY</b> - returns ' 2007'
+     *   - <b>NPSYYYY</b> - returns '2007'
+     *
+     * The no-padding modifier '<b>NP</b>' can be used with numeric codes
+     * to suppress leading (or trailing in the case of code '<b>F</b>')
+     * noughts, and with character-returning codes such as '<b>DAY</b>'
+     * to suppress trailing spaces, which will otherwise be padded to the
+     * maximum possible length of the return-value of the code; for
+     * example, for Monday:
+     *
+     *   - <b>Day</b> - returns 'Monday   ' because the maximum length of
+     *                  this code is 'Wednesday';
+     *   - <b>NPDay</b> - returns 'Monday'
+     *
+     * N.B. this code affects the code immediately following only, and
+     * without this code the default is always to apply padding.
+     *
+     * Most character-returning codes, such as '<b>MONTH</b>', will
+     * set the capitalization according to the code, so for example:
+     *
+     *   - <b>MONTH</b> - returns upper-case spelling, e.g. 'JANUARY'
+     *   - <b>Month</b> - returns spelling with first character of each word
+     *                    capitalized, e.g. 'January'
+     *   - <b>month</b> - returns lower-case spelling, e.g. 'january'
+     *
+     * Where it makes sense, numeric codes can be combined with a following
+     * '<b>SP</b>' code which spells out the number, or with a '<b>TH</b>'
+     * code, which renders the code as an ordinal ('<b>TH</b>' only works
+     * in English), for example, for 31st December:
+     *
+     *   - <b>DD</b> - returns '31'
+     *   - <b>DDTH</b> - returns '31ST'
+     *   - <b>DDth</b> - returns '31st'
+     *   - <b>DDSP</b> - returns 'THIRTY-ONE'
+     *   - <b>DDSp</b> - returns 'Thirty-one'
+     *   - <b>DDsp</b> - returns 'thirty-one'
+     *   - <b>DDSPTH</b> - returns 'THIRTY-FIRST'
+     *   - <b>DDSpth</b> - returns 'Thirty-first'
+     *   - <b>DDspth</b> - returns 'thirty-first'
+     *
+     *
+     * All formatting options:
+     *
+     *   - <b>-</b> (All punctuation and white-space is reproduced unchanged)
+     *   - <b>/</b>
+     *   - <b>,</b>
+     *   - <b>.</b>
+     *   - <b>;</b>
+     *   - <b>:</b>
+     *   - <b>"text"</b> - Quoted text is reproduced unchanged (escape using
+     *                     '\')
+     *   - <b>AD</b> - AD indicator with or without full stops
+     *   - <b>A.D.</b>
+     *   - <b>AM</b> - Meridian indicator with or without full stops
+     *   - <b>A.M.</b>
+     *   - <b>BC</b> - BC indicator with or without full stops
+     *   - <b>B.C.</b>
+     *   - <b>BCE</b> - BCE indicator with or without full stops
+     *   - <b>B.C.E.</b>
+     *   - <b>CC</b> - Century, i.e. the year divided by 100, discarding the
+     *                 remainder; '<b>S</b>' prefixes negative years with a
+     *                 minus sign
+     *   - <b>SCC</b>
+     *   - <b>CE</b> - CE indicator with or without full stops
+     *   - <b>C.E.</b>
+     *   - <b>D</b> - Day of week (0-6), where 0 represents Sunday
+     *   - <b>DAY</b> - Name of day, padded with blanks to display width of the
+     *                  widest name of day in the locale of the machine
+     *   - <b>DD</b> - Day of month (1-31)
+     *   - <b>DDD</b> - Day of year (1-366)
+     *   - <b>DY</b> - Abbreviated name of day
+     *   - <b>FFF</b> - Fractional seconds; no radix character is printed.  The
+     *                  no of '<b>F</b>'s determines the no of digits of the
+     *                  part-second to return; e.g. 'HH:MI:SS.FF'
+     *   - <b>F[integer]</b> - The integer after '<b>F</b>' specifies the
+     *                         number of digits of the part-second to return.
+     *                         This is an alternative to using several
+     *                         '<b>F</b>'s in sequence, and '<b>F3</b>' is thus
+     *                         equivalent to using '<b>FFF</b>'.
+     *   - <b>HH</b> - Hour of day (0-23)
+     *   - <b>HH12</b> - Hour of day (1-12)
+     *   - <b>HH24</b> - Hour of day (0-23)
+     *   - <b>ID</b> - Day of week (1-7) based on the ISO 8601 standard (see
+     *                 '<b>IW</b>')
+     *   - <b>IW</b> - Week of year (1-52 or 1-53) based on the
+     *                 {@link http://en.wikipedia.org/wiki/ISO_week_date ISO 8601 standard}
+     *   - <b>IYYY</b> - 4-digit year based on the ISO 8601 standard (see
+     *                 '<b>IW</b>'); '<b>S</b>' prefixes negative years with a
+     *                 minus sign
+     *   - <b>SIYYY</b>
+     *   - <b>IYY</b> - Last 3, 2, or 1 digit(s) of ISO year
+     *   - <b>IY</b>
+     *   - <b>I</b>
+     *   - <b>J</b> - {@link http://en.wikipedia.org/wiki/Julian_day Julian day} -
+     *                the number of days since Monday, 24th November, 4714 B.C.
+     *                (proleptic Gregorian calendar)
+     *   - <b>MI</b> - Minute (0-59)
+     *   - <b>MM</b> - Month (01-12; January = 01)
+     *   - <b>MON</b> - Abbreviated name of month
+     *   - <b>MONTH</b> - Name of month, padded with blanks to display width of
+     *                    the widest name of month in the date language used for
+     *   - <b>PM</b> - Meridian indicator with or without full stops
+     *   - <b>P.M.</b>
+     *   - <b>Q</b> - Quarter of year (1, 2, 3, 4; January - March = 1)
+     *   - <b>RM</b> - Roman numeral month (I-XII; January = I); N.B. padded
+     *                 with leading spaces.
+     *   - <b>SS</b> - Second (0-59)
+     *   - <b>SSSSS</b> - Seconds past midnight (0-86399)
+     *   - <b>TZC</b> - Abbreviated form of time zone name, e.g. 'GMT', or the
+     *                  abbreviation for Summer time if the date falls in Summer
+     *                  time, e.g. 'BST'.
+     *                  N.B. this is not a unique identifier - for this purpose
+     *                  use the time zone region (code '<b>TZR</b>').
+     *   - <b>TZH</b> - Time zone hour; '<b>S</b>' prefixes the hour with the
+     *                  correct sign, (+/-), which otherwise is not displayed.
+     *                  Note that the leading nought can be suppressed with the
+     *                  no-padding code '<b>NP</b>').  Also note that if you
+     *                  combine with the '<b>SP</b>' code, the sign will not be
+     *                  spelled out. (I.e. '<b>STZHSp</b>' will produce '+One',
+     *                  for example, and not 'Plus One'.
+     *                  '<b>TZH:TZM</b>' will produce, for example, '+05:30'.
+     *                  (Also see '<b>TZM</b>' format code)
+     *   - <b>STZH</b>
+     *   - <b>TZI</b> - Whether or not the date is in Summer time (daylight
+     *                  saving time).  Returns '1' if Summer time, else '0'.
+     *   - <b>TZM</b> - Time zone minute, without any +/- sign.  (Also see
+     *                  '<b>TZH</b>' format element)
+     *   - <b>TZN</b> - Long form of time zone name, e.g.
+     *                  'Greenwich Mean Time', or the name of the Summer time if
+     *                  the date falls in Summer time, e.g.
+     *                  'British Summer Time'.  N.B. this is not a unique
+     *                  identifier - for this purpose use the time zone region
+     *                  (code '<b>TZR</b>').
+     *   - <b>TZO</b> - Time zone offset in ISO 8601 form - that is, 'Z' if
+     *                  UTC, else [+/-][hh]:[mm] (which would be equivalent
+     *                  to '<b>STZH:TZM</b>').  Note that this result is right
+     *                  padded.
+     *                  with spaces by default, (i.e. if 'Z').
+     *   - <b>TZS</b> - Time zone offset in seconds; '<b>S</b>' prefixes
+     *                  negative sign with minus sign '-' if negative, and no
+     *                  sign if positive (i.e. -43200 to 50400).
+     *   - <b>STZS</b>
+     *   - <b>TZR</b> - Time zone region, that is, the name or ID of the time
+     *                  zone e.g. 'Europe/London'.  This value is unique for
+     *                  each time zone.
+     *   - <b>U</b> - Seconds since the Unix Epoch -
+     *                January 1 1970 00:00:00 GMT
+     *   - <b>W</b> - 'Absolute' week of month (1-5), counting week 1 as
+     *                1st-7th of the year, regardless of the day
+     *   - <b>W1</b> - Week of year (1-54), counting week 1 as the week that
+     *                 contains 1st January
+     *   - <b>W4</b> - Week of year (1-53), counting week 1 as the week that
+     *                 contains 4th January (i.e. first week with at least 4
+     *                 days)
+     *   - <b>W7</b> - Week of year (1-53), counting week 1 as the week that
+     *                 contains 7th January (i.e. first full week)
+     *   - <b>WW</b> - 'Absolute' week of year (1-53), counting week 1 as
+     *                 1st-7th of the year, regardless of the day
+     *   - <b>YEAR</b> - Year, spelled out; '<b>S</b>' prefixes negative
+     *                   years with 'MINUS'; N.B. '<b>YEAR</b>' differs from
+     *                   '<b>YYYYSP</b>' in that the first will render 1923,
+     *                   for example, as 'NINETEEN TWENTY-THREE, and the
+     *                   second as 'ONE THOUSAND NINE HUNDRED TWENTY-THREE'
+     *   - <b>SYEAR</b>
+     *   - <b>YYYY</b> - 4-digit year; '<b>S</b>' prefixes negative years
+     *                   with a minus sign
+     *   - <b>SYYYY</b>
+     *   - <b>YYY</b> - Last 3, 2, or 1 digit(s) of year
+     *   - <b>YY</b>
+     *   - <b>Y</b>
+     *   - <b>Y,YYY</b> - Year with thousands-separator in this position; five
+     *                    possible separators
+     *   - <b>Y.YYY</b>
+     *   - <b>Y�YYY</b> - N.B. space-dot (mid-dot, interpunct) is valid only in
+     *                    ISO 8859-1 (so take care when using UTF-8 in
+     *                    particular)
+     *   - <b>Y'YYY</b>
+     *   - <b>Y YYY</b>
+     *
+     * In addition the following codes can be used in combination with other
+     * codes;
+     *  Codes that modify the next code in the format string:
+     *
+     *   - <b>NP</b> - 'No Padding' - Returns a value with no trailing blanks
+     *                 and no leading or trailing noughts; N.B. that the
+     *                 default is to include this padding in the return string.
+     *                 N.B. affects the code immediately following only.
+     *
+     *  Codes that modify the previous code in the format string (can only
+     *  be used with integral codes such as '<b>MM</b>'):
+     *
+     *   - <b>TH</b> - Ordinal number
+     *   - <b>SP</b> - Spelled cardinal number
+     *   - <b>SPTH</b> - Spelled ordinal number (combination of '<b>SP</b>'
+     *                   and '<b>TH</b>' in any order)
+     *   - <b>THSP</b>
+     *
+     * Code '<b>SP</b>' can have the following three variations (which can
+     * also be used in combination with '<b>TH</b>'):
+     *
+     *   - <b>SP</b> - returns upper-case spelling, e.g. 'FOUR HUNDRED'
+     *   - <b>Sp</b> - returns spelling with first character of each word
+     *                 capitalized, e.g. 'Four Hundred'
+     *   - <b>sp</b> - returns lower-case spelling, e.g. 'four hundred'
+     *
+     * Code '<b>TH</b>' can have the following two variations (although in
+     * combination with code '<b>SP</b>', the case specification of
+     * '<b>SP</b>' takes precedence):
+     *
+     *   - <b>TH</b> - returns upper-case ordinal suffix, e.g. 400TH
+     *   - <b>th</b> - returns lower-case ordinal suffix, e.g. 400th
+     *
+     * @param string $ps_format format string for returned date/time
+     * @param string $ps_locale language name abbreviation used for formatting
+     *                           numbers as spelled-out words
+     *
+     * @return   string     date/time in given format
+     * @access   public
+     * @see      Date::format(), Date::formatLikeStrftime(), Date::formatLikeDate()
+     * @since    Method available since Release 1.5.0
+     */
+    public function formatLikeSQL($ps_format, $ps_locale = "en_GB")
+    {
+        if (!preg_match(
+            '/^("([^"\\\\]|\\\\\\\\|\\\\")*"|(D{1,3}|S?C+|' .
+            'HH(12|24)?|I[DW]|S?IY*|J|M[IM]|Q|SS(SSS)?|S?TZ[HS]|' .
+            'TZM|U|W[W147]?|S?Y{1,3}([,.�\' ]?YYY)*)(SP(TH)?|' .
+            'TH(SP)?)?|AD|A\.D\.|AM|A\.M\.|BCE?|B\.C\.(E\.)?|CE|' .
+            'C\.E\.|DAY|DY|F(F*|[1-9][0-9]*)|MON(TH)?|NP|PM|' .
+            'P\.M\.|RM|TZ[CINOR]|S?YEAR|[^A-Z0-9"])*$/i',
+            $ps_format
+        )) {
+            return PEAR::raiseError(
+                "Invalid date format '$ps_format'",
+                DATE_ERROR_INVALIDFORMATSTRING
+            );
+        }
+
+        $ret = "";
+        $i = 0;
+
+        $hb_nopadflag = false;
+        $hb_showsignflag = false;
+
+        $hn_weekdaypad = null;
+        $hn_monthpad = null;
+        $hn_isoyear = null;
+        $hn_isoweek = null;
+        $hn_isoday = null;
+        $hn_tzoffset = null;
+
+        while ($i < strlen($ps_format)) {
+            $hb_lower = false;
+
+            if ($hb_nopadflag) {
+                $hb_nopad = true;
+            } else {
+                $hb_nopad = false;
+            }
+            if ($hb_showsignflag) {
+                $hb_nosign = false;
+            } else {
+                $hb_nosign = true;
+            }
+            $hb_nopadflag = false;
+            $hb_showsignflag = false;
+
+            switch ($hs_char = substr($ps_format, $i, 1)) {
+                case "-":
+                case "/":
+                case ",":
+                case ".":
+                case ";":
+                case ":":
+                case " ":
+                    $ret .= $hs_char;
+                    $i += 1;
+                    break;
+                case "\"":
+                    preg_match(
+                        '/(([^"\\\\]|\\\\\\\\|\\\\")*)"/',
+                        $ps_format,
+                        $ha_matches,
+                        PREG_OFFSET_CAPTURE,
+                        $i + 1
+                    );
+                    $ret .= str_replace(
+                        array('\\\\', '\\"'),
+                        array('\\', '"'),
+                        $ha_matches[1][0]
+                    );
+                    $i += strlen($ha_matches[0][0]) + 1;
+                    break;
+                case "a":
+                    $hb_lower = true;
+                // no break
+                case "A":
+                    if (strtoupper(substr($ps_format, $i, 4)) == "A.D.") {
+                        $ret .= $this->year >= 0 ?
+                            ($hb_lower ? "a.d." : "A.D.") :
+                            ($hb_lower ? "b.c." : "B.C.");
+                        $i += 4;
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "AD") {
+                        $ret .= $this->year >= 0 ?
+                            ($hb_lower ? "ad" : "AD") :
+                            ($hb_lower ? "bc" : "BC");
+                        $i += 2;
+                    } else {
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        if (strtoupper(substr($ps_format, $i, 4)) == "A.M.") {
+                            $ret .= $this->hour < 12 ?
+                                ($hb_lower ? "a.m." : "A.M.") :
+                                ($hb_lower ? "p.m." : "P.M.");
+                            $i += 4;
+                        } elseif (strtoupper(substr($ps_format, $i, 2)) == "AM") {
+                            $ret .= $this->hour < 12 ?
+                                ($hb_lower ? "am" : "AM") :
+                                ($hb_lower ? "pm" : "PM");
+                            $i += 2;
+                        }
+                    }
+
+                    break;
+                case "b":
+                    $hb_lower = true;
+                // no break
+                case "B":
+                    // Check for 'B.C.E.' first:
+                    //
+                    if (strtoupper(substr($ps_format, $i, 6)) == "B.C.E.") {
+                        if ($this->year >= 0) {
+                            $hs_era = $hb_lower ? "c.e." : "C.E.";
+                            $ret .= $hb_nopad ?
+                                $hs_era :
+                                str_pad($hs_era, 6, " ", STR_PAD_RIGHT);
+                        } else {
+                            $ret .= $hb_lower ? "b.c.e." : "B.C.E.";
+                        }
+                        $i += 6;
+                    } elseif (strtoupper(substr($ps_format, $i, 3)) == "BCE") {
+                        if ($this->year >= 0) {
+                            $hs_era = $hb_lower ? "ce" : "CE";
+                            $ret .= $hb_nopad ?
+                                $hs_era :
+                                str_pad($hs_era, 3, " ", STR_PAD_RIGHT);
+                        } else {
+                            $ret .= $hb_lower ? "bce" : "BCE";
+                        }
+                        $i += 3;
+                    } elseif (strtoupper(substr($ps_format, $i, 4)) == "B.C.") {
+                        $ret .= $this->year >= 0 ?
+                            ($hb_lower ? "a.d." : "A.D.") :
+                            ($hb_lower ? "b.c." : "B.C.");
+                        $i += 4;
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "BC") {
+                        $ret .= $this->year >= 0 ?
+                            ($hb_lower ? "ad" : "AD") :
+                            ($hb_lower ? "bc" : "BC");
+                        $i += 2;
+                    }
+
+                    break;
+                case "c":
+                    $hb_lower = true;
+                // no break
+                case "C":
+                    if (strtoupper(substr($ps_format, $i, 4)) == "C.E.") {
+                        if ($this->year >= 0) {
+                            $hs_era = $hb_lower ? "c.e." : "C.E.";
+                            $ret .= $hb_nopad ?
+                                $hs_era :
+                                str_pad($hs_era, 6, " ", STR_PAD_RIGHT);
+                        } else {
+                            $ret .= $hb_lower ? "b.c.e." : "B.C.E.";
+                        }
+                        $i += 4;
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "CE") {
+                        if ($this->year >= 0) {
+                            $hs_era = $hb_lower ? "ce" : "CE";
+                            $ret .= $hb_nopad ?
+                                $hs_era :
+                                str_pad($hs_era, 3, " ", STR_PAD_RIGHT);
+                        } else {
+                            $ret .= $hb_lower ? "bce" : "BCE";
+                        }
+                        $i += 2;
+                    } else {
+                        // Code C(CCC...):
+                        //
+                        $hn_codelen = 1;
+                        while (strtoupper(substr(
+                                $ps_format,
+                                $i + $hn_codelen,
+                                1
+                            )) == "C") {
+                            ++$hn_codelen;
+                        }
+
+                        // Check next code is not 'CE' or 'C.E.'
+                        //
+                        if ($hn_codelen > 1 &&
+                            (
+                                strtoupper(substr(
+                                    $ps_format,
+                                    $i + $hn_codelen - 1,
+                                    4
+                                )) == "C.E." ||
+                                strtoupper(substr(
+                                    $ps_format,
+                                    $i + $hn_codelen - 1,
+                                    2
+                                )) == "CE"
+                            )) {
+                            --$hn_codelen;
+                        }
+
+                        $hn_century = intval($this->year / 100);
+                        $hs_numberformat = substr($ps_format, $i + $hn_codelen, 4);
+                        $hs_century = $this->_formatNumber(
+                            $hn_century,
+                            $hs_numberformat,
+                            $hn_codelen,
+                            $hb_nopad,
+                            $hb_nosign,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_century)) {
+                            return $hs_century;
+                        }
+
+                        $ret .= $hs_century;
+                        $i += $hn_codelen + strlen($hs_numberformat);
+                    }
+
+                    break;
+                case "d":
+                    $hb_lower = true;
+                // no break
+                case "D":
+                    if (strtoupper(substr($ps_format, $i, 3)) == "DAY") {
+                        $hs_day = Date_Calc::getWeekdayFullname(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+
+                        if (!$hb_nopad) {
+                            if (is_null($hn_weekdaypad)) {
+                                // Set week-day padding variable:
+                                //
+                                $hn_weekdaypad = 0;
+                                foreach (Date_Calc::getWeekDays() as $hs_weekday) {
+                                    $hn_weekdaypad = max(
+                                        $hn_weekdaypad,
+                                        strlen($hs_weekday)
+                                    );
+                                }
+                            }
+                            $hs_day = str_pad(
+                                $hs_day,
+                                $hn_weekdaypad,
+                                " ",
+                                STR_PAD_RIGHT
+                            );
+                        }
+
+                        $ret .= $hb_lower ?
+                            strtolower($hs_day) :
+                            (substr($ps_format, $i + 1, 1) == "A" ?
+                                strtoupper($hs_day) :
+                                $hs_day);
+                        $i += 3;
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "DY") {
+                        $hs_day = Date_Calc::getWeekdayAbbrname(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $ret .= $hb_lower ?
+                            strtolower($hs_day) :
+                            (substr($ps_format, $i + 1, 1) == "Y" ?
+                                strtoupper($hs_day) :
+                                $hs_day);
+                        $i += 2;
+                    } elseif (strtoupper(substr($ps_format, $i, 3)) == "DDD" &&
+                        strtoupper(substr($ps_format, $i + 2, 3)) != "DAY" &&
+                        strtoupper(substr($ps_format, $i + 2, 2)) != "DY"
+                    ) {
+                        $hn_day = Date_Calc::dayOfYear(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hs_numberformat = substr($ps_format, $i + 3, 4);
+                        $hs_day = $this->_formatNumber(
+                            $hn_day,
+                            $hs_numberformat,
+                            3,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_day)) {
+                            return $hs_day;
+                        }
+
+                        $ret .= $hs_day;
+                        $i += 3 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "DD" &&
+                        strtoupper(substr($ps_format, $i + 1, 3)) != "DAY" &&
+                        strtoupper(substr($ps_format, $i + 1, 2)) != "DY"
+                    ) {
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_day = $this->_formatNumber(
+                            $this->day,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_day)) {
+                            return $hs_day;
+                        }
+
+                        $ret .= $hs_day;
+                        $i += 2 + strlen($hs_numberformat);
+                    } else {
+                        // Code 'D':
+                        //
+                        $hn_day = Date_Calc::dayOfWeek(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hs_numberformat = substr($ps_format, $i + 1, 4);
+                        $hs_day = $this->_formatNumber(
+                            $hn_day,
+                            $hs_numberformat,
+                            1,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_day)) {
+                            return $hs_day;
+                        }
+
+                        $ret .= $hs_day;
+                        $i += 1 + strlen($hs_numberformat);
+                    }
+
+                    break;
+                case "f":
+                case "F":
+                    if ($this->ob_invalidtime) {
+                        return $this->_getErrorInvalidTime();
+                    }
+                    $hn_codelen = 1;
+                    if (is_numeric(substr($ps_format, $i + $hn_codelen, 1))) {
+                        ++$hn_codelen;
+                        while (is_numeric(substr($ps_format, $i + $hn_codelen, 1))) {
+                            ++$hn_codelen;
+                        }
+
+                        $hn_partsecdigits = substr($ps_format, $i + 1, $hn_codelen - 1);
+                    } else {
+                        while (strtoupper(substr(
+                                $ps_format,
+                                $i + $hn_codelen,
+                                1
+                            )) == "F") {
+                            ++$hn_codelen;
+                        }
+
+                        // Check next code is not F[numeric]:
+                        //
+                        if ($hn_codelen > 1 &&
+                            is_numeric(substr($ps_format, $i + $hn_codelen, 1))) {
+                            --$hn_codelen;
+                        }
+
+                        $hn_partsecdigits = $hn_codelen;
+                    }
+
+                    $hs_partsec = (string)$this->partsecond;
+                    if (preg_match(
+                        '/^([0-9]+)(\.([0-9]+))?E-([0-9]+)$/i',
+                        $hs_partsec,
+                        $ha_matches
+                    )) {
+                        $hs_partsec =
+                            str_repeat("0", $ha_matches[4] - strlen($ha_matches[1])) .
+                            $ha_matches[1] .
+                            $ha_matches[3];
+                    } else {
+                        $hs_partsec = substr($hs_partsec, 2);
+                    }
+                    $hs_partsec = substr($hs_partsec, 0, $hn_partsecdigits);
+
+                    // '_formatNumber() will not work for this because the
+                    // part-second is an int, and we want it to behave like a float:
+                    //
+                    if ($hb_nopad) {
+                        $hs_partsec = rtrim($hs_partsec, "0");
+                        if ($hs_partsec == "") {
+                            $hs_partsec = "0";
+                        }
+                    } else {
+                        $hs_partsec = str_pad(
+                            $hs_partsec,
+                            $hn_partsecdigits,
+                            "0",
+                            STR_PAD_RIGHT
+                        );
+                    }
+
+                    $ret .= $hs_partsec;
+                    $i += $hn_codelen;
+                    break;
+                case "h":
+                case "H":
+                    if ($this->ob_invalidtime) {
+                        return $this->_getErrorInvalidTime();
+                    }
+                    if (strtoupper(substr($ps_format, $i, 4)) == "HH12") {
+                        $hn_hour = $this->hour % 12;
+                        if ($hn_hour == 0) {
+                            $hn_hour = 12;
+                        }
+
+                        $hn_codelen = 4;
+                    } else {
+                        // Code 'HH' or 'HH24':
+                        //
+                        $hn_hour = $this->hour;
+                        $hn_codelen = strtoupper(substr(
+                            $ps_format,
+                            $i,
+                            4
+                        )) == "HH24" ? 4 : 2;
+                    }
+
+                    $hs_numberformat = substr($ps_format, $i + $hn_codelen, 4);
+                    $hs_hour = $this->_formatNumber(
+                        $hn_hour,
+                        $hs_numberformat,
+                        2,
+                        $hb_nopad,
+                        true,
+                        $ps_locale
+                    );
+                    if (Pear::isError($hs_hour)) {
+                        return $hs_hour;
+                    }
+
+                    $ret .= $hs_hour;
+                    $i += $hn_codelen + strlen($hs_numberformat);
+                    break;
+                case "i":
+                case "I":
+                    if (is_null($hn_isoyear)) {
+                        list($hn_isoyear, $hn_isoweek, $hn_isoday) =
+                            Date_Calc::isoWeekDate(
+                                $this->day,
+                                $this->month,
+                                $this->year
+                            );
+                    }
+
+                    if (strtoupper(substr($ps_format, $i, 2)) == "ID" &&
+                        strtoupper(substr($ps_format, $i + 1, 3)) != "DAY"
+                    ) {
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_isoday = $this->_formatNumber(
+                            $hn_isoday,
+                            $hs_numberformat,
+                            1,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_isoday)) {
+                            return $hs_isoday;
+                        }
+
+                        $ret .= $hs_isoday;
+                        $i += 2 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "IW") {
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_isoweek = $this->_formatNumber(
+                            $hn_isoweek,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_isoweek)) {
+                            return $hs_isoweek;
+                        }
+
+                        $ret .= $hs_isoweek;
+                        $i += 2 + strlen($hs_numberformat);
+                    } else {
+                        // Code I(YYY...):
+                        //
+                        $hn_codelen = 1;
+                        while (strtoupper(substr(
+                                $ps_format,
+                                $i + $hn_codelen,
+                                1
+                            )) == "Y") {
+                            ++$hn_codelen;
+                        }
+
+                        $hs_numberformat = substr($ps_format, $i + $hn_codelen, 4);
+                        $hs_isoyear = $this->_formatNumber(
+                            $hn_isoyear,
+                            $hs_numberformat,
+                            $hn_codelen,
+                            $hb_nopad,
+                            $hb_nosign,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_isoyear)) {
+                            return $hs_isoyear;
+                        }
+
+                        $ret .= $hs_isoyear;
+                        $i += $hn_codelen + strlen($hs_numberformat);
+                    }
+
+                    break;
+                case "j":
+                case "J":
+                    $hn_jd = Date_Calc::dateToDays(
+                        $this->day,
+                        $this->month,
+                        $this->year
+                    );
+                    $hs_numberformat = substr($ps_format, $i + 1, 4);
+
+                    // Allow sign if negative; allow all digits (specify nought);
+                    // suppress padding:
+                    //
+                    $hs_jd = $this->_formatNumber(
+                        $hn_jd,
+                        $hs_numberformat,
+                        0,
+                        true,
+                        false,
+                        $ps_locale
+                    );
+                    if (Pear::isError($hs_jd)) {
+                        return $hs_jd;
+                    }
+
+                    $ret .= $hs_jd;
+                    $i += 1 + strlen($hs_numberformat);
+                    break;
+                case "m":
+                    $hb_lower = true;
+                // no break
+                case "M":
+                    if (strtoupper(substr($ps_format, $i, 2)) == "MI") {
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_minute = $this->_formatNumber(
+                            $this->minute,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_minute)) {
+                            return $hs_minute;
+                        }
+
+                        $ret .= $hs_minute;
+                        $i += 2 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "MM") {
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_month = $this->_formatNumber(
+                            $this->month,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_month)) {
+                            return $hs_month;
+                        }
+
+                        $ret .= $hs_month;
+                        $i += 2 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 5)) == "MONTH") {
+                        $hs_month = Date_Calc::getMonthFullname($this->month);
+
+                        if (!$hb_nopad) {
+                            if (is_null($hn_monthpad)) {
+                                // Set month padding variable:
+                                //
+                                $hn_monthpad = 0;
+                                foreach (Date_Calc::getMonthNames() as $hs_monthofyear) {
+                                    $hn_monthpad = max(
+                                        $hn_monthpad,
+                                        strlen($hs_monthofyear)
+                                    );
+                                }
+                            }
+                            $hs_month = str_pad(
+                                $hs_month,
+                                $hn_monthpad,
+                                " ",
+                                STR_PAD_RIGHT
+                            );
+                        }
+
+                        $ret .= $hb_lower ?
+                            strtolower($hs_month) :
+                            (substr($ps_format, $i + 1, 1) == "O" ?
+                                strtoupper($hs_month) :
+                                $hs_month);
+                        $i += 5;
+                    } elseif (strtoupper(substr($ps_format, $i, 3)) == "MON") {
+                        $hs_month = Date_Calc::getMonthAbbrname($this->month);
+                        $ret .= $hb_lower ?
+                            strtolower($hs_month) :
+                            (substr($ps_format, $i + 1, 1) == "O" ?
+                                strtoupper($hs_month) :
+                                $hs_month);
+                        $i += 3;
+                    }
+
+                    break;
+                case "n":
+                case "N":
+                    // No-Padding rule 'NP' applies to the next code (either trailing
+                    // spaces or leading/trailing noughts):
+                    //
+                    $hb_nopadflag = true;
+                    $i += 2;
+                    break;
+                case "p":
+                    $hb_lower = true;
+                // no break
+                case "P":
+                    if ($this->ob_invalidtime) {
+                        return $this->_getErrorInvalidTime();
+                    }
+                    if (strtoupper(substr($ps_format, $i, 4)) == "P.M.") {
+                        $ret .= $this->hour < 12 ?
+                            ($hb_lower ? "a.m." : "A.M.") :
+                            ($hb_lower ? "p.m." : "P.M.");
+                        $i += 4;
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "PM") {
+                        $ret .= $this->hour < 12 ?
+                            ($hb_lower ? "am" : "AM") :
+                            ($hb_lower ? "pm" : "PM");
+                        $i += 2;
+                    }
+
+                    break;
+                case "q":
+                case "Q":
+                    // N.B. Current implementation ignores the day and year, but
+                    // it is possible that a different implementation might be
+                    // desired, so pass these parameters anyway:
+                    //
+                    $hn_quarter = Date_Calc::quarterOfYear(
+                        $this->day,
+                        $this->month,
+                        $this->year
+                    );
+                    $hs_numberformat = substr($ps_format, $i + 1, 4);
+                    $hs_quarter = $this->_formatNumber(
+                        $hn_quarter,
+                        $hs_numberformat,
+                        1,
+                        $hb_nopad,
+                        true,
+                        $ps_locale
+                    );
+                    if (Pear::isError($hs_quarter)) {
+                        return $hs_quarter;
+                    }
+
+                    $ret .= $hs_quarter;
+                    $i += 1 + strlen($hs_numberformat);
+                    break;
+                case "r":
+                    $hb_lower = true;
+                // no break
+                case "R":
+                    // Code 'RM':
+                    //
+                    switch ($this->month) {
+                        case 1:
+                            $hs_monthroman = "i";
+                            break;
+                        case 2:
+                            $hs_monthroman = "ii";
+                            break;
+                        case 3:
+                            $hs_monthroman = "iii";
+                            break;
+                        case 4:
+                            $hs_monthroman = "iv";
+                            break;
+                        case 5:
+                            $hs_monthroman = "v";
+                            break;
+                        case 6:
+                            $hs_monthroman = "vi";
+                            break;
+                        case 7:
+                            $hs_monthroman = "vii";
+                            break;
+                        case 8:
+                            $hs_monthroman = "viii";
+                            break;
+                        case 9:
+                            $hs_monthroman = "ix";
+                            break;
+                        case 10:
+                            $hs_monthroman = "x";
+                            break;
+                        case 11:
+                            $hs_monthroman = "xi";
+                            break;
+                        case 12:
+                            $hs_monthroman = "xii";
+                            break;
+                    }
+
+                    $hs_monthroman = $hb_lower ?
+                        $hs_monthroman :
+                        strtoupper($hs_monthroman);
+                    $ret .= $hb_nopad ?
+                        $hs_monthroman :
+                        str_pad($hs_monthroman, 4, " ", STR_PAD_LEFT);
+                    $i += 2;
+                    break;
+                case "s":
+                case "S":
+                    // Check for 'SSSSS' before 'SS':
+                    //
+                    if (strtoupper(substr($ps_format, $i, 5)) == "SSSSS") {
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $hs_numberformat = substr($ps_format, $i + 5, 4);
+                        $hn_second = Date_Calc::secondsPastMidnight(
+                            $this->hour,
+                            $this->minute,
+                            $this->second
+                        );
+                        $hs_second = $this->_formatNumber(
+                            $hn_second,
+                            $hs_numberformat,
+                            5,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_second)) {
+                            return $hs_second;
+                        }
+
+                        $ret .= $hs_second;
+                        $i += 5 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "SS") {
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_second = $this->_formatNumber(
+                            $this->second,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_second)) {
+                            return $hs_second;
+                        }
+
+                        $ret .= $hs_second;
+                        $i += 2 + strlen($hs_numberformat);
+                    } else {
+                        // One of the following codes:
+                        //  'SC(CCC...)'
+                        //  'SY(YYY...)'
+                        //  'SIY(YYY...)'
+                        //  'STZH'
+                        //  'STZS'
+                        //  'SYEAR'
+                        //
+                        $hb_showsignflag = true;
+                        if ($hb_nopad) {
+                            $hb_nopadflag = true;
+                        }
+                        ++$i;
+                    }
+
+                    break;
+                case "t":
+                case "T":
+                    // Code TZ[...]:
+                    //
+
+                    if (strtoupper(substr($ps_format, $i, 3)) == "TZR") {
+                        // This time-zone-related code can be called when the time is
+                        // invalid, but the others should return an error:
+                        //
+                        $ret .= $this->getTZID();
+                        $i += 3;
+                    } else {
+                        if ($this->ob_invalidtime) {
+                            return $this->_getErrorInvalidTime();
+                        }
+
+                        if (strtoupper(substr($ps_format, $i, 3)) == "TZC") {
+                            $ret .= $this->getTZShortName();
+                            $i += 3;
+                        } elseif (strtoupper(substr($ps_format, $i, 3)) == "TZH") {
+                            if (is_null($hn_tzoffset)) {
+                                $hn_tzoffset = $this->getTZOffset();
+                            }
+
+                            $hs_numberformat = substr($ps_format, $i + 3, 4);
+                            $hn_tzh = intval($hn_tzoffset / 3600000);
+
+                            // Suppress sign here (it is added later):
+                            //
+                            $hs_tzh = $this->_formatNumber(
+                                $hn_tzh,
+                                $hs_numberformat,
+                                2,
+                                $hb_nopad,
+                                true,
+                                $ps_locale
+                            );
+                            if (Pear::isError($hs_tzh)) {
+                                return $hs_tzh;
+                            }
+
+                            // Display sign, even if positive:
+                            //
+                            $ret .= ($hb_nosign ? "" : ($hn_tzh >= 0 ? '+' : '-')) .
+                                $hs_tzh;
+                            $i += 3 + strlen($hs_numberformat);
+                        } elseif (strtoupper(substr($ps_format, $i, 3)) == "TZI") {
+                            $ret .= ($this->inDaylightTime() ? '1' : '0');
+                            $i += 3;
+                        } elseif (strtoupper(substr($ps_format, $i, 3)) == "TZM") {
+                            if (is_null($hn_tzoffset)) {
+                                $hn_tzoffset = $this->getTZOffset();
+                            }
+
+                            $hs_numberformat = substr($ps_format, $i + 3, 4);
+                            $hn_tzm = intval(($hn_tzoffset % 3600000) / 60000);
+
+                            // Suppress sign:
+                            //
+                            $hs_tzm = $this->_formatNumber(
+                                $hn_tzm,
+                                $hs_numberformat,
+                                2,
+                                $hb_nopad,
+                                true,
+                                $ps_locale
+                            );
+                            if (Pear::isError($hs_tzm)) {
+                                return $hs_tzm;
+                            }
+
+                            $ret .= $hs_tzm;
+                            $i += 3 + strlen($hs_numberformat);
+                        } elseif (strtoupper(substr($ps_format, $i, 3)) == "TZN") {
+                            $ret .= $this->getTZLongName();
+                            $i += 3;
+                        } elseif (strtoupper(substr($ps_format, $i, 3)) == "TZO") {
+                            if (is_null($hn_tzoffset)) {
+                                $hn_tzoffset = $this->getTZOffset();
+                            }
+
+                            $hn_tzh = intval(abs($hn_tzoffset) / 3600000);
+                            $hn_tzm = intval((abs($hn_tzoffset) % 3600000) / 60000);
+
+                            if ($hn_tzoffset == 0) {
+                                $ret .= $hb_nopad ? "Z" : "Z     ";
+                            } else {
+                                // Display sign, even if positive:
+                                //
+                                $ret .= ($hn_tzoffset >= 0 ? '+' : '-') .
+                                    sprintf("%02d", $hn_tzh) .
+                                    ":" .
+                                    sprintf("%02d", $hn_tzm);
+                            }
+                            $i += 3;
+                        } elseif (strtoupper(substr($ps_format, $i, 3)) == "TZS") {
+                            if (is_null($hn_tzoffset)) {
+                                $hn_tzoffset = $this->getTZOffset();
+                            }
+
+                            $hs_numberformat = substr($ps_format, $i + 3, 4);
+                            $hn_tzs = intval($hn_tzoffset / 1000);
+                            $hs_tzs = $this->_formatNumber(
+                                $hn_tzs,
+                                $hs_numberformat,
+                                5,
+                                $hb_nopad,
+                                $hb_nosign,
+                                $ps_locale
+                            );
+                            if (Pear::isError($hs_tzs)) {
+                                return $hs_tzs;
+                            }
+
+                            $ret .= $hs_tzs;
+                            $i += 3 + strlen($hs_numberformat);
+                        }
+                    }
+
+                    break;
+                case "u":
+                case "U":
+                    if ($this->ob_invalidtime) {
+                        return $this->_getErrorInvalidTime();
+                    }
+                    $hn_unixtime = $this->getTime();
+                    $hs_numberformat = substr($ps_format, $i + 1, 4);
+
+                    // Allow sign if negative; allow all digits (specify nought);
+                    // suppress padding:
+                    //
+                    $hs_unixtime = $this->_formatNumber(
+                        $hn_unixtime,
+                        $hs_numberformat,
+                        0,
+                        true,
+                        false,
+                        $ps_locale
+                    );
+                    if (Pear::isError($hs_unixtime)) {
+                        return $hs_unixtime;
+                    }
+
+                    $ret .= $hs_unixtime;
+                    $i += 1 + strlen($hs_numberformat);
+                    break;
+                case "w":
+                case "W":
+                    // Check for 'WW' before 'W':
+                    //
+                    if (strtoupper(substr($ps_format, $i, 2)) == "WW") {
+                        $hn_week = Date_Calc::weekOfYearAbsolute(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_week = $this->_formatNumber(
+                            $hn_week,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_week)) {
+                            return $hs_week;
+                        }
+
+                        $ret .= $hs_week;
+                        $i += 2 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "W1") {
+                        $hn_week = Date_Calc::weekOfYear1st(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_week = $this->_formatNumber(
+                            $hn_week,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_week)) {
+                            return $hs_week;
+                        }
+
+                        $ret .= $hs_week;
+                        $i += 2 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "W4") {
+                        $ha_week = Date_Calc::weekOfYear4th(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hn_week = $ha_week[1];
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_week = $this->_formatNumber(
+                            $hn_week,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_week)) {
+                            return $hs_week;
+                        }
+
+                        $ret .= $hs_week;
+                        $i += 2 + strlen($hs_numberformat);
+                    } elseif (strtoupper(substr($ps_format, $i, 2)) == "W7") {
+                        $ha_week = Date_Calc::weekOfYear7th(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hn_week = $ha_week[1];
+                        $hs_numberformat = substr($ps_format, $i + 2, 4);
+                        $hs_week = $this->_formatNumber(
+                            $hn_week,
+                            $hs_numberformat,
+                            2,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_week)) {
+                            return $hs_week;
+                        }
+
+                        $ret .= $hs_week;
+                        $i += 2 + strlen($hs_numberformat);
+                    } else {
+                        // Code 'W':
+                        //
+                        $hn_week = Date_Calc::weekOfMonthAbsolute(
+                            $this->day,
+                            $this->month,
+                            $this->year
+                        );
+                        $hs_numberformat = substr($ps_format, $i + 1, 4);
+                        $hs_week = $this->_formatNumber(
+                            $hn_week,
+                            $hs_numberformat,
+                            1,
+                            $hb_nopad,
+                            true,
+                            $ps_locale
+                        );
+                        if (Pear::isError($hs_week)) {
+                            return $hs_week;
+                        }
+
+                        $ret .= $hs_week;
+                        $i += 1 + strlen($hs_numberformat);
+                    }
+
+                    break;
+                case "y":
+                case "Y":
+                    // Check for 'YEAR' first:
+                    //
+                    if (strtoupper(substr($ps_format, $i, 4)) == "YEAR") {
+                        switch (substr($ps_format, $i, 2)) {
+                            case "YE":
+                                $hs_spformat = "SP";
+                                break;
+                            case "Ye":
+                                $hs_spformat = "Sp";
+                                break;
+                            default:
+                                $hs_spformat = "sp";
+                        }
+
+                        if (($hn_yearabs = abs($this->year)) < 100 ||
+                            $hn_yearabs % 100 < 10) {
+                            $hs_numberformat = $hs_spformat;
+
+                            // Allow all digits (specify nought); padding irrelevant:
+                            //
+                            $hs_year = $this->_formatNumber(
+                                $this->year,
+                                $hs_numberformat,
+                                0,
+                                true,
+                                $hb_nosign,
+                                $ps_locale
+                            );
+                            if (Pear::isError($hs_year)) {
+                                return $hs_year;
+                            }
+
+                            $ret .= $hs_year;
+                        } else {
+                            // Year is spelled 'Nineteen Twelve' rather than
+                            // 'One thousand Nine Hundred Twelve':
+                            //
+                            $hn_century = intval($this->year / 100);
+                            $hs_numberformat = $hs_spformat;
+
+                            // Allow all digits (specify nought); padding irrelevant:
+                            //
+                            $hs_century = $this->_formatNumber(
+                                $hn_century,
+                                $hs_numberformat,
+                                0,
+                                true,
+                                $hb_nosign,
+                                $ps_locale
+                            );
+                            if (Pear::isError($hs_century)) {
+                                return $hs_century;
+                            }
+
+                            $ret .= $hs_century . " ";
+
+                            $hs_numberformat = $hs_spformat;
+
+                            // Discard sign; padding irrelevant:
+                            //
+                            $hs_year = $this->_formatNumber(
+                                $this->year,
+                                $hs_numberformat,
+                                2,
+                                false,
+                                true,
+                                $ps_locale
+                            );
+                            if (Pear::isError($hs_year)) {
+                                return $hs_year;
+                            }
+
+                            $ret .= $hs_year;
+                        }
+
+                        $i += 4;
+                    } else {
+                        // Code Y(YYY...):
+                        //
+                        $hn_codelen = 1;
+                        while (strtoupper(substr(
+                                $ps_format,
+                                $i + $hn_codelen,
+                                1
+                            )) == "Y") {
+                            ++$hn_codelen;
+                        }
+
+                        $hs_thousandsep = null;
+                        $hn_thousandseps = 0;
+                        if ($hn_codelen <= 3) {
+                            while (preg_match(
+                                '/([,.�\' ])YYY/i',
+                                substr(
+                                    $ps_format,
+                                    $i + $hn_codelen,
+                                    4
+                                ),
+                                $ha_matches
+                            )) {
+                                $hn_codelen += 4;
+                                $hs_thousandsep = $ha_matches[1];
+                                ++$hn_thousandseps;
+                            }
+                        }
+
+                        // Check next code is not 'YEAR'
+                        //
+                        if ($hn_codelen > 1 &&
+                            strtoupper(substr(
+                                $ps_format,
+                                $i + $hn_codelen - 1,
+                                4
+                            )) == "YEAR") {
+                            --$hn_codelen;
+                        }
+
+                        $hs_numberformat = substr($ps_format, $i + $hn_codelen, 4);
+                        $hs_year = $this->_formatNumber(
+                            $this->year,
+                            $hs_numberformat,
+                            $hn_codelen -
+                            $hn_thousandseps,
+                            $hb_nopad,
+                            $hb_nosign,
+                            $ps_locale,
+                            $hs_thousandsep
+                        );
+                        if (Pear::isError($hs_year)) {
+                            return $hs_year;
+                        }
+
+                        $ret .= $hs_year;
+                        $i += $hn_codelen + strlen($hs_numberformat);
+                    }
+
+                    break;
+                default:
+                    $ret .= $hs_char;
+                    ++$i;
+                    break;
+            }
+        }
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ formatLikeDate()
+
+    /**
+     * Formats the date according to the specified formatting code string,
+     * based on {@link http://www.php.net/date date()}
+     *
+     * All date() formatting options are supported except '<b>B</b>'.  This
+     * function also responds to the DATE_* constants, such as DATE_COOKIE,
+     * which are specified at:
+     *
+     *  {@link http://www.php.net/manual/en/datetime.constants.php}
+     *
+     *
+     * Formatting options:
+     *
+     * (Day)
+     *
+     *   - <b>d</b> - Day of the month, 2 digits with leading zeros (01 to 31)
+     *   - <b>D</b> - A textual representation of a day, three letters ('Mon'
+     *                to 'Sun')
+     *   - <b>j</b> - Day of the month without leading zeros (1 to 31)
+     *   - <b>l</b> - [lowercase 'L'] A full textual representation of the day
+     *                of the week ('Sunday' to 'Saturday')
+     *   - <b>N</b> - ISO-8601 numeric representation of the day of the week
+     *                (1 (for Monday) to 7 (for Sunday)) (see '<b>W</b>')
+     *   - <b>S</b> - English ordinal suffix for the day of the month, 2
+     *                characters ('st', 'nd', 'rd' or 'th')
+     *   - <b>w</b> - Numeric representation of the day of the week (0 (for
+     *                Sunday) to 6 (for Saturday))
+     *   - <b>z</b> - The day of the year, starting from 0 (0 to 365)
+     *
+     * (Week)
+     *
+     *   - <b>W</b> - {@link http://en.wikipedia.org/wiki/ISO_week_date ISO-8601}
+     *                week number of year, weeks starting on Monday (00 to 53)
+     *
+     * (Month)
+     *
+     *   - <b>F</b> - A full textual representation of a month ('January' to
+     *                'December')
+     *   - <b>m</b> - Numeric representation of a month, with leading zeros
+     *                (01 to 12)
+     *   - <b>M</b> - A short textual representation of a month, three letters
+     *                ('Jan' to 'Dec')
+     *   - <b>n</b> - Numeric representation of a month, without leading zeros
+     *                (1 to 12)
+     *   - <b>t</b> - Number of days in the given month (28 to 31)
+     *
+     * (Year)
+     *
+     *   - <b>L</b> - Whether it is a leap year (1 if it is a leap year, 0
+     *                otherwise)
+     *   - <b>o</b> - ISO-8601 year number (see '<b>W</b>'). This has the same
+     *                value as '<b>Y</b>', except that if the ISO week number
+     *                ('<b>W</b>') belongs to the previous or next year, that
+     *                year is used instead.
+     *   - <b>Y</b> - A full numeric representation of a year, 4 digits (0000
+     *                to 9999)
+     *   - <b>y</b> - A two digit representation of a year (00 to 99)
+     *
+     * (Time)
+     *
+     *   - <b>a</b> - Lowercase Ante meridiem and Post meridiem ('am' or
+     *                'pm')
+     *   - <b>A</b> - Uppercase Ante meridiem and Post meridiem ('AM' or
+     *                'PM')
+     *   - <b>g</b> - 12-hour format of an hour without leading zeros (1 to 12)
+     *   - <b>G</b> - 24-hour format of an hour without leading zeros (0 to 23)
+     *   - <b>h</b> - 12-hour format of an hour with leading zeros (01 to 12)
+     *   - <b>H</b> - 24-hour format of an hour with leading zeros (00 to 23)
+     *   - <b>i</b> - Minutes with leading zeros (00 to 59)
+     *   - <b>s</b> - Seconds, with leading zeros (00 to 59)
+     *   - <b>u</b> - Milliseconds, e.g. '54321'
+     *
+     * (Time Zone)
+     *
+     *   - <b>e</b> - Timezone identifier, e.g. Europe/London
+     *   - <b>I</b> - Whether or not the date is in Summer time (1 if Summer
+     *                time, 0 otherwise)
+     *   - <b>O</b> - Difference to Greenwich time (GMT) in hours, e.g. '+0200'
+     *   - <b>P</b> - Difference to Greenwich time (GMT) with colon between
+     *                hours and minutes, e.g. '+02:00'
+     *   - <b>T</b> - Timezone abbreviation, e.g. 'GMT', 'EST'
+     *   - <b>Z</b> - Timezone offset in seconds. The offset for timezones west
+     *                of UTC is always negative, and for those east of UTC is
+     *                always positive. (-43200 to 50400)
+     *
+     * (Full Date/Time)
+     *
+     *   - <b>c</b> - ISO 8601 date, e.g. '2004-02-12T15:19:21+00:00'
+     *   - <b>r</b> - RFC 2822 formatted date, e.g.
+     *                'Thu, 21 Dec 2000 16:01:07 +0200'
+     *   - <b>U</b> - Seconds since the Unix Epoch
+     *                (January 1 1970 00:00:00 GMT)
+     *
+     * @param string $ps_format the format string for returned date/time
+     *
+     * @return   string     date/time in given format
+     * @access   public
+     * @see      Date::format(), Date::formatLikeStrftime(), Date::formatLikeSQL()
+     * @since    Method available since Release 1.5.0
+     */
+    public function formatLikeDate($ps_format)
+    {
+        $hs_formatlikesqlstr = "";
+
+        for ($i = 0; $i < strlen($ps_format); ++$i) {
+            switch ($hs_char = substr($ps_format, $i, 1)) {
+                case 'd':
+                    $hs_formatlikesqlstr .= 'DD';
+                    break;
+                case 'D':
+                    $hs_formatlikesqlstr .= 'NPDy';
+                    break;
+                case 'j':
+                    $hs_formatlikesqlstr .= 'NPDD';
+                    break;
+                case 'l':
+                    $hs_formatlikesqlstr .= 'NPDay';
+                    break;
+                case 'N':
+                    $hs_formatlikesqlstr .= 'ID';
+                    break;
+                case 'S':
+                    $hs_formatlikesqlstr .= 'th';
+                    break;
+                case 'w':
+                    $hs_formatlikesqlstr .= 'D';
+                    break;
+                case 'z':
+                    $hs_formatlikesqlstr .= '"' . ($this->getDayOfYear() - 1) . '"';
+                    break;
+                case 'W':
+                    $hs_formatlikesqlstr .= 'IW';
+                    break;
+                case 'F':
+                    $hs_formatlikesqlstr .= 'NPMonth';
+                    break;
+                case 'm':
+                    $hs_formatlikesqlstr .= 'MM';
+                    break;
+                case 'M':
+                    $hs_formatlikesqlstr .= 'NPMon';
+                    break;
+                case 'n':
+                    $hs_formatlikesqlstr .= 'NPMM';
+                    break;
+                case 't':
+                    $hs_formatlikesqlstr .= '"' . $this->getDaysInMonth() . '"';
+                    break;
+                case 'L':
+                    $hs_formatlikesqlstr .= '"' . ($this->isLeapYear() ? 1 : 0) . '"';
+                    break;
+                case 'o':
+                    $hs_formatlikesqlstr .= 'IYYY';
+                    break;
+                case 'Y':
+                    $hs_formatlikesqlstr .= 'YYYY';
+                    break;
+                case 'y':
+                    $hs_formatlikesqlstr .= 'YY';
+                    break;
+                case 'a':
+                    $hs_formatlikesqlstr .= 'am';
+                    break;
+                case 'A':
+                    $hs_formatlikesqlstr .= 'AM';
+                    break;
+                case 'g':
+                    $hs_formatlikesqlstr .= 'NPHH12';
+                    break;
+                case 'G':
+                    $hs_formatlikesqlstr .= 'NPHH24';
+                    break;
+                case 'h':
+                    $hs_formatlikesqlstr .= 'HH12';
+                    break;
+                case 'H':
+                    $hs_formatlikesqlstr .= 'HH24';
+                    break;
+                case 'i':
+                    $hs_formatlikesqlstr .= 'MI';
+                    break;
+                case 's':
+                    $hs_formatlikesqlstr .= 'SS';
+                    break;
+                case 'u':
+                    $hs_formatlikesqlstr .= 'SSFFF';
+                    break;
+                case 'e':
+                    $hs_formatlikesqlstr .= 'TZR';
+                    break;
+                case 'I':
+                    $hs_formatlikesqlstr .= 'TZI';
+                    break;
+                case 'O':
+                    $hs_formatlikesqlstr .= 'STZHTZM';
+                    break;
+                case 'P':
+                    $hs_formatlikesqlstr .= 'STZH:TZM';
+                    break;
+                case 'T':
+                    $hs_formatlikesqlstr .= 'TZC';
+                    break;
+                case 'Z':
+                    $hs_formatlikesqlstr .= 'TZS';
+                    break;
+                case 'c':
+                    $hs_formatlikesqlstr .= 'YYYY-MM-DD"T"HH24:MI:SSSTZH:TZM';
+                    break;
+                case 'r':
+                    $hs_formatlikesqlstr .= 'Dy, DD Mon YYYY HH24:MI:SS STZHTZM';
+                    break;
+                case 'U':
+                    $hs_formatlikesqlstr .= 'U';
+                    break;
+                case '\\':
+                    $hs_char = substr($ps_format, ++$i, 1);
+                    $hs_formatlikesqlstr .= '"' .
+                        ($hs_char == '\\' ? '\\\\' : $hs_char) .
+                        '"';
+                    break;
+                case '"':
+                    $hs_formatlikesqlstr .= '"\\""';
+                    break;
+                default:
+                    $hs_formatlikesqlstr .= '"' . $hs_char . '"';
+            }
+        }
+
+        $ret = $this->formatLikeSQL($hs_formatlikesqlstr);
+        if (PEAR::isError($ret) &&
+            $ret->getCode() == DATE_ERROR_INVALIDFORMATSTRING) {
+            return PEAR::raiseError(
+                "Invalid date format '$ps_format'",
+                DATE_ERROR_INVALIDFORMATSTRING
+            );
+        }
+
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ setFromTime()
+
+    /**
+     * Sets the date/time using a Unix time-stamp
+     *
+     * This may only be valid for dates from 1970 to ~2038.  N.B. this
+     * function makes a call to {@link http://www.php.net/gmdate gmdate()}
+     *
+     * @param int $pn_timestamp Unix time-stamp
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::getTime(), Date::setDate()
+     */
+    public function setFromTime($pn_timestamp)
+    {
+        // Unix Time; N.B. Unix Time is defined relative to GMT,
+        // so it needs to be adjusted for the current time zone;
+        // however we do not know if it is in Summer time until
+        // we have converted it from Unix time:
+        //
+
+        // Get current time zone details:
+        //
+        $hs_id = $this->getTZID();
+
+        // Input Unix time as UTC:
+        //
+        $this->tz = new Date_TimeZone("UTC");
+        $this->setDate(gmdate("Y-m-d H:i:s", $pn_timestamp));
+
+        // Convert back to correct time zone:
+        //
+        $this->convertTZByID($hs_id);
+    }
+
+
+    // }}}
+    // {{{ getTime()
+
+    /**
+     * Returns the date/time as Unix time-stamp (as returned for example by
+     * {@link http://www.php.net/time time()})
+     *
+     * This may only be valid for dates from 1970 to ~2038.  N.B. this
+     * function makes a call to {@link http://www.php.net/gmmktime gmmktime()}
+     *
+     * @return   int        number of seconds since the Unix epoch
+     * @access   public
+     */
+    public function getTime()
+    {
+        if ($this->ob_invalidtime) {
+            $ret = $this->_getErrorInvalidTime();
+        } else {
+            // Use 'gmmktime()' and offset result (to get UTC):
+            //
+            return gmmktime(
+                    $this->on_standardhour,
+                    $this->on_standardminute,
+                    $this->on_standardsecond,
+                    $this->on_standardmonth,
+                    $this->on_standardday,
+                    $this->on_standardyear
+                ) -
+                $this->tz->getRawOffset() / 1000; // N.B. Unix-time excludes
+            // leap seconds by
+            // definition
+        }
+    }
+
+
+    // }}}
+    // {{{ getTZID()
+
+    /**
+     * Returns the unique ID of the time zone, e.g. 'America/Chicago'
+     *
+     * @return   string     the time zone ID
+     * @access   public
+     * @see      Date::setTZByID(), Date::getTZLongName(),
+     *            Date::getTZShortName(), Date_TimeZone
+     * @since    Method available since Release 1.5.0
+     */
+    public function getTZID()
+    {
+        return $this->tz->getID();
+    }
+
+
+    // }}}
+    // {{{ _setTZToDefault()
+
+    /**
+     * sets time zone to the default time zone
+     *
+     * If PHP version >= 5.1.0, uses date_default_timezone_get(),
+     * else the value returned by
+     * '{@link http://www.php.net/date date("e")}'
+     * if valid, else the default specified if the global
+     * constant '$GLOBALS["_DATE_TIMEZONE_DEFAULT"]', which if itself
+     * left unset, defaults to "UTC".
+     *
+     * N.B. this is a private method; to set the time zone to the
+     * default publicly you should call '{@link Date::setTZByID()}',
+     * that is, with no parameter (or a parameter of null).
+     *
+     * @return   void
+     * @access   private
+     * @since    Method available since Release 1.5.0
+     */
+    public function _setTZToDefault()
+    {
+        if (function_exists('version_compare') &&
+            version_compare(phpversion(), "5.1.0", ">=") &&
+            (
+                Date_TimeZone::isValidID($hs_id = date_default_timezone_get()) ||
+                Date_TimeZone::isValidID($hs_id = date("e"))
+            )
+        ) {
+            $this->tz = new Date_TimeZone($hs_id);
+        } else {
+            $this->tz = Date_TimeZone::getDefault();
+        }
+    }
+
+
+    // }}}
+    // {{{ 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
+     * {@link Date::convertTZ()}.
+     *
+     * @param object $tz the Date_TimeZone object to use.  If called with a
+     *                    parameter that is not a Date_TimeZone object, will
+     *                    fall through to setTZByID().
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setTZByID(), Date::convertTZ(),
+     *            Date_TimeZone::Date_TimeZone(), Date_TimeZone
+     */
+    public function setTZ($tz)
+    {
+        if (is_a($tz, 'Date_Timezone')) {
+            $this->setTZByID($tz->getID());
+        } else {
+            $res = $this->setTZByID($tz);
+            if (PEAR::isError($res)) {
+                return $res;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ setTZByID()
+
+    /**
+     * Sets the time zone of this date with the given time zone ID
+     *
+     * The time zone IDs are drawn from the 'tz data-base' (see
+     * {@link http://en.wikipedia.org/wiki/Zoneinfo}), which is the de facto
+     * internet and IT standard.  (There is no official standard, and
+     * the tz data-base is not intended to be a regulating body
+     * anyway.)  Lists of valid IDs are maintained at:
+     *
+     *  - {@link http://en.wikipedia.org/wiki/List_of_zoneinfo_timezones}
+     *  - {@link http://www.php.net/manual/en/timezones.php}
+     *
+     * If no time-zone is specified and PHP version >= 5.1.0, the time
+     * zone is set automatically to the output of date_default_timezone_get()
+     * if set and valid, else the value returned by
+     * '{@link http://www.php.net/date date("e")}'
+     * if valid, else the default specified if the global
+     * constant '$GLOBALS["_DATE_TIMEZONE_DEFAULT"]', which if itself
+     * left unset, defaults to "UTC".
+     *
+     * N.B. this function preserves the local date and time, that is,
+     * whether in local Summer time or local standard time.  For example,
+     * if the time is set to 11.00 Summer time, and the time zone is then
+     * set to another time zone, using this function, in which the date
+     * falls in standard time, then the time will remain set to 11.00 UTC,
+     * and not 10.00.  You can convert a date to another time zone by
+     * calling '{@link Date::convertTZ()}', which preserves the actual
+     * time as measured against UTC.
+     *
+     * The ID can also be specified as a UTC offset in one of the following
+     * forms, i.e. an offset with no geographical or political base:
+     *
+     *  - <b>UTC[+/-][h]</b>       - e.g. UTC-1     (the preferred form)
+     *  - <b>UTC[+/-][hh]</b>      - e.g. UTC+03
+     *  - <b>UTC[+/-][hh][mm]</b>  - e.g. UTC-0530
+     *  - <b>UTC[+/-][hh]:[mm]</b> - e.g. UTC+03:00
+     *
+     * N.B. 'UTC' seems to be technically preferred over 'GMT'.  GMT-based
+     * IDs still exist in the tz data-base, but beware of POSIX-style
+     * offsets which are the opposite way round to what people normally
+     * expect.
+     *
+     * @param string $ps_id a valid time zone id, e.g. 'Europe/London'
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::getTZID(), Date::setTZ(), Date::convertTZByID(),
+     *            Date_TimeZone::isValidID(), Date_TimeZone::Date_TimeZone(),
+     *            Date_TimeZone
+     */
+    public function setTZByID($ps_id = null)
+    {
+        // Whether the date is in Summer time forms the default for
+        // the new time zone (if needed, which is very unlikely anyway).
+        // This is mainly to prevent unexpected (defaulting) behaviour
+        // if the user is in the repeated hour, and switches to a time
+        // zone that is also in the repeated hour (e.g. 'Europe/London'
+        // and 'Europe/Lisbon').
+        //
+        $hb_insummertime = $this->inDaylightTime();
+        if (PEAR::isError($hb_insummertime)) {
+            if ($hb_insummertime->getCode() == DATE_ERROR_INVALIDTIME) {
+                $hb_insummertime = false;
+            } else {
+                return $hb_insummertime;
+            }
+        }
+
+        if (is_null($ps_id)) {
+            $this->_setTZToDefault();
+        } elseif (Date_TimeZone::isValidID($ps_id)) {
+            $this->tz = new Date_TimeZone($ps_id);
+        } else {
+            return PEAR::raiseError(
+                "Invalid time zone ID '$ps_id'",
+                DATE_ERROR_INVALIDTIMEZONE
+            );
+        }
+
+        $this->setLocalTime(
+            $this->day,
+            $this->month,
+            $this->year,
+            $this->hour,
+            $this->minute,
+            $this->second,
+            $this->partsecond,
+            $hb_insummertime
+        );
+    }
+
+
+    // }}}
+    // {{{ getTZLongName()
+
+    /**
+     * Returns the long name of the time zone
+     *
+     * Returns long form of time zone name, e.g. 'Greenwich Mean Time'.
+     * N.B. if the date falls in Summer time, the Summer time name will be
+     * returned instead, e.g. 'British Summer Time'.
+     *
+     * N.B. this is not a unique identifier for the time zone - for this
+     * purpose use the time zone ID.
+     *
+     * @return   string     the long name of the time zone
+     * @access   public
+     * @see      Date::getTZID(), Date::getTZShortName(),
+     *            Date_TimeZone::getLongName()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getTZLongName()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->tz->getLongName($this->inDaylightTime());
+    }
+
+
+    // }}}
+    // {{{ getTZShortName()
+
+    /**
+     * Returns the short name of the time zone
+     *
+     * Returns abbreviated form of time zone name, e.g. 'GMT'.  N.B. if the
+     * date falls in Summer time, the Summer time name will be returned
+     * instead, e.g. 'BST'.
+     *
+     * N.B. this is not a unique identifier - for this purpose use the
+     * time zone ID.
+     *
+     * @return   string     the short name of the time zone
+     * @access   public
+     * @see      Date::getTZID(), Date::getTZLongName(),
+     *            Date_TimeZone::getShortName()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getTZShortName()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->tz->getShortName($this->inDaylightTime());
+    }
+
+
+    // }}}
+    // {{{ getTZOffset()
+
+    /**
+     * Returns the DST-corrected offset from UTC for the given date
+     *
+     * Gets 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.
+     *
+     * N.B. that the offset is calculated historically
+     * and in the future according to the current Summer time rules,
+     * and so this function is proleptically correct, but not necessarily
+     * historically correct.  (Although if you want to be correct about
+     * times in the distant past, this class is probably not for you
+     * because the whole notion of time zones does not apply, and
+     * historically there are so many time zone changes, Summer time
+     * rule changes, name changes, calendar changes, that calculating
+     * this sort of information is beyond the scope of this package
+     * altogether.)
+     *
+     * @return   int        the corrected offset to UTC in milliseconds
+     * @access   public
+     * @see      Date_TimeZone::getOffset()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getTZOffset()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->tz->getOffset($this->inDaylightTime());
+    }
+
+
+    // }}}
+    // {{{ 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.
+     *
+     * @param bool $pb_repeatedhourdefault value to return if repeated hour is
+     *                                      specified (defaults to false)
+     *
+     * @return   boolean    true if DST is in effect for this date
+     * @access   public
+     * @see      Date_TimeZone::hasDaylightTime(), Date_TimeZone::inDaylightTime()
+     */
+    public function inDaylightTime($pb_repeatedhourdefault = false)
+    {
+        if (!$this->tz->hasDaylightTime()) {
+            return false;
+        }
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        // The return value is 'cached' whenever the date/time is set:
+        //
+        return $this->hour != $this->on_standardhour ||
+            $this->minute != $this->on_standardminute ||
+            $this->second != $this->on_standardsecond ||
+            $this->partsecond != $this->on_standardpartsecond ||
+            $this->day != $this->on_standardday ||
+            $this->month != $this->on_standardmonth ||
+            $this->year != $this->on_standardyear;
+        //
+        // (these last 3 conditions are theoretical
+        // possibilities but normally will never occur)
+    }
+
+
+    // }}}
+    // {{{ convertTZ()
+
+    /**
+     * Converts this date to a new time zone
+     *
+     * Previously this might not have worked correctly if your system did
+     * not allow {@link http://www.php.net/putenv putenv()} or if
+     * {@link http://www.php.net/localtime localtime()} did not work in
+     * your environment, but this implementation is no longer used.
+     *
+     * @param object $tz Date_TimeZone object to convert to
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::convertTZByID(), Date::toUTC(),
+     *            Date_TimeZone::Date_TimeZone(), Date_TimeZone
+     */
+    public function convertTZ($tz)
+    {
+        if ($this->getTZID() == $tz->getID()) {
+            return;
+        }
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        $hn_rawoffset = $tz->getRawOffset() - $this->tz->getRawOffset();
+        $this->tz = new Date_TimeZone($tz->getID());
+
+        list($hn_standardyear,
+            $hn_standardmonth,
+            $hn_standardday,
+            $hn_standardhour,
+            $hn_standardminute,
+            $hn_standardsecond,
+            $hn_standardpartsecond) =
+            $this->_addOffset(
+                $hn_rawoffset,
+                $this->on_standardday,
+                $this->on_standardmonth,
+                $this->on_standardyear,
+                $this->on_standardhour,
+                $this->on_standardminute,
+                $this->on_standardsecond,
+                $this->on_standardpartsecond
+            );
+
+        $this->setStandardTime(
+            $hn_standardday,
+            $hn_standardmonth,
+            $hn_standardyear,
+            $hn_standardhour,
+            $hn_standardminute,
+            $hn_standardsecond,
+            $hn_standardpartsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ toUTC()
+
+    /**
+     * Converts this date to UTC and sets this date's timezone to UTC
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::convertTZ(), Date::convertTZByID(), Date::toUTCbyOffset()
+     */
+    public function toUTC()
+    {
+        if ($this->getTZID() == "UTC") {
+            return;
+        }
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        $res = $this->convertTZ(new Date_TimeZone("UTC"));
+        if (PEAR::isError($res)) {
+            return $res;
+        }
+    }
+
+
+    // }}}
+    // {{{ convertTZByID()
+
+    /**
+     * Converts this date to a new time zone, given a valid time zone ID
+     *
+     * Previously this might not have worked correctly if your system did
+     * not allow {@link http://www.php.net/putenv putenv()} or if
+     * {@link http://www.php.net/localtime localtime()} did not work
+     * in your environment, but this implementation is no longer used.
+     *
+     * @param string $ps_id a valid time zone id, e.g. 'Europe/London'
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::convertTZ(), Date::toUTC(), Date::setTZByID(),
+     *            Date_TimeZone::isValidID(), Date_TimeZone::Date_TimeZone(),
+     *            Date_TimeZone
+     */
+    public function convertTZByID($ps_id)
+    {
+        if (!Date_TimeZone::isValidID($ps_id)) {
+            return PEAR::raiseError(
+                "Invalid time zone ID '$ps_id'",
+                DATE_ERROR_INVALIDTIMEZONE
+            );
+        }
+
+        $res = $this->convertTZ(new Date_TimeZone($ps_id));
+
+        if (PEAR::isError($res)) {
+            return $res;
+        }
+    }
+
+
+    // }}}
+    // {{{ toUTCbyOffset()
+
+    /**
+     * Converts the date/time to UTC by the offset specified
+     *
+     * This function is no longer called from within the Date class
+     * itself because a time zone can be set using a pure offset
+     * (e.g. UTC+1), i.e. not a geographical time zone.  However
+     * it is retained for backwards compaibility.
+     *
+     * @param string $ps_offset offset of the form '<b>[+/-][hh]:[mm]</b>',
+     *                           '<b>[+/-][hh][mm]</b>', or '<b>Z</b>'
+     *
+     * @return   bool
+     * @access   private
+     * @see      Date::toUTC(), Date::convertTZ(), Date::convertTZByID()
+     */
+    public function toUTCbyOffset($ps_offset)
+    {
+        if ($ps_offset == "Z" ||
+            preg_match('/^[+\-](00:?00|0{1,2})$/', $ps_offset)) {
+            $hs_tzid = "UTC";
+        } elseif (preg_match(
+            '/^[+\-]([0-9]{2,2}:?[0-5][0-9]|[0-9]{1,2})$/',
+            $ps_offset
+        )) {
+            $hs_tzid = "UTC" . $ps_offset;
+        } else {
+            return PEAR::raiseError("Invalid offset '$ps_offset'");
+        }
+
+        // If the time is invalid, it does not matter here:
+        //
+        $this->setTZByID($hs_tzid);
+
+        // Now the time will be valid because it is a time zone that
+        // does not observe Summer time:
+        //
+        $this->toUTC();
+    }
+
+
+    // }}}
+    // {{{ addYears()
+
+    /**
+     * Converts the date to the specified no of years from the given date
+     *
+     * To subtract years use a negative value for the '$pn_years'
+     * parameter
+     *
+     * @param int $pn_years years to add
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function addYears($pn_years)
+    {
+        list($hs_year, $hs_month, $hs_day) =
+            explode(" ", Date_Calc::addYears(
+                $pn_years,
+                $this->day,
+                $this->month,
+                $this->year,
+                "%Y %m %d"
+            ));
+        $this->setLocalTime(
+            $hs_day,
+            $hs_month,
+            $hs_year,
+            $this->hour,
+            $this->minute,
+            $this->second,
+            $this->partsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ addMonths()
+
+    /**
+     * Converts the date to the specified no of months from the given date
+     *
+     * To subtract months use a negative value for the '$pn_months'
+     * parameter
+     *
+     * @param int $pn_months months to add
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function addMonths($pn_months)
+    {
+        list($hs_year, $hs_month, $hs_day) =
+            explode(" ", Date_Calc::addMonths(
+                $pn_months,
+                $this->day,
+                $this->month,
+                $this->year,
+                "%Y %m %d"
+            ));
+        $this->setLocalTime(
+            $hs_day,
+            $hs_month,
+            $hs_year,
+            $this->hour,
+            $this->minute,
+            $this->second,
+            $this->partsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ addDays()
+
+    /**
+     * Converts the date to the specified no of days from the given date
+     *
+     * To subtract days use a negative value for the '$pn_days' parameter
+     *
+     * @param int $pn_days days to add
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function addDays($pn_days)
+    {
+        list($hs_year, $hs_month, $hs_day) =
+            explode(" ", Date_Calc::addDays(
+                $pn_days,
+                $this->day,
+                $this->month,
+                $this->year,
+                "%Y %m %d"
+            ));
+        $this->setLocalTime(
+            $hs_day,
+            $hs_month,
+            $hs_year,
+            $this->hour,
+            $this->minute,
+            $this->second,
+            $this->partsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ addHours()
+
+    /**
+     * Converts the date to the specified no of hours from the given date
+     *
+     * To subtract hours use a negative value for the '$pn_hours' parameter
+     *
+     * @param int $pn_hours hours to add
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function addHours($pn_hours)
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        list($hn_standardyear,
+            $hn_standardmonth,
+            $hn_standardday,
+            $hn_standardhour) =
+            Date_Calc::addHours(
+                $pn_hours,
+                $this->on_standardday,
+                $this->on_standardmonth,
+                $this->on_standardyear,
+                $this->on_standardhour
+            );
+
+        $this->setStandardTime(
+            $hn_standardday,
+            $hn_standardmonth,
+            $hn_standardyear,
+            $hn_standardhour,
+            $this->on_standardminute,
+            $this->on_standardsecond,
+            $this->on_standardpartsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ addMinutes()
+
+    /**
+     * Converts the date to the specified no of minutes from the given date
+     *
+     * To subtract minutes use a negative value for the '$pn_minutes' parameter
+     *
+     * @param int $pn_minutes minutes to add
+     *
+     * @return   void
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function addMinutes($pn_minutes)
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        list($hn_standardyear,
+            $hn_standardmonth,
+            $hn_standardday,
+            $hn_standardhour,
+            $hn_standardminute) =
+            Date_Calc::addMinutes(
+                $pn_minutes,
+                $this->on_standardday,
+                $this->on_standardmonth,
+                $this->on_standardyear,
+                $this->on_standardhour,
+                $this->on_standardminute
+            );
+
+        $this->setStandardTime(
+            $hn_standardday,
+            $hn_standardmonth,
+            $hn_standardyear,
+            $hn_standardhour,
+            $hn_standardminute,
+            $this->on_standardsecond,
+            $this->on_standardpartsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ addSeconds()
+
+    /**
+     * Adds a given number of seconds to the date
+     *
+     * @param mixed $sec the no of seconds to add as integer or float
+     * @param bool $pb_countleap whether to count leap seconds (defaults to
+     *                             value of count-leap-second object property)
+     *
+     * @return   void
+     * @access   public
+     */
+    public function addSeconds($sec, $pb_countleap = null)
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+        if (!is_int($sec) && !is_float($sec)) {
+            settype($sec, 'int');
+        }
+        if (!is_null($pb_countleap)) {
+            $pb_countleap = $this->ob_countleapseconds;
+        }
+
+        if ($pb_countleap) {
+            // Convert to UTC:
+            //
+            list($hn_standardyear,
+                $hn_standardmonth,
+                $hn_standardday,
+                $hn_standardhour,
+                $hn_standardminute,
+                $hn_standardsecond,
+                $hn_standardpartsecond) =
+                $this->_addOffset(
+                    $this->tz->getRawOffset() * -1,
+                    $this->on_standardday,
+                    $this->on_standardmonth,
+                    $this->on_standardyear,
+                    $this->on_standardhour,
+                    $this->on_standardminute,
+                    $this->on_standardsecond,
+                    $this->on_standardpartsecond
+                );
+            list($hn_standardyear,
+                $hn_standardmonth,
+                $hn_standardday,
+                $hn_standardhour,
+                $hn_standardminute,
+                $hn_secondraw) =
+                Date_Calc::addSeconds(
+                    $sec,
+                    $hn_standardday,
+                    $hn_standardmonth,
+                    $hn_standardyear,
+                    $hn_standardhour,
+                    $hn_standardminute,
+                    $hn_standardpartsecond == 0.0 ?
+                        $hn_standardsecond :
+                        $hn_standardsecond +
+                        $hn_standardpartsecond,
+                    $pb_countleap
+                );
+
+            if (is_float($hn_secondraw)) {
+                $hn_standardsecond = intval($hn_secondraw);
+                $hn_standardpartsecond = $hn_secondraw - $hn_standardsecond;
+            } else {
+                $hn_standardsecond = $hn_secondraw;
+                $hn_standardpartsecond = 0.0;
+            }
+
+            list($hn_standardyear,
+                $hn_standardmonth,
+                $hn_standardday,
+                $hn_standardhour,
+                $hn_standardminute,
+                $hn_standardsecond,
+                $hn_standardpartsecond) =
+                $this->_addOffset(
+                    $this->tz->getRawOffset(),
+                    $hn_standardday,
+                    $hn_standardmonth,
+                    $hn_standardyear,
+                    $hn_standardhour,
+                    $hn_standardminute,
+                    $hn_standardsecond,
+                    $hn_standardpartsecond
+                );
+        } else {
+            // Use local standard time:
+            //
+            list($hn_standardyear,
+                $hn_standardmonth,
+                $hn_standardday,
+                $hn_standardhour,
+                $hn_standardminute,
+                $hn_secondraw) =
+                Date_Calc::addSeconds(
+                    $sec,
+                    $this->on_standardday,
+                    $this->on_standardmonth,
+                    $this->on_standardyear,
+                    $this->on_standardhour,
+                    $this->on_standardminute,
+                    $this->on_standardpartsecond == 0.0 ?
+                        $this->on_standardsecond :
+                        $this->on_standardsecond +
+                        $this->on_standardpartsecond,
+                    false
+                );
+
+            if (is_float($hn_secondraw)) {
+                $hn_standardsecond = intval($hn_secondraw);
+                $hn_standardpartsecond = $hn_secondraw - $hn_standardsecond;
+            } else {
+                $hn_standardsecond = $hn_secondraw;
+                $hn_standardpartsecond = 0.0;
+            }
+        }
+
+        $this->setStandardTime(
+            $hn_standardday,
+            $hn_standardmonth,
+            $hn_standardyear,
+            $hn_standardhour,
+            $hn_standardminute,
+            $hn_standardsecond,
+            $hn_standardpartsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ subtractSeconds()
+
+    /**
+     * Subtracts a given number of seconds from the date
+     *
+     * @param mixed $sec the no of seconds to subtract as integer or
+     *                             float
+     * @param bool $pb_countleap whether to count leap seconds (defaults to
+     *                             value of count-leap-second object property)
+     *
+     * @return   void
+     * @access   public
+     */
+    public function subtractSeconds($sec, $pb_countleap = null)
+    {
+        if (is_null($pb_countleap)) {
+            $pb_countleap = $this->ob_countleapseconds;
+        }
+
+        $res = $this->addSeconds(-$sec, $pb_countleap);
+
+        if (PEAR::isError($res)) {
+            return $res;
+        }
+    }
+
+
+    // }}}
+    // {{{ addSpan()
+
+    /**
+     * Adds a time span to the date
+     *
+     * A time span is defined as a unsigned no of days, hours, minutes
+     * and seconds, where the no of minutes and seconds must be less than
+     * 60, and the no of hours must be less than 24.
+     *
+     * A span is added (and subtracted) according to the following logic:
+     *
+     *  Hours, minutes and seconds are added such that if they fall over
+     *   a leap second, the leap second is ignored, and not counted.
+     *   For example, if a leap second occurred at 23.59.60, the
+     *   following calculations:
+     *
+     *    - 23.59.59 + one second
+     *    - 23.59.00 + one minute
+     *    - 23.00.00 + one hour
+     *
+     *   would all produce 00.00.00 the next day.
+     *
+     *  A day is treated as equivalent to 24 hours, so if the clocks
+     *   went backwards at 01.00, and one day was added to the time
+     *   00.30, the result would be 23.30 the same day.
+     *
+     * This is the implementation which is thought to yield the behaviour
+     * that the user is most likely to expect, or in another way of
+     * looking at it, it is the implementation that produces the least
+     * unexpected behaviour.  It basically works in hours, that is, a day
+     * is treated as exactly equivalent to 24 hours, and minutes and
+     * seconds are treated as equivalent to 1/60th and 1/3600th of an
+     * hour.  It should be obvious that working in days is impractical;
+     * working in seconds is problematic when it comes to adding days
+     * that fall over leap seconds, where it would appear to most users
+     * that the function adds only 23 hours, 59 minutes and 59 seconds.
+     * It is also problematic to work in any kind of mixture of days,
+     * hours, minutes, and seconds, because then the addition of a span
+     * would sometimes depend on which order you add the constituent
+     * parts, which undermines the concept of a span altogether.
+     *
+     * If you want alternative functionality, you must use a mixture of
+     * the following functions instead:
+     *
+     *  - {@link Date::addYears()}
+     *  - {@link Date::addMonths()}
+     *  - {@link Date::addDays()}
+     *  - {@link Date::addHours()}
+     *  - {@link Date::addMinutes()}
+     *  - {@link Date::addSeconds()}
+     *
+     * @param object $span the time span to add
+     *
+     * @return   void
+     * @access   public
+     * @see      Date_Span
+     */
+    public function addSpan($span)
+    {
+        if (!is_a($span, 'Date_Span')) {
+            return PEAR::raiseError("Invalid argument - not 'Date_Span' object");
+        } elseif ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        $hn_days = $span->day;
+        $hn_standardhour = $this->on_standardhour + $span->hour;
+        $hn_standardminute = $this->on_standardminute + $span->minute;
+        $hn_standardsecond = $this->on_standardsecond + $span->second;
+
+        if ($hn_standardsecond >= 60) {
+            ++$hn_standardminute;
+            $hn_standardsecond -= 60;
+        }
+
+        if ($hn_standardminute >= 60) {
+            ++$hn_standardhour;
+            $hn_standardminute -= 60;
+        }
+
+        if ($hn_standardhour >= 24) {
+            ++$hn_days;
+            $hn_standardhour -= 24;
+        }
+
+        list($hn_standardyear, $hn_standardmonth, $hn_standardday) =
+            explode(
+                " ",
+                Date_Calc::addDays(
+                    $hn_days,
+                    $this->on_standardday,
+                    $this->on_standardmonth,
+                    $this->on_standardyear,
+                    "%Y %m %d"
+                )
+            );
+
+        $this->setStandardTime(
+            $hn_standardday,
+            $hn_standardmonth,
+            $hn_standardyear,
+            $hn_standardhour,
+            $hn_standardminute,
+            $hn_standardsecond,
+            $this->on_standardpartsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ subtractSpan()
+
+    /**
+     * Subtracts a time span from the date
+     *
+     * N.B. it is impossible for this function to count leap seconds,
+     * because the result would be dependent on which order the consituent
+     * parts of the span are subtracted from the date.  Therefore, leap
+     * seconds are ignored by this function.  If you want to count leap
+     * seconds, use {@link Date::subtractSeconds()}.
+     *
+     * @param object $span the time span to subtract
+     *
+     * @return   void
+     * @access   public
+     * @see      Date_Span
+     */
+    public function subtractSpan($span)
+    {
+        if (!is_a($span, 'Date_Span')) {
+            return PEAR::raiseError("Invalid argument - not 'Date_Span' object");
+        } elseif ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        $hn_days = -$span->day;
+        $hn_standardhour = $this->on_standardhour - $span->hour;
+        $hn_standardminute = $this->on_standardminute - $span->minute;
+        $hn_standardsecond = $this->on_standardsecond - $span->second;
+
+        if ($hn_standardsecond < 0) {
+            --$hn_standardminute;
+            $hn_standardsecond += 60;
+        }
+
+        if ($hn_standardminute < 0) {
+            --$hn_standardhour;
+            $hn_standardminute += 60;
+        }
+
+        if ($hn_standardhour < 0) {
+            --$hn_days;
+            $hn_standardhour += 24;
+        }
+
+        list($hn_standardyear, $hn_standardmonth, $hn_standardday) =
+            explode(
+                " ",
+                Date_Calc::addDays(
+                    $hn_days,
+                    $this->on_standardday,
+                    $this->on_standardmonth,
+                    $this->on_standardyear,
+                    "%Y %m %d"
+                )
+            );
+
+        $this->setStandardTime(
+            $hn_standardday,
+            $hn_standardmonth,
+            $hn_standardyear,
+            $hn_standardhour,
+            $hn_standardminute,
+            $hn_standardsecond,
+            $this->on_standardpartsecond
+        );
+    }
+
+
+    // }}}
+    // {{{ dateDiff()
+
+    /**
+     * Subtract supplied date and return answer in days
+     *
+     * If the second parameter '$pb_ignoretime' is specified as false, the time
+     * parts of the two dates will be ignored, and the integral no of days
+     * between the day/month/year parts of the two dates will be returned.  If
+     * either of the two dates have an invalid time, the integral no of days
+     * will also be returned, else the returned value will be the no of days as
+     * a float, with each hour being treated as 1/24th of a day and so on.
+     *
+     * For example,
+     *
+     *  - 21/11/2007 13.00 minus 21/11/2007 01.00
+     *
+     * returns 0.5
+     *
+     * Note that if the passed date is in the past, a positive value will be
+     * returned, and if it is in the future, a negative value will be returned.
+     *
+     * @param object $po_date date to subtract
+     * @param bool $pb_ignoretime whether to ignore the time values of the two
+     *                               dates in subtraction (defaults to false)
+     *
+     * @return   mixed      days between two dates as int or float
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function dateDiff($po_date, $pb_ignoretime = false)
+    {
+        if ($pb_ignoretime || $this->ob_invalidtime) {
+            return Date_Calc::dateToDays(
+                    $this->day,
+                    $this->month,
+                    $this->year
+                ) -
+                Date_Calc::dateToDays(
+                    $po_date->getDay(),
+                    $po_date->getMonth(),
+                    $po_date->getYear()
+                );
+        }
+
+        $hn_secondscompare = $po_date->getStandardSecondsPastMidnight();
+        if (PEAR::isError($hn_secondscompare)) {
+            if ($hn_secondscompare->getCode() != DATE_ERROR_INVALIDTIME) {
+                return $hn_secondscompare;
+            }
+
+            return Date_Calc::dateToDays(
+                    $this->day,
+                    $this->month,
+                    $this->year
+                ) -
+                Date_Calc::dateToDays(
+                    $po_date->getDay(),
+                    $po_date->getMonth(),
+                    $po_date->getYear()
+                );
+        }
+
+        $hn_seconds = $this->getStandardSecondsPastMidnight();
+
+        // If time parts are equal, return int, else return float:
+        //
+        return Date_Calc::dateToDays(
+                $this->on_standardday,
+                $this->on_standardmonth,
+                $this->on_standardyear
+            ) -
+            Date_Calc::dateToDays(
+                $po_date->getStandardDay(),
+                $po_date->getStandardMonth(),
+                $po_date->getStandardYear()
+            ) +
+            ($hn_seconds == $hn_secondscompare ? 0 :
+                ($hn_seconds - $hn_secondscompare) / 86400);
+    }
+
+
+    // }}}
+    // {{{ inEquivalentTimeZones()
+
+    /**
+     * Tests whether two dates are in equivalent time zones
+     *
+     * Equivalence in this context consists in the time zones of the two dates
+     * having:
+     *
+     *  - an equal offset from UTC in both standard and Summer time (if
+     *               the time zones observe Summer time)
+     *  - the same Summer time start and end rules, that is, the two time zones
+     *               must switch from standard time to Summer time, and
+     *               vice versa, on the same day and at the same time
+     *
+     * An example of two equivalent time zones is 'Europe/London' and
+     * 'Europe/Lisbon', which in London is known as GMT/BST, and in Lisbon as
+     * WET/WEST.
+     *
+     * @param object $po_date1 the first Date object to compare
+     * @param object $po_date2 the second Date object to compare
+     *
+     * @return   bool       true if the time zones are equivalent
+     * @access   public
+     * @static
+     * @see      Date_TimeZone::isEquivalent()
+     * @since    Method available since Release 1.5.0
+     */
+    public function inEquivalentTimeZones($po_date1, $po_date2)
+    {
+        return $po_date1->tz->isEquivalent($po_date2->getTZID());
+    }
+
+
+    // }}}
+    // {{{ compare()
+
+    /**
+     * Compares two dates
+     *
+     * Suitable for use in sorting functions
+     *
+     * @param object $od1 the first Date object to compare
+     * @param object $od2 the second Date object to compare
+     *
+     * @return   int        0 if the dates are equal, -1 if '$od1' is
+     *                       before '$od2', 1 if '$od1' is after '$od2'
+     * @access   public
+     * @static
+     */
+    public function compare($od1, $od2)
+    {
+        $d1 = new Date($od1);
+        $d2 = new Date($od2);
+
+        // If the time zones are equivalent, do nothing:
+        //
+        if (!Date::inEquivalentTimeZones($d1, $d2)) {
+            // Only a time zone with a valid time can be converted:
+            //
+            if ($d2->isValidTime()) {
+                $d2->convertTZByID($d1->getTZID());
+            } elseif ($d1->isValidTime()) {
+                $d1->convertTZByID($d2->getTZID());
+            } else {
+                // No comparison can be made without guessing the time:
+                //
+                return PEAR::raiseError(
+                    "Both dates have invalid time",
+                    DATE_ERROR_INVALIDTIME
+                );
+            }
+        }
+
+        $days1 = Date_Calc::dateToDays(
+            $d1->getDay(),
+            $d1->getMonth(),
+            $d1->getYear()
+        );
+        $days2 = Date_Calc::dateToDays(
+            $d2->getDay(),
+            $d2->getMonth(),
+            $d2->getYear()
+        );
+        if ($days1 < $days2) {
+            return -1;
+        }
+        if ($days1 > $days2) {
+            return 1;
+        }
+
+        $hn_hour1 = $d1->getStandardHour();
+        if (PEAR::isError($hn_hour1)) {
+            return $hn_hour1;
+        }
+        $hn_hour2 = $d2->getStandardHour();
+        if (PEAR::isError($hn_hour2)) {
+            return $hn_hour2;
+        }
+
+        if ($hn_hour1 < $hn_hour2) {
+            return -1;
+        }
+        if ($hn_hour1 > $hn_hour2) {
+            return 1;
+        }
+        if ($d1->getStandardMinute() < $d2->getStandardMinute()) {
+            return -1;
+        }
+        if ($d1->getStandardMinute() > $d2->getStandardMinute()) {
+            return 1;
+        }
+        if ($d1->getStandardSecond() < $d2->getStandardSecond()) {
+            return -1;
+        }
+        if ($d1->getStandardSecond() > $d2->getStandardSecond()) {
+            return 1;
+        }
+        if ($d1->getStandardPartSecond() < $d2->getStandardPartSecond()) {
+            return -1;
+        }
+        if ($d1->getStandardPartSecond() > $d2->getStandardPartSecond()) {
+            return 1;
+        }
+        return 0;
+    }
+
+
+    // }}}
+    // {{{ before()
+
+    /**
+     * Test if this date/time is before a certain date/time
+     *
+     * @param object $when the Date object to test against
+     *
+     * @return   boolean    true if this date is before $when
+     * @access   public
+     */
+    public function before($when)
+    {
+        $hn_compare = Date::compare($this, $when);
+        if (PEAR::isError($hn_compare)) {
+            return $hn_compare;
+        }
+
+        if ($hn_compare == -1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    // }}}
+    // {{{ after()
+
+    /**
+     * Test if this date/time is after a certain date/time
+     *
+     * @param object $when the Date object to test against
+     *
+     * @return   boolean    true if this date is after $when
+     * @access   public
+     */
+    public function after($when)
+    {
+        $hn_compare = Date::compare($this, $when);
+        if (PEAR::isError($hn_compare)) {
+            return $hn_compare;
+        }
+
+        if ($hn_compare == 1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    // }}}
+    // {{{ equals()
+
+    /**
+     * Test if this date/time is exactly equal to a certain date/time
+     *
+     * @param object $when the Date object to test against
+     *
+     * @return   boolean    true if this date is exactly equal to $when
+     * @access   public
+     */
+    public function equals($when)
+    {
+        $hn_compare = Date::compare($this, $when);
+        if (PEAR::isError($hn_compare)) {
+            return $hn_compare;
+        }
+
+        if ($hn_compare == 0) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    // }}}
+    // {{{ isFuture()
+
+    /**
+     * Determine if this date is in the future
+     *
+     * @return   boolean    true if this date is in the future
+     * @access   public
+     */
+    public function isFuture()
+    {
+        $now = new Date();
+        return $this->after($now);
+    }
+
+
+    // }}}
+    // {{{ isPast()
+
+    /**
+     * Determine if this date is in the past
+     *
+     * @return   boolean    true if this date is in the past
+     * @access   public
+     */
+    public function isPast()
+    {
+        $now = new Date();
+        return $this->before($now);
+    }
+
+
+    // }}}
+    // {{{ isLeapYear()
+
+    /**
+     * Determine if the year in this date is a leap year
+     *
+     * @return   boolean    true if this year is a leap year
+     * @access   public
+     */
+    public function isLeapYear()
+    {
+        return Date_Calc::isLeapYear($this->year);
+    }
+
+
+    // }}}
+    // {{{ getJulianDate()
+
+    /**
+     * Returns the no of days (1-366) since 31st December of the previous year
+     *
+     * N.B. this function does not return (and never has returned) the 'Julian
+     * Date', as described, for example, at:
+     *
+     *  - {@link http://en.wikipedia.org/wiki/Julian_day}
+     *
+     * If you want the day of the year (0-366), use {@link Date::getDayOfYear()}
+     * instead.  If you want the true Julian Day, call one of the following:
+     *
+     *   - {@link Date::formatLikeStrftime()} using code '<b>%E</b>'
+     *   - {@link Date::formatLikeSQL()} using code '<b>J</b>'
+     *
+     * There currently is no function that calls the Julian Date (as opposed
+     * to the 'Julian Day'), although the Julian Day is an approximation.
+     *
+     * @return     int        the Julian date
+     * @access     public
+     * @see        Date::getDayOfYear()
+     * @deprecated Method deprecated in Release 1.5.0
+     */
+    public function getJulianDate()
+    {
+        return Date_Calc::julianDate($this->day, $this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getDayOfYear()
+
+    /**
+     * Returns the no of days (1-366) since 31st December of the previous year
+     *
+     * @return   int        an integer between 1 and 366
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getDayOfYear()
+    {
+        return Date_Calc::dayOfYear($this->day, $this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getDayOfWeek()
+
+    /**
+     * Gets the day of the week for this date (0 = Sunday)
+     *
+     * @return   int        the day of the week (0 = Sunday)
+     * @access   public
+     */
+    public function getDayOfWeek()
+    {
+        return Date_Calc::dayOfWeek($this->day, $this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getWeekOfYear()
+
+    /**
+     * Gets the week of the year for this date
+     *
+     * @return   int        the week of the year
+     * @access   public
+     */
+    public function getWeekOfYear()
+    {
+        return Date_Calc::weekOfYear($this->day, $this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getQuarterOfYear()
+
+    /**
+     * Gets the quarter of the year for this date
+     *
+     * @return   int        the quarter of the year (1-4)
+     * @access   public
+     */
+    public function getQuarterOfYear()
+    {
+        return Date_Calc::quarterOfYear($this->day, $this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getDaysInMonth()
+
+    /**
+     * Gets number of days in the month for this date
+     *
+     * @return   int        number of days in this month
+     * @access   public
+     */
+    public function getDaysInMonth()
+    {
+        return Date_Calc::daysInMonth($this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getWeeksInMonth()
+
+    /**
+     * Gets the number of weeks in the month for this date
+     *
+     * @return   int        number of weeks in this month
+     * @access   public
+     */
+    public function getWeeksInMonth()
+    {
+        return Date_Calc::weeksInMonth($this->month, $this->year);
+    }
+
+
+    // }}}
+    // {{{ getDayName()
+
+    /**
+     * Gets the full name or abbreviated name of this weekday
+     *
+     * @param bool $abbr abbreviate the name
+     * @param int $length length of abbreviation
+     *
+     * @return   string     name of this day
+     * @access   public
+     */
+    public 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 abbreviated name of this month
+     *
+     * @param boolean $abbr abbreviate the name
+     *
+     * @return   string     name of this month
+     * @access   public
+     */
+    public 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
+     *
+     * The time of the returned Date object is the same as this time.
+     *
+     * @return   object     Date object representing the next day
+     * @access   public
+     */
+    public function getNextDay()
+    {
+        $ret = new Date($this);
+        $ret->addDays(1);
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ getPrevDay()
+
+    /**
+     * Get a Date object for the day before this one
+     *
+     * The time of the returned Date object is the same as this time.
+     *
+     * @return   object     Date object representing the previous day
+     * @access   public
+     */
+    public function getPrevDay()
+    {
+        $ret = new Date($this);
+        $ret->addDays(-1);
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ getNextWeekday()
+
+    /**
+     * Get a Date object for the weekday after this one
+     *
+     * The time of the returned Date object is the same as this time.
+     *
+     * @return   object     Date object representing the next week-day
+     * @access   public
+     */
+    public function getNextWeekday()
+    {
+        $ret = new Date($this);
+        list($hs_year, $hs_month, $hs_day) =
+            explode(" ", Date_Calc::nextWeekday(
+                $this->day,
+                $this->month,
+                $this->year,
+                "%Y %m %d"
+            ));
+        $ret->setDayMonthYear($hs_day, $hs_month, $hs_year);
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ getPrevWeekday()
+
+    /**
+     * Get a Date object for the weekday before this one
+     *
+     * The time of the returned Date object is the same as this time.
+     *
+     * @return   object     Date object representing the previous week-day
+     * @access   public
+     */
+    public function getPrevWeekday()
+    {
+        $ret = new Date($this);
+        list($hs_year, $hs_month, $hs_day) =
+            explode(" ", Date_Calc::prevWeekday(
+                $this->day,
+                $this->month,
+                $this->year,
+                "%Y %m %d"
+            ));
+        $ret->setDayMonthYear($hs_day, $hs_month, $hs_year);
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ getYear()
+
+    /**
+     * Returns the year field of the date object
+     *
+     * @return   int        the year
+     * @access   public
+     */
+    public function getYear()
+    {
+        return $this->year;
+    }
+
+
+    // }}}
+    // {{{ getMonth()
+
+    /**
+     * Returns the month field of the date object
+     *
+     * @return   int        the minute
+     * @access   public
+     */
+    public function getMonth()
+    {
+        return $this->month;
+    }
+
+
+    // }}}
+    // {{{ getDay()
+
+    /**
+     * Returns the day field of the date object
+     *
+     * @return   int        the day
+     * @access   public
+     */
+    public function getDay()
+    {
+        return $this->day;
+    }
+
+
+    // }}}
+    // {{{ _getErrorInvalidTime()
+
+    /**
+     * Returns invalid time PEAR Error
+     *
+     * @return   object
+     * @access   private
+     * @since    Method available since Release 1.5.0
+     */
+    public function _getErrorInvalidTime()
+    {
+        return PEAR::raiseError(
+            "Invalid time '" .
+            sprintf(
+                "%02d.%02d.%02d",
+                $this->hour,
+                $this->minute,
+                $this->second
+            ) .
+            "' specified for date '" .
+            Date_Calc::dateFormat(
+                $this->day,
+                $this->month,
+                $this->year,
+                "%Y-%m-%d"
+            ) .
+            "' and in this timezone",
+            DATE_ERROR_INVALIDTIME
+        );
+    }
+
+
+    // }}}
+    // {{{ _secondsInDayIsValid()
+
+    /**
+     * If leap seconds are observed, checks if the seconds in the day is valid
+     *
+     * Note that only the local standard time is accessed.
+     *
+     * @return   bool
+     * @access   private
+     * @since    Method available since Release 1.5.0
+     */
+    public function _secondsInDayIsValid()
+    {
+        if ($this->ob_countleapseconds) {
+            // Convert to UTC:
+            //
+            list($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour,
+                $hn_minute,
+                $hn_second,
+                $hn_partsecond) =
+                $this->_addOffset(
+                    $this->tz->getRawOffset() * -1,
+                    $this->on_standardday,
+                    $this->on_standardmonth,
+                    $this->on_standardyear,
+                    $this->on_standardhour,
+                    $this->on_standardminute,
+                    $this->on_standardsecond,
+                    $this->on_standardpartsecond
+                );
+            return Date_Calc::secondsPastMidnight(
+                    $hn_hour,
+                    $hn_minute,
+                    $hn_second +
+                    $hn_partsecond
+                ) <
+                Date_Calc::getSecondsInDay($hn_day, $hn_month, $hn_year);
+        } else {
+            return $this->getStandardSecondsPastMidnight() < 86400;
+        }
+    }
+
+
+    // }}}
+    // {{{ isValidTime()
+
+    /**
+     * Returns whether the stored date/time is valid, i.e as a local time
+     * for the current time-zone.
+     *
+     * An invalid time is one that lies in the 'skipped hour' at the point
+     * that the clocks go forward (if the time-zone uses Summer time).
+     *
+     * Note that the stored date (i.e. the day/month/year), is set more
+     * strictly:  it is not possible to set an invalid day/month/year
+     * using {@link Date::setDate()} and it is only possible to do so with
+     * {@link setYear()} etc. for backwards-compatibility (and anyway, this
+     * can be switched off by default by setting
+     * {@link DATE_VALIDATE_DATE_BY_DEFAULT} to 'true').
+     *
+     * The object is able to store an invalid time because a user might
+     * unwittingly and correctly store a valid time, and then add one day so
+     * as to put the object in the 'skipped' hour (when the clocks go forward).
+     * This could be corrected by a conversion to Summer time (by adding one
+     * hour); however, if the user then added another day, and had no need for
+     * or interest in the time anyway, the behaviour may be rather unexpected.
+     * And anyway in this situation, the time originally specified would now,
+     * two days on, be valid again.
+     *
+     * So this class allows an invalid time like this so long as the user does
+     * not in any way make use of or request the time while it is in this
+     * semi-invalid state, in order to allow for for the fact that he might be
+     * only interested in the date, and not the time, and in order not to behave
+     * in an unexpected way, especially without throwing an exception to tell
+     * the user about it.
+     *
+     * @return   bool
+     * @access   public
+     * @see      Date::isValidDate(), Date::isNull(),
+     *            DATE_VALIDATE_DATE_BY_DEFAULT, DATE_CORRECTINVALIDTIME_DEFAULT
+     * @since    Method available since Release 1.5.0
+     */
+    public function isValidTime()
+    {
+        return !$this->ob_invalidtime;
+    }
+
+
+    // }}}
+    // {{{ getHour()
+
+    /**
+     * Returns the hour field of the date object
+     *
+     * @return   int        the hour
+     * @access   public
+     */
+    public function getHour()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->hour;
+    }
+
+
+    // }}}
+    // {{{ getMinute()
+
+    /**
+     * Returns the minute field of the date object
+     *
+     * @return   int        the minute
+     * @access   public
+     */
+    public function getMinute()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->minute;
+    }
+
+
+    // }}}
+    // {{{ getSecond()
+
+    /**
+     * Returns the second field of the date object
+     *
+     * @return   int        the second
+     * @access   public
+     */
+    public function getSecond()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->second;
+    }
+
+
+    // }}}
+    // {{{ getSecondsPastMidnight()
+
+    /**
+     * Returns the no of seconds since midnight (0-86400) as float
+     *
+     * @return   float      float which is at least 0 and less than 86400
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSecondsPastMidnight()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return Date_Calc::secondsPastMidnight(
+                $this->hour,
+                $this->minute,
+                $this->second
+            ) +
+            $this->partsecond;
+    }
+
+
+    // }}}
+    // {{{ getPartSecond()
+
+    /**
+     * Returns the part-second field of the date object
+     *
+     * @return   float      the part-second
+     * @access   protected
+     * @since    Method available since Release 1.5.0
+     */
+    public function getPartSecond()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->partsecond;
+    }
+
+
+    // }}}
+    // {{{ getStandardYear()
+
+    /**
+     * Returns the year field of the local standard time
+     *
+     * @return   int        the year
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardYear()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardyear;
+    }
+
+
+    // }}}
+    // {{{ getStandardMonth()
+
+    /**
+     * Returns the month field of the local standard time
+     *
+     * @return   int        the minute
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardMonth()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardmonth;
+    }
+
+
+    // }}}
+    // {{{ getStandardDay()
+
+    /**
+     * Returns the day field of the local standard time
+     *
+     * @return   int        the day
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardDay()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardday;
+    }
+
+
+    // }}}
+    // {{{ getStandardHour()
+
+    /**
+     * Returns the hour field of the local standard time
+     *
+     * @return   int        the hour
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardHour()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardhour;
+    }
+
+
+    // }}}
+    // {{{ getStandardMinute()
+
+    /**
+     * Returns the minute field of the local standard time
+     *
+     * @return   int        the minute
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardMinute()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardminute;
+    }
+
+
+    // }}}
+    // {{{ getStandardSecond()
+
+    /**
+     * Returns the second field of the local standard time
+     *
+     * @return   int        the second
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardSecond()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardsecond;
+    }
+
+
+    // }}}
+    // {{{ getStandardSecondsPastMidnight()
+
+    /**
+     * Returns the no of seconds since midnight (0-86400) of the
+     * local standard time as float
+     *
+     * @return   float      float which is at least 0 and less than 86400
+     * @access   public
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardSecondsPastMidnight()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return Date_Calc::secondsPastMidnight(
+                $this->on_standardhour,
+                $this->on_standardminute,
+                $this->on_standardsecond
+            ) +
+            $this->on_standardpartsecond;
+    }
+
+
+    // }}}
+    // {{{ getStandardPartSecond()
+
+    /**
+     * Returns the part-second field of the local standard time
+     *
+     * @return   float      the part-second
+     * @access   protected
+     * @since    Method available since Release 1.5.0
+     */
+    public function getStandardPartSecond()
+    {
+        if ($this->ob_invalidtime) {
+            return $this->_getErrorInvalidTime();
+        }
+
+        return $this->on_standardpartsecond;
+    }
+
+
+    // }}}
+    // {{{ _addOffset()
+
+    /**
+     * Add a time zone offset to the passed date/time
+     *
+     * @param int $pn_offset the offset to add in milliseconds
+     * @param int $pn_day the day
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param int $pn_second the second
+     * @param float $pn_partsecond the part-second
+     *
+     * @return   array      array of year, month, day, hour, minute, second,
+     *                       and part-second
+     * @access   private
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function _addOffset(
+        $pn_offset,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute,
+        $pn_second,
+        $pn_partsecond
+    )
+    {
+        if ($pn_offset == 0) {
+            return array((int)$pn_year,
+                (int)$pn_month,
+                (int)$pn_day,
+                (int)$pn_hour,
+                (int)$pn_minute,
+                (int)$pn_second,
+                (float)$pn_partsecond);
+        }
+
+        if ($pn_offset % 3600000 == 0) {
+            list($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour) =
+                Date_Calc::addHours(
+                    $pn_offset / 3600000,
+                    $pn_day,
+                    $pn_month,
+                    $pn_year,
+                    $pn_hour
+                );
+
+            $hn_minute = (int)$pn_minute;
+            $hn_second = (int)$pn_second;
+            $hn_partsecond = (float)$pn_partsecond;
+        } elseif ($pn_offset % 60000 == 0) {
+            list($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour,
+                $hn_minute) =
+                Date_Calc::addMinutes(
+                    $pn_offset / 60000,
+                    $pn_day,
+                    $pn_month,
+                    $pn_year,
+                    $pn_hour,
+                    $pn_minute
+                );
+
+            $hn_second = (int)$pn_second;
+            $hn_partsecond = (float)$pn_partsecond;
+        } else {
+            list($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour,
+                $hn_minute,
+                $hn_secondraw) =
+                Date_Calc::addSeconds(
+                    $pn_offset / 1000,
+                    $pn_day,
+                    $pn_month,
+                    $pn_year,
+                    $pn_hour,
+                    $pn_partsecond == 0.0 ?
+                        $pn_second :
+                        $pn_second + $pn_partsecond,
+                    false
+                );  // N.B. do not count
+            // leap seconds
+
+            if (is_float($hn_secondraw)) {
+                $hn_second = intval($hn_secondraw);
+                $hn_partsecond = $hn_secondraw - $hn_second;
+            } else {
+                $hn_second = $hn_secondraw;
+                $hn_partsecond = 0.0;
+            }
+        }
+
+        return array($hn_year,
+            $hn_month,
+            $hn_day,
+            $hn_hour,
+            $hn_minute,
+            $hn_second,
+            $hn_partsecond);
+    }
+
+
+    // }}}
+    // {{{ setLocalTime()
+
+    /**
+     * Sets local time (Summer-time-adjusted) and then calculates local
+     * standard time
+     *
+     * @param int $pn_day the day
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param int $pn_second the second
+     * @param float $pn_partsecond the part-second
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                       repeated hour is specified (defaults
+     *                                       to false)
+     * @param bool $pb_correctinvalidtime whether to correct, by adding the
+     *                                       local Summer time offset, the
+     *                                       specified time if it falls in the
+     *                                       skipped hour (defaults to
+     *                                       {@link DATE_CORRECTINVALIDTIME_DEFAULT})
+     *
+     * @return   void
+     * @access   protected
+     * @see      Date::setStandardTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function setLocalTime(
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute,
+        $pn_second,
+        $pn_partsecond,
+        $pb_repeatedhourdefault = false,
+        $pb_correctinvalidtime = DATE_CORRECTINVALIDTIME_DEFAULT
+    )
+    {
+        settype($pn_day, "int");
+        settype($pn_month, "int");
+        settype($pn_year, "int");
+        settype($pn_hour, "int");
+        settype($pn_minute, "int");
+        settype($pn_second, "int");
+        settype($pn_partsecond, "float");
+
+        $hb_insummertime =
+            $this->tz->inDaylightTime(
+                array($pn_day,
+                    $pn_month, $pn_year, Date_Calc::secondsPastMidnight(
+                        $pn_hour,
+                        $pn_minute,
+                        $pn_second
+                    ) + $pn_partsecond),
+                $pb_repeatedhourdefault
+            );
+        if (PEAR::isError($hb_insummertime)) {
+            if ($hb_insummertime->getCode() != DATE_ERROR_INVALIDTIME) {
+                return $hb_insummertime;
+            } elseif ($pb_correctinvalidtime) {
+                // Store passed time as local standard time:
+                //
+                $this->on_standardday = $pn_day;
+                $this->on_standardmonth = $pn_month;
+                $this->on_standardyear = $pn_year;
+                $this->on_standardhour = $pn_hour;
+                $this->on_standardminute = $pn_minute;
+                $this->on_standardsecond = $pn_second;
+                $this->on_standardpartsecond = $pn_partsecond;
+
+                // Add Summer time offset to passed time:
+                //
+                list($this->year,
+                    $this->month,
+                    $this->day,
+                    $this->hour,
+                    $this->minute,
+                    $this->second,
+                    $this->partsecond) =
+                    $this->_addOffset(
+                        $this->tz->getDSTSavings(),
+                        $pn_day,
+                        $pn_month,
+                        $pn_year,
+                        $pn_hour,
+                        $pn_minute,
+                        $pn_second,
+                        $pn_partsecond
+                    );
+
+                $this->ob_invalidtime = !$this->_secondsInDayIsValid();
+            } else {
+                // Hedge bets - if the user adds/subtracts a day, then the time
+                // will be uncorrupted, and if the user does
+                // addition/subtraction with the time, or requests the time,
+                // then return an error at that point:
+                //
+                $this->day = $pn_day;
+                $this->month = $pn_month;
+                $this->year = $pn_year;
+                $this->hour = $pn_hour;
+                $this->minute = $pn_minute;
+                $this->second = $pn_second;
+                $this->partsecond = $pn_partsecond;
+
+                $this->ob_invalidtime = true;
+            }
+
+            return;
+        } else {
+            // Passed time is valid as local time:
+            //
+            $this->day = $pn_day;
+            $this->month = $pn_month;
+            $this->year = $pn_year;
+            $this->hour = $pn_hour;
+            $this->minute = $pn_minute;
+            $this->second = $pn_second;
+            $this->partsecond = $pn_partsecond;
+        }
+
+        $this->ob_invalidtime = !$this->_secondsInDayIsValid();
+
+        if ($hb_insummertime) {
+            // Calculate local standard time:
+            //
+            list($this->on_standardyear,
+                $this->on_standardmonth,
+                $this->on_standardday,
+                $this->on_standardhour,
+                $this->on_standardminute,
+                $this->on_standardsecond,
+                $this->on_standardpartsecond) =
+                $this->_addOffset(
+                    $this->tz->getDSTSavings() * -1,
+                    $pn_day,
+                    $pn_month,
+                    $pn_year,
+                    $pn_hour,
+                    $pn_minute,
+                    $pn_second,
+                    $pn_partsecond
+                );
+        } else {
+            // Time is already local standard time:
+            //
+            $this->on_standardday = $pn_day;
+            $this->on_standardmonth = $pn_month;
+            $this->on_standardyear = $pn_year;
+            $this->on_standardhour = $pn_hour;
+            $this->on_standardminute = $pn_minute;
+            $this->on_standardsecond = $pn_second;
+            $this->on_standardpartsecond = $pn_partsecond;
+        }
+    }
+
+
+    // }}}
+    // {{{ setStandardTime()
+
+    /**
+     * Sets local standard time and then calculates local time (i.e.
+     * Summer-time-adjusted)
+     *
+     * @param int $pn_day the day
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param int $pn_second the second
+     * @param float $pn_partsecond the part-second
+     *
+     * @return   void
+     * @access   protected
+     * @see      Date::setLocalTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function setStandardTime(
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute,
+        $pn_second,
+        $pn_partsecond
+    )
+    {
+        settype($pn_day, "int");
+        settype($pn_month, "int");
+        settype($pn_year, "int");
+        settype($pn_hour, "int");
+        settype($pn_minute, "int");
+        settype($pn_second, "int");
+        settype($pn_partsecond, "float");
+
+        $this->on_standardday = $pn_day;
+        $this->on_standardmonth = $pn_month;
+        $this->on_standardyear = $pn_year;
+        $this->on_standardhour = $pn_hour;
+        $this->on_standardminute = $pn_minute;
+        $this->on_standardsecond = $pn_second;
+        $this->on_standardpartsecond = $pn_partsecond;
+
+        $this->ob_invalidtime = !$this->_secondsInDayIsValid();
+
+        if ($this->tz->inDaylightTimeStandard(array($pn_day, $pn_month,
+            $pn_year, Date_Calc::secondsPastMidnight(
+                $pn_hour,
+                $pn_minute,
+                $pn_second
+            ) + $pn_partsecond))) {
+
+            // Calculate local time:
+            //
+            list($this->year,
+                $this->month,
+                $this->day,
+                $this->hour,
+                $this->minute,
+                $this->second,
+                $this->partsecond) =
+                $this->_addOffset(
+                    $this->tz->getDSTSavings(),
+                    $pn_day,
+                    $pn_month,
+                    $pn_year,
+                    $pn_hour,
+                    $pn_minute,
+                    $pn_second,
+                    $pn_partsecond
+                );
+        } else {
+            // Time is already local time:
+            //
+            $this->day = $pn_day;
+            $this->month = $pn_month;
+            $this->year = $pn_year;
+            $this->hour = $pn_hour;
+            $this->minute = $pn_minute;
+            $this->second = $pn_second;
+            $this->partsecond = $pn_partsecond;
+        }
+    }
+
+
+    // }}}
+    // {{{ setYear()
+
+    /**
+     * Sets the year field of the date object
+     *
+     * If specified year forms an invalid date, then PEAR error will be
+     * returned, unless the validation is over-ridden using the second
+     * parameter.
+     *
+     * @param int $y the year
+     * @param bool $pb_validate whether to check that the new date is valid
+     *                           (defaults to {@link DATE_VALIDATE_DATE_BY_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDayMonthYear(), Date::setDateTime()
+     */
+    public function setYear($y, $pb_validate = DATE_VALIDATE_DATE_BY_DEFAULT)
+    {
+        if ($pb_validate && !Date_Calc::isValidDate($this->day, $this->month, $y)) {
+            return PEAR::raiseError(
+                "'" .
+                Date_Calc::dateFormat(
+                    $this->day,
+                    $this->month,
+                    $y,
+                    "%Y-%m-%d"
+                ) .
+                "' is invalid calendar date",
+                DATE_ERROR_INVALIDDATE
+            );
+        } else {
+            $this->setLocalTime(
+                $this->day,
+                $this->month,
+                $y,
+                $this->hour,
+                $this->minute,
+                $this->second,
+                $this->partsecond
+            );
+        }
+    }
+
+
+    // }}}
+    // {{{ setMonth()
+
+    /**
+     * Sets the month field of the date object
+     *
+     * If specified year forms an invalid date, then PEAR error will be
+     * returned, unless the validation is over-ridden using the second
+     * parameter.
+     *
+     * @param int $m the month
+     * @param bool $pb_validate whether to check that the new date is valid
+     *                           (defaults to {@link DATE_VALIDATE_DATE_BY_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDayMonthYear(), Date::setDateTime()
+     */
+    public function setMonth($m, $pb_validate = DATE_VALIDATE_DATE_BY_DEFAULT)
+    {
+        if ($pb_validate && !Date_Calc::isValidDate($this->day, $m, $this->year)) {
+            return PEAR::raiseError(
+                "'" .
+                Date_Calc::dateFormat(
+                    $this->day,
+                    $m,
+                    $this->year,
+                    "%Y-%m-%d"
+                ) .
+                "' is invalid calendar date",
+                DATE_ERROR_INVALIDDATE
+            );
+        } else {
+            $this->setLocalTime(
+                $this->day,
+                $m,
+                $this->year,
+                $this->hour,
+                $this->minute,
+                $this->second,
+                $this->partsecond
+            );
+        }
+    }
+
+
+    // }}}
+    // {{{ setDay()
+
+    /**
+     * Sets the day field of the date object
+     *
+     * If specified year forms an invalid date, then PEAR error will be
+     * returned, unless the validation is over-ridden using the second
+     * parameter.
+     *
+     * @param int $d the day
+     * @param bool $pb_validate whether to check that the new date is valid
+     *                           (defaults to {@link DATE_VALIDATE_DATE_BY_DEFAULT})
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDayMonthYear(), Date::setDateTime()
+     */
+    public function setDay($d, $pb_validate = DATE_VALIDATE_DATE_BY_DEFAULT)
+    {
+        if ($pb_validate && !Date_Calc::isValidDate($d, $this->month, $this->year)) {
+            return PEAR::raiseError(
+                "'" .
+                Date_Calc::dateFormat(
+                    $d,
+                    $this->month,
+                    $this->year,
+                    "%Y-%m-%d"
+                ) .
+                "' is invalid calendar date",
+                DATE_ERROR_INVALIDDATE
+            );
+        } else {
+            $this->setLocalTime(
+                $d,
+                $this->month,
+                $this->year,
+                $this->hour,
+                $this->minute,
+                $this->second,
+                $this->partsecond
+            );
+        }
+    }
+
+
+    // }}}
+    // {{{ setDayMonthYear()
+
+    /**
+     * Sets the day, month and year fields of the date object
+     *
+     * If specified year forms an invalid date, then PEAR error will be
+     * returned.  Note that setting each of these fields separately
+     * may unintentionally return a PEAR error if a transitory date is
+     * invalid between setting these fields.
+     *
+     * @param int $d the day
+     * @param int $m the month
+     * @param int $y the year
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDateTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function setDayMonthYear($d, $m, $y)
+    {
+        if (!Date_Calc::isValidDate($d, $m, $y)) {
+            return PEAR::raiseError(
+                "'" .
+                Date_Calc::dateFormat(
+                    $d,
+                    $m,
+                    $y,
+                    "%Y-%m-%d"
+                ) .
+                "' is invalid calendar date",
+                DATE_ERROR_INVALIDDATE
+            );
+        } else {
+            $this->setLocalTime(
+                $d,
+                $m,
+                $y,
+                $this->hour,
+                $this->minute,
+                $this->second,
+                $this->partsecond
+            );
+        }
+    }
+
+
+    // }}}
+    // {{{ setHour()
+
+    /**
+     * Sets the hour field of the date object
+     *
+     * Expects an hour in 24-hour format.
+     *
+     * @param int $h the hour
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                      repeated hour is specified (defaults
+     *                                      to false)
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setHourMinuteSecond(), Date::setDateTime()
+     */
+    public function setHour($h, $pb_repeatedhourdefault = false)
+    {
+        if ($h > 23 || $h < 0) {
+            return PEAR::raiseError("Invalid hour value '$h'");
+        } else {
+            $ret = $this->setHourMinuteSecond(
+                $h,
+                $this->minute,
+                $this->partsecond == 0.0 ?
+                    $this->second :
+                    $this->second + $this->partsecond,
+                $pb_repeatedhourdefault
+            );
+
+            if (PEAR::isError($ret)) {
+                return $ret;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ setMinute()
+
+    /**
+     * Sets the minute field of the date object
+     *
+     * @param int $m the minute
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                      repeated hour is specified (defaults
+     *                                      to false)
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setHourMinuteSecond(), Date::setDateTime()
+     */
+    public function setMinute($m, $pb_repeatedhourdefault = false)
+    {
+        if ($m > 59 || $m < 0) {
+            return PEAR::raiseError("Invalid minute value '$m'");
+        } else {
+            $ret = $this->setHourMinuteSecond(
+                $this->hour,
+                $m,
+                $this->partsecond == 0.0 ?
+                    $this->second :
+                    $this->second + $this->partsecond,
+                $pb_repeatedhourdefault
+            );
+
+            if (PEAR::isError($ret)) {
+                return $ret;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ setSecond()
+
+    /**
+     * Sets the second field of the date object
+     *
+     * @param mixed $s the second as integer or float
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                       repeated hour is specified
+     *                                       (defaults to false)
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setHourMinuteSecond(), Date::setDateTime()
+     */
+    public function setSecond($s, $pb_repeatedhourdefault = false)
+    {
+        if ($s > 60 || // Leap seconds possible
+            $s < 0) {
+            return PEAR::raiseError("Invalid second value '$s'");
+        } else {
+            $ret = $this->setHourMinuteSecond(
+                $this->hour,
+                $this->minute,
+                $s,
+                $pb_repeatedhourdefault
+            );
+
+            if (PEAR::isError($ret)) {
+                return $ret;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ setPartSecond()
+
+    /**
+     * Sets the part-second field of the date object
+     *
+     * @param float $pn_ps the part-second
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                      repeated hour is specified (defaults
+     *                                      to false)
+     *
+     * @return   void
+     * @access   protected
+     * @see      Date::setHourMinuteSecond(), Date::setDateTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function setPartSecond($pn_ps, $pb_repeatedhourdefault = false)
+    {
+        if ($pn_ps >= 1 || $pn_ps < 0) {
+            return PEAR::raiseError("Invalid part-second value '$pn_ps'");
+        } else {
+            $ret = $this->setHourMinuteSecond(
+                $this->hour,
+                $this->minute,
+                $this->second + $pn_ps,
+                $pb_repeatedhourdefault
+            );
+
+            if (PEAR::isError($ret)) {
+                return $ret;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ setHourMinuteSecond()
+
+    /**
+     * Sets the hour, minute, second and part-second fields of the date object
+     *
+     * N.B. if the repeated hour, due to the clocks going back, is specified,
+     * the default is to assume local standard time.
+     *
+     * @param int $h the hour
+     * @param int $m the minute
+     * @param mixed $s the second as integer or float
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                       repeated hour is specified
+     *                                       (defaults to false)
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDateTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function setHourMinuteSecond($h, $m, $s, $pb_repeatedhourdefault = false)
+    {
+        // Split second into integer and part-second:
+        //
+        if (is_float($s)) {
+            $hn_second = intval($s);
+            $hn_partsecond = $s - $hn_second;
+        } else {
+            $hn_second = (int)$s;
+            $hn_partsecond = 0.0;
+        }
+
+        $this->setLocalTime(
+            $this->day,
+            $this->month,
+            $this->year,
+            $h,
+            $m,
+            $hn_second,
+            $hn_partsecond,
+            $pb_repeatedhourdefault
+        );
+    }
+
+
+    // }}}
+    // {{{ setDateTime()
+
+    /**
+     * Sets all the fields of the date object (day, month, year, hour, minute
+     * and second)
+     *
+     * If specified year forms an invalid date, then PEAR error will be
+     * returned.  Note that setting each of these fields separately
+     * may unintentionally return a PEAR error if a transitory date is
+     * invalid between setting these fields.
+     *
+     * N.B. if the repeated hour, due to the clocks going back, is specified,
+     * the default is to assume local standard time.
+     *
+     * @param int $pn_day the day
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param mixed $pm_second the second as integer or float
+     * @param bool $pb_repeatedhourdefault whether to assume Summer time if a
+     *                                       repeated hour is specified
+     *                                       (defaults to false)
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setDayMonthYear(), Date::setHourMinuteSecond()
+     * @since    Method available since Release 1.5.0
+     */
+    public function setDateTime(
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute,
+        $pm_second,
+        $pb_repeatedhourdefault = false
+    )
+    {
+        if (!Date_Calc::isValidDate($d, $m, $y)) {
+            return PEAR::raiseError(
+                "'" .
+                Date_Calc::dateFormat(
+                    $d,
+                    $m,
+                    $y,
+                    "%Y-%m-%d"
+                ) .
+                "' is invalid calendar date",
+                DATE_ERROR_INVALIDDATE
+            );
+        } else {
+            // Split second into integer and part-second:
+            //
+            if (is_float($pm_second)) {
+                $hn_second = intval($pm_second);
+                $hn_partsecond = $pm_second - $hn_second;
+            } else {
+                $hn_second = (int)$pm_second;
+                $hn_partsecond = 0.0;
+            }
+
+            $this->setLocalTime(
+                $d,
+                $m,
+                $y,
+                $h,
+                $m,
+                $hn_second,
+                $hn_partsecond,
+                $pb_repeatedhourdefault
+            );
+        }
+    }
+
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
diff --git a/extlib/Date/Calc.php b/extlib/Date/Calc.php
new file mode 100644 (file)
index 0000000..72af72c
--- /dev/null
@@ -0,0 +1,4728 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+// {{{ Header
+
+/**
+ * Calculates, manipulates and retrieves dates
+ *
+ * It does not rely on 32-bit system time stamps, so it works dates
+ * before 1970 and after 2038.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 1999-2007 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor,
+ * C.A. Woodcock
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the BSD License.
+ *
+ * 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.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     Monte Ohrt <monte@ispi.net>
+ * @author     Pierre-Alain Joye <pajoye@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  1999-2007 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor, C.A. Woodcock
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Date
+ * @since      File available since Release 1.2
+ */
+
+
+// }}}
+
+/**
+ * PEAR
+ */
+require_once 'PEAR.php';
+
+
+// {{{ General constants:
+
+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');
+}
+
+
+// {{{ Date precision constants (used in 'round()' and 'trunc()'):
+
+define('DATE_PRECISION_YEAR', -2);
+define('DATE_PRECISION_MONTH', -1);
+define('DATE_PRECISION_DAY', 0);
+define('DATE_PRECISION_HOUR', 1);
+define('DATE_PRECISION_10MINUTES', 2);
+define('DATE_PRECISION_MINUTE', 3);
+define('DATE_PRECISION_10SECONDS', 4);
+define('DATE_PRECISION_SECOND', 5);
+
+
+// }}}
+// {{{ 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.
+ *
+ * @category  Date and Time
+ * @package   Date
+ * @author    Monte Ohrt <monte@ispi.net>
+ * @author    Daniel Convissor <danielc@php.net>
+ * @author    C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright 1999-2007 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor, C.A. Woodcock
+ * @license   http://www.opensource.org/licenses/bsd-license.php
+ *            BSD License
+ * @version   Release: 1.5.0a1
+ * @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
+     * {@link http://www.php.net/strftime strftime()}
+     *
+     * This function is used to alleviate the problem with 32-bit numbers for
+     * dates pre 1970 or post 2038, as strftime() has on most systems.
+     * Most of the formatting options are compatible.
+     *
+     * Formatting options:
+     *
+     *  - <b>%a</b> - abbreviated weekday name (Sun, Mon, Tue)
+     *  - <b>%A</b> - full weekday name (Sunday, Monday, Tuesday)
+     *  - <b>%b</b> - abbreviated month name (Jan, Feb, Mar)
+     *  - <b>%B</b> - full month name (January, February, March)
+     *  - <b>%d</b> - day of month (range 00 to 31)
+     *  - <b>%e</b> - day of month, single digit (range 0 to 31)
+     *  - <b>%E</b> - number of days since unspecified epoch (integer).
+     *                ('<b>%E</b>' is useful for passing a date in a URL as an
+     *                integer value.  Then simply use {@link Date_Calc::daysToDate()}
+     *                to convert back to a date.)
+     *  - <b>%j</b> - day of year (range 001 to 366)
+     *  - <b>%m</b> - month as decimal number (range 1 to 12)
+     *  - <b>%n</b> - newline character (\n)
+     *  - <b>%t</b> - tab character (\t)
+     *  - <b>%w</b> - weekday as decimal (0 = Sunday)
+     *  - <b>%U</b> - week number of current year, first sunday as first week
+     *  - <b>%y</b> - year as decimal (range 00 to 99)
+     *  - <b>%Y</b> - year as decimal including century (range 0000 to 9999)
+     *  - <b>%%</b> - 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.
+     * @param string $format the format string
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     */
+    public 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::dayOfYear($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 .= sprintf(
+                            '%0' .
+                            ($year < 0 ? '3' : '2') .
+                            'd',
+                            $year % 100
+                        );
+                        break;
+                    case "Y":
+                        $output .= sprintf(
+                            '%0' .
+                            ($year < 0 ? '5' : '4') .
+                            'd',
+                            $year
+                        );
+                        break;
+                    case '%':
+                        $output .= '%';
+                        break;
+                    default:
+                        $output .= $char . $nextchar;
+                }
+                $strpos++;
+            } else {
+                $output .= $char;
+            }
+        }
+        return $output;
+    }
+
+
+    // }}}
+    // {{{ dateNow()
+
+    /**
+     * Returns the current local date
+     *
+     * NOTE: This function retrieves the local date using
+     * {@link http://www.php.net/strftime 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
+     */
+    public 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
+     */
+    public 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
+     */
+    public 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
+     */
+    public function getDay()
+    {
+        return Date_Calc::dateNow('%d');
+    }
+
+
+    // }}}
+    // {{{ defaultCentury()
+
+    /**
+     * Turns a two digit year into a four digit year
+     *
+     * Return value depends on current year; the century chosen
+     * will be the one which forms the year that is closest
+     * to the current year.  If the two possibilities are
+     * equidistant to the current year (i.e. 50 years in the past
+     * and 50 years in the future), then the past year is chosen.
+     *
+     * For example, if the current year is 2007:
+     *  - <b>"03"</b> - returns 2003
+     *  - <b>"09"</b> - returns 2009
+     *  - <b>"56"</b> - returns 2056 (closer to 2007 than 1956)
+     *  - <b>"57"</b> - returns 1957 (1957 and 2007 are equidistant,
+     *                   so previous century chosen)
+     *  - <b>"58"</b> - returns 1958
+     *
+     * @param int $year the 2 digit year
+     *
+     * @return   int        the 4 digit year
+     * @access   public
+     * @static
+     */
+    public function defaultCentury($year)
+    {
+        $hn_century = intval(($hn_currentyear = date("Y")) / 100);
+        $hn_currentyear = $hn_currentyear % 100;
+
+        if ($year < 0 || $year >= 100) {
+            $year = $year % 100;
+        }
+
+        if ($year - $hn_currentyear < -50) {
+            return ($hn_century + 1) * 100 + $year;
+        } elseif ($year - $hn_currentyear < 50) {
+            return $hn_century * 100 + $year;
+        } else {
+            return ($hn_century - 1) * 100 + $year;
+        }
+    }
+
+
+    // }}}
+    // {{{ getSecondsInYear()
+
+    /**
+     * Returns the total number of seconds in the given year
+     *
+     * This takes into account leap seconds.
+     *
+     * @param int $pn_year the year in four digit format
+     *
+     * @return   int
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSecondsInYear($pn_year)
+    {
+        $pn_year = intval($pn_year);
+
+        static $ha_leapseconds;
+        if (!isset($ha_leapseconds)) {
+            $ha_leapseconds = array(1972 => 2,
+                1973 => 1,
+                1974 => 1,
+                1975 => 1,
+                1976 => 1,
+                1977 => 1,
+                1978 => 1,
+                1979 => 1,
+                1981 => 1,
+                1982 => 1,
+                1983 => 1,
+                1985 => 1,
+                1987 => 1,
+                1989 => 1,
+                1990 => 1,
+                1992 => 1,
+                1993 => 1,
+                1994 => 1,
+                1995 => 1,
+                1997 => 1,
+                1998 => 1,
+                2005 => 1);
+        }
+
+        $ret = Date_Calc::daysInYear($pn_year) * 86400;
+
+        if (isset($ha_leapseconds[$pn_year])) {
+            return $ret + $ha_leapseconds[$pn_year];
+        } else {
+            return $ret;
+        }
+    }
+
+
+    // }}}
+    // {{{ getSecondsInMonth()
+
+    /**
+     * Returns the total number of seconds in the given month
+     *
+     * This takes into account leap seconds.
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year in four digit format
+     *
+     * @return   int
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSecondsInMonth($pn_month, $pn_year)
+    {
+        $pn_month = intval($pn_month);
+        $pn_year = intval($pn_year);
+
+        static $ha_leapseconds;
+        if (!isset($ha_leapseconds)) {
+            $ha_leapseconds = array(1972 => array(6 => 1,
+                12 => 1),
+                1973 => array(12 => 1),
+                1974 => array(12 => 1),
+                1975 => array(12 => 1),
+                1976 => array(12 => 1),
+                1977 => array(12 => 1),
+                1978 => array(12 => 1),
+                1979 => array(12 => 1),
+                1981 => array(6 => 1),
+                1982 => array(6 => 1),
+                1983 => array(6 => 1),
+                1985 => array(6 => 1),
+                1987 => array(12 => 1),
+                1989 => array(12 => 1),
+                1990 => array(12 => 1),
+                1992 => array(6 => 1),
+                1993 => array(6 => 1),
+                1994 => array(6 => 1),
+                1995 => array(12 => 1),
+                1997 => array(6 => 1),
+                1998 => array(12 => 1),
+                2005 => array(12 => 1));
+        }
+
+        $ret = Date_Calc::daysInMonth($pn_month, $pn_year) * 86400;
+
+        if (isset($ha_leapseconds[$pn_year][$pn_month])) {
+            return $ret + $ha_leapseconds[$pn_year][$pn_month];
+        } else {
+            return $ret;
+        }
+    }
+
+
+    // }}}
+    // {{{ getSecondsInDay()
+
+    /**
+     * Returns the total number of seconds in the day of the given date
+     *
+     * This takes into account leap seconds.
+     *
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year in four digit format
+     *
+     * @return   int
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSecondsInDay($pn_day, $pn_month, $pn_year)
+    {
+        // Note to developers:
+        //
+        // The leap seconds listed here are a matter of historical fact,
+        // that is, it is known on which exact day they occurred.
+        // However, the implementation of the class as a whole depends
+        // on the fact that they always occur at the end of the month
+        // (although it is assumed that they could occur in any month,
+        // even though practically they only occur in June or December).
+        //
+        // Do not define a leap second on a day of the month other than
+        // the last day without altering the implementation of the
+        // functions that depend on this one.
+        //
+        // It is possible, though, to define an un-leap second (i.e. a skipped
+        // second (I do not know what they are called), or a number of
+        // consecutive leap seconds).
+
+        $pn_day = intval($pn_day);
+        $pn_month = intval($pn_month);
+        $pn_year = intval($pn_year);
+
+        static $ha_leapseconds;
+        if (!isset($ha_leapseconds)) {
+            $ha_leapseconds = array(1972 => array(6 => array(30 => 1),
+                12 => array(31 => 1)),
+                1973 => array(12 => array(31 => 1)),
+                1974 => array(12 => array(31 => 1)),
+                1975 => array(12 => array(31 => 1)),
+                1976 => array(12 => array(31 => 1)),
+                1977 => array(12 => array(31 => 1)),
+                1978 => array(12 => array(31 => 1)),
+                1979 => array(12 => array(31 => 1)),
+                1981 => array(6 => array(30 => 1)),
+                1982 => array(6 => array(30 => 1)),
+                1983 => array(6 => array(30 => 1)),
+                1985 => array(6 => array(30 => 1)),
+                1987 => array(12 => array(31 => 1)),
+                1989 => array(12 => array(31 => 1)),
+                1990 => array(12 => array(31 => 1)),
+                1992 => array(6 => array(30 => 1)),
+                1993 => array(6 => array(30 => 1)),
+                1994 => array(6 => array(30 => 1)),
+                1995 => array(12 => array(31 => 1)),
+                1997 => array(6 => array(30 => 1)),
+                1998 => array(12 => array(31 => 1)),
+                2005 => array(12 => array(31 => 1)));
+        }
+
+        if (isset($ha_leapseconds[$pn_year][$pn_month][$pn_day])) {
+            return 86400 + $ha_leapseconds[$pn_year][$pn_month][$pn_day];
+        } else {
+            return 86400;
+        }
+    }
+
+
+    // }}}
+    // {{{ getSecondsInHour()
+
+    /**
+     * Returns the total number of seconds in the hour of the given date
+     *
+     * This takes into account leap seconds.
+     *
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year in four digit format
+     * @param int $pn_hour the hour
+     *
+     * @return   int
+     * @access   public
+     * @static
+     */
+    public function getSecondsInHour($pn_day, $pn_month, $pn_year, $pn_hour)
+    {
+        if ($pn_hour < 23) {
+            return 3600;
+        } else {
+            return Date_Calc::getSecondsInDay($pn_day, $pn_month, $pn_year) -
+                82800;
+        }
+    }
+
+
+    // }}}
+    // {{{ getSecondsInMinute()
+
+    /**
+     * Returns the total number of seconds in the minute of the given hour
+     *
+     * This takes into account leap seconds.
+     *
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year in four digit format
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     *
+     * @return   int
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSecondsInMinute(
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute
+    )
+    {
+        if ($pn_hour < 23 || $pn_minute < 59) {
+            return 60;
+        } else {
+            return Date_Calc::getSecondsInDay($pn_day, $pn_month, $pn_year) -
+                86340;
+        }
+    }
+
+
+    // }}}
+    // {{{ secondsPastMidnight()
+
+    /**
+     * Returns the no of seconds since midnight (0-86399)
+     *
+     * @param int $pn_hour the hour of the day
+     * @param int $pn_minute the minute
+     * @param mixed $pn_second the second as integer or float
+     *
+     * @return   mixed      integer or float from 0-86399
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function secondsPastMidnight($pn_hour, $pn_minute, $pn_second)
+    {
+        return 3600 * $pn_hour + 60 * $pn_minute + $pn_second;
+    }
+
+
+    // }}}
+    // {{{ secondsPastMidnightToTime()
+
+    /**
+     * Returns the time as an array (i.e. hour, minute, second)
+     *
+     * @param mixed $pn_seconds the no of seconds since midnight (0-86399)
+     *
+     * @return   mixed      array of hour, minute (both as integers), second (as
+     *                       integer or float, depending on parameter)
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function secondsPastMidnightToTime($pn_seconds)
+    {
+        if ($pn_seconds >= 86400) {
+            return array(23, 59, $pn_seconds - 86340);
+        }
+
+        $hn_hour = intval($pn_seconds / 3600);
+        $hn_minute = intval(($pn_seconds - $hn_hour * 3600) / 60);
+        $hn_second = is_float($pn_seconds) ?
+            fmod($pn_seconds, 60) :
+            $pn_seconds % 60;
+
+        return array($hn_hour, $hn_minute, $hn_second);
+    }
+
+
+    // }}}
+    // {{{ secondsPastTheHour()
+
+    /**
+     * Returns the no of seconds since the last hour o'clock (0-3599)
+     *
+     * @param int $pn_minute the minute
+     * @param mixed $pn_second the second as integer or float
+     *
+     * @return   mixed      integer or float from 0-3599
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function secondsPastTheHour($pn_minute, $pn_second)
+    {
+        return 60 * $pn_minute + $pn_second;
+    }
+
+
+    // }}}
+    // {{{ addHours()
+
+    /**
+     * Returns the date the specified no of hours from the given date
+     *
+     * To subtract hours use a negative value for the '$pn_hours' parameter
+     *
+     * @param int $pn_hours hours to add
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     *
+     * @return   array      array of year, month, day, hour
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addHours($pn_hours, $pn_day, $pn_month, $pn_year, $pn_hour)
+    {
+        if ($pn_hours == 0) {
+            return array((int)$pn_year,
+                (int)$pn_month,
+                (int)$pn_day,
+                (int)$pn_hour);
+        }
+
+        $hn_days = intval($pn_hours / 24);
+        $hn_hour = $pn_hour + $pn_hours % 24;
+
+        if ($hn_hour >= 24) {
+            ++$hn_days;
+            $hn_hour -= 24;
+        } elseif ($hn_hour < 0) {
+            --$hn_days;
+            $hn_hour += 24;
+        }
+
+        if ($hn_days == 0) {
+            $hn_year = $pn_year;
+            $hn_month = $pn_month;
+            $hn_day = $pn_day;
+        } else {
+            list($hn_year, $hn_month, $hn_day) =
+                explode(
+                    " ",
+                    Date_Calc::addDays(
+                        $hn_days,
+                        $pn_day,
+                        $pn_month,
+                        $pn_year,
+                        "%Y %m %d"
+                    )
+                );
+        }
+
+        return array((int)$hn_year, (int)$hn_month, (int)$hn_day, $hn_hour);
+    }
+
+
+    // }}}
+    // {{{ addMinutes()
+
+    /**
+     * Returns the date the specified no of minutes from the given date
+     *
+     * To subtract minutes use a negative value for the '$pn_minutes' parameter
+     *
+     * @param int $pn_minutes minutes to add
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     *
+     * @return   array      array of year, month, day, hour, minute
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addMinutes(
+        $pn_minutes,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute
+    )
+    {
+        if ($pn_minutes == 0) {
+            return array((int)$pn_year,
+                (int)$pn_month,
+                (int)$pn_day,
+                (int)$pn_hour,
+                (int)$pn_minute);
+        }
+
+        $hn_hours = intval($pn_minutes / 60);
+        $hn_minute = $pn_minute + $pn_minutes % 60;
+
+        if ($hn_minute >= 60) {
+            ++$hn_hours;
+            $hn_minute -= 60;
+        } elseif ($hn_minute < 0) {
+            --$hn_hours;
+            $hn_minute += 60;
+        }
+
+        if ($hn_hours == 0) {
+            $hn_year = $pn_year;
+            $hn_month = $pn_month;
+            $hn_day = $pn_day;
+            $hn_hour = $pn_hour;
+        } else {
+            list($hn_year, $hn_month, $hn_day, $hn_hour) =
+                Date_Calc::addHours(
+                    $hn_hours,
+                    $pn_day,
+                    $pn_month,
+                    $pn_year,
+                    $pn_hour
+                );
+        }
+
+        return array($hn_year, $hn_month, $hn_day, $hn_hour, $hn_minute);
+    }
+
+
+    // }}}
+    // {{{ addSeconds()
+
+    /**
+     * Returns the date the specified no of seconds from the given date
+     *
+     * If leap seconds are specified to be counted, the passed time must be UTC.
+     * To subtract seconds use a negative value for the '$pn_seconds' parameter.
+     *
+     * N.B. the return type of the second part of the date is float if
+     * either '$pn_seconds' or '$pn_second' is a float; otherwise, it
+     * is integer.
+     *
+     * @param mixed $pn_seconds seconds to add as integer or float
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param mixed $pn_second the second as integer or float
+     * @param bool $pb_countleap whether to count leap seconds (defaults to
+     *                             DATE_COUNT_LEAP_SECONDS)
+     *
+     * @return   array      array of year, month, day, hour, minute, second
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addSeconds(
+        $pn_seconds,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute,
+        $pn_second,
+        $pb_countleap = DATE_COUNT_LEAP_SECONDS
+    )
+    {
+        if ($pn_seconds == 0) {
+            return array((int)$pn_year,
+                (int)$pn_month,
+                (int)$pn_day,
+                (int)$pn_hour,
+                (int)$pn_minute,
+                $pn_second);
+        }
+
+        if ($pb_countleap) {
+            $hn_seconds = $pn_seconds;
+
+            $hn_day = (int)$pn_day;
+            $hn_month = (int)$pn_month;
+            $hn_year = (int)$pn_year;
+            $hn_hour = (int)$pn_hour;
+            $hn_minute = (int)$pn_minute;
+            $hn_second = $pn_second;
+
+            $hn_days = Date_Calc::dateToDays(
+                $pn_day,
+                $pn_month,
+                $pn_year
+            );
+            $hn_secondsofmonth = 86400 * ($hn_days -
+                    Date_Calc::firstDayOfMonth(
+                        $pn_month,
+                        $pn_year
+                    )) +
+                Date_Calc::secondsPastMidnight(
+                    $pn_hour,
+                    $pn_minute,
+                    $pn_second
+                );
+
+            if ($hn_seconds > 0) {
+                // Advance to end of month:
+                //
+                if ($hn_secondsofmonth != 0 &&
+                    $hn_secondsofmonth + $hn_seconds >=
+                    ($hn_secondsinmonth =
+                        Date_Calc::getSecondsInMonth($hn_month, $hn_year))) {
+                    $hn_seconds -= $hn_secondsinmonth - $hn_secondsofmonth;
+                    $hn_secondsofmonth = 0;
+                    list($hn_year, $hn_month) =
+                        Date_Calc::nextMonth($hn_month, $hn_year);
+                    $hn_day = Date_Calc::getFirstDayOfMonth(
+                        $hn_month,
+                        $hn_year
+                    );
+                    $hn_hour = $hn_minute = $hn_second = 0;
+                }
+
+                // Advance to end of year:
+                //
+                if ($hn_secondsofmonth == 0 &&
+                    $hn_month != Date_Calc::getFirstMonthOfYear($hn_year)) {
+                    while ($hn_year == $pn_year &&
+                        $hn_seconds >= ($hn_secondsinmonth =
+                            Date_Calc::getSecondsInMonth(
+                                $hn_month,
+                                $hn_year
+                            ))) {
+                        $hn_seconds -= $hn_secondsinmonth;
+                        list($hn_year, $hn_month) =
+                            Date_Calc::nextMonth($hn_month, $hn_year);
+                        $hn_day = Date_Calc::getFirstDayOfMonth(
+                            $hn_month,
+                            $hn_year
+                        );
+                    }
+                }
+
+                if ($hn_secondsofmonth == 0) {
+                    // Add years:
+                    //
+                    if ($hn_month == Date_Calc::getFirstMonthOfYear($hn_year)) {
+                        while ($hn_seconds >= ($hn_secondsinyear =
+                                Date_Calc::getSecondsInYear($hn_year))) {
+                            $hn_seconds -= $hn_secondsinyear;
+                            $hn_month = Date_Calc::getFirstMonthOfYear(++$hn_year);
+                            $hn_day = Date_Calc::getFirstDayOfMonth(
+                                $hn_month,
+                                $hn_year
+                            );
+                        }
+                    }
+
+                    // Add months:
+                    //
+                    while ($hn_seconds >= ($hn_secondsinmonth =
+                            Date_Calc::getSecondsInMonth($hn_month, $hn_year))) {
+                        $hn_seconds -= $hn_secondsinmonth;
+                        list($hn_year, $hn_month) =
+                            Date_Calc::nextMonth($hn_month, $hn_year);
+                        $hn_day = Date_Calc::getFirstDayOfMonth($hn_month, $hn_year);
+                    }
+                }
+            } else {
+                //
+                // (if $hn_seconds < 0)
+
+                // Go back to start of month:
+                //
+                if ($hn_secondsofmonth != 0 &&
+                    -$hn_seconds >= $hn_secondsofmonth) {
+                    $hn_seconds += $hn_secondsofmonth;
+                    $hn_secondsofmonth = 0;
+                    $hn_day = Date_Calc::getFirstDayOfMonth(
+                        $hn_month,
+                        $hn_year
+                    );
+                    $hn_hour = $hn_minute = $hn_second = 0;
+                }
+
+                // Go back to start of year:
+                //
+                if ($hn_secondsofmonth == 0) {
+                    while ($hn_month !=
+                        Date_Calc::getFirstMonthOfYear($hn_year)) {
+                        list($hn_year, $hn_prevmonth) =
+                            Date_Calc::prevMonth($hn_month, $hn_year);
+
+                        if (-$hn_seconds >= ($hn_secondsinmonth =
+                                Date_Calc::getSecondsInMonth(
+                                    $hn_prevmonth,
+                                    $hn_year
+                                ))) {
+                            $hn_seconds += $hn_secondsinmonth;
+                            $hn_month = $hn_prevmonth;
+                            $hn_day = Date_Calc::getFirstDayOfMonth(
+                                $hn_month,
+                                $hn_year
+                            );
+                        } else {
+                            break;
+                        }
+                    }
+                }
+
+                if ($hn_secondsofmonth == 0) {
+                    // Subtract years:
+                    //
+                    if ($hn_month == Date_Calc::getFirstMonthOfYear($hn_year)) {
+                        while (-$hn_seconds >= ($hn_secondsinyear =
+                                Date_Calc::getSecondsInYear($hn_year - 1))) {
+                            $hn_seconds += $hn_secondsinyear;
+                            $hn_month = Date_Calc::getFirstMonthOfYear(--$hn_year);
+                            $hn_day = Date_Calc::getFirstDayOfMonth(
+                                $hn_month,
+                                $hn_year
+                            );
+                        }
+                    }
+
+                    // Subtract months:
+                    //
+                    list($hn_pmyear, $hn_prevmonth) =
+                        Date_Calc::prevMonth($hn_month, $hn_year);
+                    while (-$hn_seconds >= ($hn_secondsinmonth =
+                            Date_Calc::getSecondsInMonth(
+                                $hn_prevmonth,
+                                $hn_pmyear
+                            ))) {
+                        $hn_seconds += $hn_secondsinmonth;
+                        $hn_year = $hn_pmyear;
+                        $hn_month = $hn_prevmonth;
+                        $hn_day = Date_Calc::getFirstDayOfMonth(
+                            $hn_month,
+                            $hn_year
+                        );
+                        list($hn_pmyear, $hn_prevmonth) =
+                            Date_Calc::prevMonth($hn_month, $hn_year);
+                    }
+                }
+            }
+
+            if ($hn_seconds < 0 && $hn_secondsofmonth == 0) {
+                list($hn_year, $hn_month) =
+                    Date_Calc::prevMonth($hn_month, $hn_year);
+                $hn_day = Date_Calc::getFirstDayOfMonth($hn_month, $hn_year);
+                $hn_seconds += Date_Calc::getSecondsInMonth($hn_month, $hn_year);
+            }
+
+            $hn_seconds += Date_Calc::secondsPastMidnight(
+                $hn_hour,
+                $hn_minute,
+                $hn_second
+            );
+            if ($hn_seconds < 0) {
+                $hn_daysadd = intval($hn_seconds / 86400) - 1;
+            } elseif ($hn_seconds < 86400) {
+                $hn_daysadd = 0;
+            } else {
+                $hn_daysadd = intval($hn_seconds / 86400) - 1;
+            }
+
+            if ($hn_daysadd != 0) {
+                list($hn_year, $hn_month, $hn_day) =
+                    explode(
+                        " ",
+                        Date_Calc::addDays(
+                            $hn_daysadd,
+                            $hn_day,
+                            $hn_month,
+                            $hn_year,
+                            "%Y %m %d"
+                        )
+                    );
+                $hn_seconds -= $hn_daysadd * 86400;
+            }
+
+            $hn_secondsinday = Date_Calc::getSecondsInDay(
+                $hn_day,
+                $hn_month,
+                $hn_year
+            );
+            if ($hn_seconds >= $hn_secondsinday) {
+                list($hn_year, $hn_month, $hn_day) =
+                    explode(
+                        " ",
+                        Date_Calc::addDays(
+                            1,
+                            $hn_day,
+                            $hn_month,
+                            $hn_year,
+                            "%Y %m %d"
+                        )
+                    );
+                $hn_seconds -= $hn_secondsinday;
+            }
+
+            list($hn_hour, $hn_minute, $hn_second) =
+                Date_Calc::secondsPastMidnightToTime($hn_seconds);
+
+            return array((int)$hn_year,
+                (int)$hn_month,
+                (int)$hn_day,
+                $hn_hour,
+                $hn_minute,
+                $hn_second);
+        } else {
+            // Assume every day has 86400 seconds exactly (ignore leap seconds):
+            //
+            $hn_minutes = intval($pn_seconds / 60);
+
+            if (is_float($pn_seconds)) {
+                $hn_second = $pn_second + fmod($pn_seconds, 60);
+            } else {
+                $hn_second = $pn_second + $pn_seconds % 60;
+            }
+
+            if ($hn_second >= 60) {
+                ++$hn_minutes;
+                $hn_second -= 60;
+            } elseif ($hn_second < 0) {
+                --$hn_minutes;
+                $hn_second += 60;
+            }
+
+            if ($hn_minutes == 0) {
+                $hn_year = $pn_year;
+                $hn_month = $pn_month;
+                $hn_day = $pn_day;
+                $hn_hour = $pn_hour;
+                $hn_minute = $pn_minute;
+            } else {
+                list($hn_year, $hn_month, $hn_day, $hn_hour, $hn_minute) =
+                    Date_Calc::addMinutes(
+                        $hn_minutes,
+                        $pn_day,
+                        $pn_month,
+                        $pn_year,
+                        $pn_hour,
+                        $pn_minute
+                    );
+            }
+
+            return array($hn_year,
+                $hn_month,
+                $hn_day,
+                $hn_hour,
+                $hn_minute,
+                $hn_second);
+        }
+    }
+
+
+    // }}}
+    // {{{ dateToDays()
+
+    /**
+     * Converts a date in the proleptic Gregorian calendar to the no of days
+     * since 24th November, 4714 B.C.
+     *
+     * Returns the no of days since Monday, 24th November, 4714 B.C. in the
+     * proleptic Gregorian calendar (which is 24th November, -4713 using
+     * 'Astronomical' year numbering, and 1st January, 4713 B.C. in the
+     * proleptic Julian calendar).  This is also the first day of the 'Julian
+     * Period' proposed by Joseph Scaliger in 1583, and the number of days
+     * since this date is known as the 'Julian Day'.  (It is not directly
+     * to do with the Julian calendar, although this is where the name
+     * is derived from.)
+     *
+     * The algorithm is valid for all years (positive and negative), and
+     * also for years preceding 4714 B.C.
+     *
+     * @param int $day the day of the month
+     * @param int $month the month
+     * @param int $year the year (using 'Astronomical' year numbering)
+     *
+     * @return   int        the number of days since 24th November, 4714 B.C.
+     * @access   public
+     * @static
+     */
+    public function dateToDays($day, $month, $year)
+    {
+        if ($month > 2) {
+            // March = 0, April = 1, ..., December = 9,
+            // January = 10, February = 11
+            $month -= 3;
+        } else {
+            $month += 9;
+            --$year;
+        }
+
+        $hb_negativeyear = $year < 0;
+        $century = intval($year / 100);
+        $year = $year % 100;
+
+        if ($hb_negativeyear) {
+            // Subtract 1 because year 0 is a leap year;
+            // And N.B. that we must treat the leap years as occurring
+            // one year earlier than they do, because for the purposes
+            // of calculation, the year starts on 1st March:
+            //
+            return intval((14609700 * $century + ($year == 0 ? 1 : 0)) / 400) +
+                intval((1461 * $year + 1) / 4) +
+                intval((153 * $month + 2) / 5) +
+                $day + 1721118;
+        } else {
+            return intval(146097 * $century / 4) +
+                intval(1461 * $year / 4) +
+                intval((153 * $month + 2) / 5) +
+                $day + 1721119;
+        }
+    }
+
+
+    // }}}
+    // {{{ daysToDate()
+
+    /**
+     * Converts no of days since 24th November, 4714 B.C. (in the proleptic
+     * Gregorian calendar, which is year -4713 using 'Astronomical' year
+     * numbering) to Gregorian calendar date
+     *
+     * Returned date belongs to the proleptic Gregorian calendar, using
+     * 'Astronomical' year numbering.
+     *
+     * The algorithm is valid for all years (positive and negative), and
+     * also for years preceding 4714 B.C. (i.e. for negative 'Julian Days'),
+     * and so the only limitation is platform-dependent (for 32-bit systems
+     * the maximum year would be something like about 1,465,190 A.D.).
+     *
+     * N.B. Monday, 24th November, 4714 B.C. is Julian Day '0'.
+     *
+     * @param int $days the number of days since 24th November, 4714 B.C.
+     * @param string $format the string indicating how to format the output
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     */
+    public function daysToDate($days, $format = DATE_CALC_FORMAT)
+    {
+        $days = intval($days);
+
+        $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);
+
+        $year = $century * 100 + $year;
+        if ($month < 10) {
+            $month += 3;
+        } else {
+            $month -= 9;
+            ++$year;
+        }
+
+        return Date_Calc::dateFormat($day, $month, $year, $format);
+    }
+
+
+    // }}}
+    // {{{ getMonths()
+
+    /**
+     * Returns array of the month numbers, in order, for the given year
+     *
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   array      array of integer month numbers, in order
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getMonths($pn_year)
+    {
+        // N.B. Month numbers can be skipped but not duplicated:
+        //
+        return array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+    }
+
+
+    // }}}
+    // {{{ 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 performance
+     * hits when called more than once.
+     *
+     * @param int $pb_abbreviated whether to return the abbreviated form of the
+     *                             months
+     *
+     * @return  array       associative array of integer month numbers, in
+     *                       order, to month names
+     * @access  public
+     * @static
+     */
+    public function getMonthNames($pb_abbreviated = false)
+    {
+        $ret = array();
+        foreach (Date_Calc::getMonths(2001) as $i) {
+            $ret[$i] = strftime(
+                $pb_abbreviated ? '%b' : '%B',
+                mktime(0, 0, 0, $i, 1, 2001)
+            );
+        }
+        return $ret;
+    }
+
+
+    // }}}
+    // {{{ prevMonth()
+
+    /**
+     * Returns month and year of previous month
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   array      array of year, month as integers
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function prevMonth($pn_month, $pn_year)
+    {
+        $ha_months = Date_Calc::getMonths($pn_year);
+        $hn_monthkey = array_search($pn_month, $ha_months);
+        if (array_key_exists($hn_monthkey - 1, $ha_months)) {
+            return array((int)$pn_year, $ha_months[$hn_monthkey - 1]);
+        } else {
+            $ha_months = Date_Calc::getMonths($pn_year - 1);
+            return array($pn_year - 1, end($ha_months));
+        }
+    }
+
+
+    // }}}
+    // {{{ nextMonth()
+
+    /**
+     * Returns month and year of next month
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   array      array of year, month as integers
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function nextMonth($pn_month, $pn_year)
+    {
+        $ha_months = Date_Calc::getMonths($pn_year);
+        $hn_monthkey = array_search($pn_month, $ha_months);
+        if (array_key_exists($hn_monthkey + 1, $ha_months)) {
+            return array((int)$pn_year, $ha_months[$hn_monthkey + 1]);
+        } else {
+            $ha_months = Date_Calc::getMonths($pn_year + 1);
+            return array($pn_year + 1, $ha_months[0]);
+        }
+    }
+
+
+    // }}}
+    // {{{ addMonthsToDays()
+
+    /**
+     * Returns 'Julian Day' of the date the specified no of months
+     * from the given date
+     *
+     * To subtract months use a negative value for the '$pn_months'
+     * parameter
+     *
+     * @param int $pn_months months to add
+     * @param int $pn_days 'Julian Day', i.e. the no of days since 1st
+     *                        January, 4713 B.C.
+     *
+     * @return   int        'Julian Day', i.e. the no of days since 1st January,
+     *                       4713 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addMonthsToDays($pn_months, $pn_days)
+    {
+        if ($pn_months == 0) {
+            return (int)$pn_days;
+        }
+
+        list($hn_year, $hn_month, $hn_day) =
+            explode(" ", Date_Calc::daysToDate($pn_days, "%Y %m %d"));
+
+        $hn_retmonth = $hn_month + $pn_months % 12;
+        $hn_retyear = $hn_year + intval($pn_months / 12);
+        if ($hn_retmonth < 1) {
+            $hn_retmonth += 12;
+            --$hn_retyear;
+        } elseif ($hn_retmonth > 12) {
+            $hn_retmonth -= 12;
+            ++$hn_retyear;
+        }
+
+        if (Date_Calc::isValidDate($hn_day, $hn_retmonth, $hn_retyear)) {
+            return Date_Calc::dateToDays($hn_day, $hn_retmonth, $hn_retyear);
+        }
+
+        // Calculate days since first of month:
+        //
+        $hn_dayoffset = $pn_days -
+            Date_Calc::firstDayOfMonth($hn_month, $hn_year);
+
+        $hn_retmonthfirstday = Date_Calc::firstDayOfMonth(
+            $hn_retmonth,
+            $hn_retyear
+        );
+        $hn_retmonthlastday = Date_Calc::lastDayOfMonth(
+            $hn_retmonth,
+            $hn_retyear
+        );
+
+        if ($hn_dayoffset > $hn_retmonthlastday - $hn_retmonthfirstday) {
+            return $hn_retmonthlastday;
+        } else {
+            return $hn_retmonthfirstday + $hn_dayoffset;
+        }
+    }
+
+
+    // }}}
+    // {{{ addMonths()
+
+    /**
+     * Returns the date the specified no of months from the given date
+     *
+     * To subtract months use a negative value for the '$pn_months'
+     * parameter
+     *
+     * @param int $pn_months months to add
+     * @param int $pn_day the day of the month, default is current local
+     *                           day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is
+     *                           current local year
+     * @param string $ps_format string specifying how to format the output
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addMonths(
+        $pn_months,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $ps_format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        if ($pn_months == 0) {
+            return Date_Calc::dateFormat(
+                $pn_day,
+                $pn_month,
+                $pn_year,
+                $ps_format
+            );
+        }
+
+        $hn_days = Date_Calc::dateToDays($pn_day, $pn_month, $pn_year);
+        return Date_Calc::daysToDate(
+            Date_Calc::addMonthsToDays(
+                $pn_months,
+                $hn_days
+            ),
+            $ps_format
+        );
+    }
+
+
+    // }}}
+    // {{{ addYearsToDays()
+
+    /**
+     * Returns 'Julian Day' of the date the specified no of years
+     * from the given date
+     *
+     * To subtract years use a negative value for the '$pn_years'
+     * parameter
+     *
+     * @param int $pn_years years to add
+     * @param int $pn_days 'Julian Day', i.e. the no of days since 1st January,
+     *                       4713 B.C.
+     *
+     * @return   int        'Julian Day', i.e. the no of days since 1st January,
+     *                       4713 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addYearsToDays($pn_years, $pn_days)
+    {
+        if ($pn_years == 0) {
+            return (int)$pn_days;
+        }
+
+        list($hn_year, $hn_month, $hn_day) =
+            explode(" ", Date_Calc::daysToDate($pn_days, "%Y %m %d"));
+
+        $hn_retyear = $hn_year + $pn_years;
+        if (Date_Calc::isValidDate($hn_day, $hn_month, $hn_retyear)) {
+            return Date_Calc::dateToDays($hn_day, $hn_month, $hn_retyear);
+        }
+
+        $ha_months = Date_Calc::getMonths($hn_retyear);
+        if (in_array($hn_month, $ha_months)) {
+            $hn_retmonth = $hn_month;
+
+            // Calculate days since first of month:
+            //
+            $hn_dayoffset = $pn_days - Date_Calc::firstDayOfMonth(
+                    $hn_month,
+                    $hn_year
+                );
+
+            $hn_retmonthfirstday = Date_Calc::firstDayOfMonth(
+                $hn_retmonth,
+                $hn_retyear
+            );
+            $hn_retmonthlastday = Date_Calc::lastDayOfMonth(
+                $hn_retmonth,
+                $hn_retyear
+            );
+
+            if ($hn_dayoffset > $hn_retmonthlastday - $hn_retmonthfirstday) {
+                return $hn_retmonthlastday;
+            } else {
+                return $hn_retmonthfirstday + $hn_dayoffset;
+            }
+        } else {
+            // Calculate days since first of year:
+            //
+            $hn_dayoffset = $pn_days - Date_Calc::firstDayOfYear($hn_year);
+
+            $hn_retyearfirstday = Date_Calc::firstDayOfYear($hn_retyear);
+            $hn_retyearlastday = Date_Calc::lastDayOfYear($hn_retyear);
+
+            if ($hn_dayoffset > $hn_retyearlastday - $hn_retyearfirstday) {
+                return $hn_retyearlastday;
+            } else {
+                return $hn_retyearfirstday + $hn_dayoffset;
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ addYears()
+
+    /**
+     * Returns the date the specified no of years from the given date
+     *
+     * To subtract years use a negative value for the '$pn_years'
+     * parameter
+     *
+     * @param int $pn_years years to add
+     * @param int $pn_day the day of the month, default is current local
+     *                           day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is
+     *                           current local year
+     * @param string $ps_format string specifying how to format the output
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addYears(
+        $pn_years,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $ps_format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        if ($pn_years == 0) {
+            return Date_Calc::dateFormat(
+                $pn_day,
+                $pn_month,
+                $pn_year,
+                $ps_format
+            );
+        }
+
+        $hn_days = Date_Calc::dateToDays($pn_day, $pn_month, $pn_year);
+        return Date_Calc::daysToDate(
+            Date_Calc::addYearsToDays(
+                $pn_years,
+                $hn_days
+            ),
+            $ps_format
+        );
+    }
+
+
+    // }}}
+    // {{{ addDays()
+
+    /**
+     * Returns the date the specified no of days from the given date
+     *
+     * To subtract days use a negative value for the '$pn_days' parameter
+     *
+     * @param int $pn_days days to add
+     * @param int $pn_day the day of the month, default is current local
+     *                           day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is
+     *                           current local year
+     * @param string $ps_format string specifying how to format the output
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function addDays(
+        $pn_days,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $ps_format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        if ($pn_days == 0) {
+            return Date_Calc::dateFormat(
+                $pn_day,
+                $pn_month,
+                $pn_year,
+                $ps_format
+            );
+        }
+
+        return Date_Calc::daysToDate(
+            Date_Calc::dateToDays(
+                $pn_day,
+                $pn_month,
+                $pn_year
+            ) +
+            $pn_days,
+            $ps_format
+        );
+    }
+
+
+    // }}}
+    // {{{ getFirstDayOfMonth()
+
+    /**
+     * Returns first day of the specified month of specified year as integer
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   int        number of first day of month
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getFirstDayOfMonth($pn_month, $pn_year)
+    {
+        return 1;
+    }
+
+
+    // }}}
+    // {{{ getLastDayOfMonth()
+
+    /**
+     * Returns last day of the specified month of specified year as integer
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   int        number of last day of month
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getLastDayOfMonth($pn_month, $pn_year)
+    {
+        return Date_Calc::daysInMonth($pn_month, $pn_year);
+    }
+
+
+    // }}}
+    // {{{ firstDayOfMonth()
+
+    /**
+     * Returns the Julian Day of the first day of the month of the specified
+     * year (i.e. the no of days since 24th November, 4714 B.C.)
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   integer    the number of days since 24th November, 4714 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function firstDayOfMonth($pn_month, $pn_year)
+    {
+        return Date_Calc::dateToDays(
+            Date_Calc::getFirstDayOfMonth(
+                $pn_month,
+                $pn_year
+            ),
+            $pn_month,
+            $pn_year
+        );
+    }
+
+
+    // }}}
+    // {{{ lastDayOfMonth()
+
+    /**
+     * Returns the Julian Day of the last day of the month of the specified
+     * year (i.e. the no of days since 24th November, 4714 B.C.)
+     *
+     * @param int $pn_month the month
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   integer    the number of days since 24th November, 4714 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function lastDayOfMonth($pn_month, $pn_year)
+    {
+        list($hn_nmyear, $hn_nextmonth) = Date_Calc::nextMonth(
+            $pn_month,
+            $pn_year
+        );
+        return Date_Calc::firstDayOfMonth($hn_nextmonth, $hn_nmyear) - 1;
+    }
+
+
+    // }}}
+    // {{{ getFirstMonthOfYear()
+
+    /**
+     * Returns first month of specified year as integer
+     *
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   int        number of first month of year
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function getFirstMonthOfYear($pn_year)
+    {
+        $ha_months = Date_Calc::getMonths($pn_year);
+        return $ha_months[0];
+    }
+
+
+    // }}}
+    // {{{ firstDayOfYear()
+
+    /**
+     * Returns the Julian Day of the first day of the year (i.e. the no of
+     * days since 24th November, 4714 B.C.)
+     *
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   integer    the number of days since 24th November, 4714 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function firstDayOfYear($pn_year)
+    {
+        return Date_Calc::firstDayOfMonth(
+            Date_Calc::getFirstMonthOfYear($pn_year),
+            $pn_year
+        );
+    }
+
+
+    // }}}
+    // {{{ lastDayOfYear()
+
+    /**
+     * Returns the Julian Day of the last day of the year (i.e. the no of
+     * days since 24th November, 4714 B.C.)
+     *
+     * @param int $pn_year the year (using 'Astronomical' year numbering)
+     *
+     * @return   integer    the number of days since 24th November, 4714 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function lastDayOfYear($pn_year)
+    {
+        return Date_Calc::firstDayOfYear($pn_year + 1) - 1;
+    }
+
+
+    // }}}
+    // {{{ dateToDaysJulian()
+
+    /**
+     * Converts a date in the proleptic Julian calendar to the no of days
+     * since 1st January, 4713 B.C.
+     *
+     * Returns the no of days since Monday, 1st January, 4713 B.C. in the
+     * proleptic Julian calendar (which is 1st January, -4712 using
+     * 'Astronomical' year numbering, and 24th November, 4713 B.C. in the
+     * proleptic Gregorian calendar).  This is also the first day of the 'Julian
+     * Period' proposed by Joseph Scaliger in 1583, and the number of days
+     * since this date is known as the 'Julian Day'.  (It is not directly
+     * to do with the Julian calendar, although this is where the name
+     * is derived from.)
+     *
+     * The algorithm is valid for all years (positive and negative), and
+     * also for years preceding 4713 B.C.
+     *
+     * @param int $day the day of the month
+     * @param int $month the month
+     * @param int $year the year (using 'Astronomical' year numbering)
+     *
+     * @return   int        the number of days since 1st January, 4713 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function dateToDaysJulian($day, $month, $year)
+    {
+        if ($month > 2) {
+            // March = 0, April = 1, ..., December = 9,
+            // January = 10, February = 11
+            $month -= 3;
+        } else {
+            $month += 9;
+            --$year;
+        }
+
+        $hb_negativeyear = $year < 0;
+
+        if ($hb_negativeyear) {
+            // Subtract 1 because year 0 is a leap year;
+            // And N.B. that we must treat the leap years as occurring
+            // one year earlier than they do, because for the purposes
+            // of calculation, the year starts on 1st March:
+            //
+            return intval((1461 * $year + 1) / 4) +
+                intval((153 * $month + 2) / 5) +
+                $day + 1721116;
+        } else {
+            return intval(1461 * $year / 4) +
+                floor((153 * $month + 2) / 5) +
+                $day + 1721117;
+        }
+    }
+
+
+    // }}}
+    // {{{ daysToDateJulian()
+
+    /**
+     * Converts no of days since 1st January, 4713 B.C. (in the proleptic
+     * Julian calendar, which is year -4712 using 'Astronomical' year
+     * numbering) to Julian calendar date
+     *
+     * Returned date belongs to the proleptic Julian calendar, using
+     * 'Astronomical' year numbering.
+     *
+     * @param int $days the number of days since 1st January, 4713 B.C.
+     * @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.5.0
+     */
+    public function daysToDateJulian($days, $format = DATE_CALC_FORMAT)
+    {
+        $days = intval($days);
+
+        $days -= 1721117;
+        $days = floor(4 * $days - 1);
+        $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;
+            ++$year;
+        }
+
+        return Date_Calc::dateFormat($day, $month, $year, $format);
+    }
+
+
+    // }}}
+    // {{{ isoWeekDate()
+
+    /**
+     * Returns array defining the 'ISO Week Date' as defined in ISO 8601
+     *
+     * Expects a date in the proleptic Gregorian calendar using 'Astronomical'
+     * year numbering, that is, with a year 0.  Algorithm is valid for all
+     * years (positive and negative).
+     *
+     * N.B. the ISO week day no for Sunday is defined as 7, whereas this
+     * class and its related functions defines Sunday as 0.
+     *
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     *
+     * @return   array      array of ISO Year, ISO Week No, ISO Day No as
+     *                       integers
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function isoWeekDate($pn_day = 0, $pn_month = 0, $pn_year = null)
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_jd = Date_Calc::dateToDays($pn_day, $pn_month, $pn_year);
+        $hn_wd = Date_Calc::daysToDayOfWeek($hn_jd);
+        if ($hn_wd == 0) {
+            $hn_wd = 7;
+        }
+
+        $hn_jd1 = Date_Calc::firstDayOfYear($pn_year);
+        $hn_day = $hn_jd - $hn_jd1 + 1;
+
+        if ($hn_wd <= $hn_jd - Date_Calc::lastDayOfYear($pn_year) + 3) {
+            // ISO week is the first week of the next ISO year:
+            //
+            $hn_year = $pn_year + 1;
+            $hn_isoweek = 1;
+        } else {
+            switch ($hn_wd1 = Date_Calc::daysToDayOfWeek($hn_jd1)) {
+                case 1:
+                case 2:
+                case 3:
+                case 4:
+                    // Monday - Thursday:
+                    //
+                    $hn_year = $pn_year;
+                    $hn_isoweek = floor(($hn_day + $hn_wd1 - 2) / 7) + 1;
+                    break;
+                case 0:
+                    $hn_wd1 = 7;
+                // no break
+                case 5:
+                case 6:
+                    // Friday - Sunday:
+                    //
+                    if ($hn_day <= 8 - $hn_wd1) {
+                        // ISO week is the last week of the previous ISO year:
+                        //
+                        list($hn_year, $hn_lastmonth, $hn_lastday) =
+                            explode(
+                                " ",
+                                Date_Calc::daysToDate($hn_jd1 - 1, "%Y %m %d")
+                            );
+                        list($hn_year, $hn_isoweek, $hn_pisoday) =
+                            Date_Calc::isoWeekDate(
+                                $hn_lastday,
+                                $hn_lastmonth,
+                                $hn_year
+                            );
+                    } else {
+                        $hn_year = $pn_year;
+                        $hn_isoweek = floor(($hn_day + $hn_wd1 - 9) / 7) + 1;
+                    }
+
+                    break;
+            }
+        }
+
+        return array((int)$hn_year, (int)$hn_isoweek, (int)$hn_wd);
+    }
+
+
+    // }}}
+    // {{{ gregorianToISO()
+
+    /**
+     * Converts from Gregorian Year-Month-Day to ISO Year-WeekNumber-WeekDay
+     *
+     * Uses ISO 8601 definitions.
+     *
+     * @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.
+     *
+     * @return   string     the date in ISO Year-WeekNumber-WeekDay format
+     * @access   public
+     * @static
+     */
+    public function gregorianToISO($day, $month, $year)
+    {
+        list($yearnumber, $weeknumber, $weekday) =
+            Date_Calc::isoWeekDate($day, $month, $year);
+        return sprintf("%04d", $yearnumber) .
+            '-' .
+            sprintf("%02d", $weeknumber) .
+            '-' .
+            $weekday;
+    }
+
+
+    // }}}
+    // {{{ weekOfYear4th()
+
+    /**
+     * Returns week of the year counting week 1 as the week that contains 4th
+     * January
+     *
+     * Week 1 is determined to be the week that includes the 4th January, and
+     * therefore can be defined as the first week of the year that has at least
+     * 4 days.  The previous week is counted as week 52 or 53 of the previous
+     * year.  Note that this definition depends on which day is the first day of
+     * the week, and that if this is not passed as the '$pn_firstdayofweek'
+     * parameter, the default is assumed.
+     *
+     * Note also that the last day week of the year is likely to extend into
+     * the following year, except in the case that the last day of the week
+     * falls on 31st December.
+     *
+     * Also note that this is very similar to the ISO week returned by
+     * {@link Date::isoWeekDate()}, the difference being that the ISO week
+     * always has 7 days, and if the 4th of January is a Friday, for example,
+     * ISO week 1 would start on Monday, 31st December in the previous year,
+     * whereas the week defined by this function would start on 1st January,
+     * but would be only 6 days long.  Of course you can also set the day
+     * of the week, whereas the ISO week starts on a Monday by definition.
+     *
+     * Returned week is an integer from 1 to 53.
+     *
+     * @param int $pn_day the day of the month, default is current
+     *                                local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is
+     *                                current local year
+     * @param int $pn_firstdayofweek optional integer specifying the first day
+     *                                of the week
+     *
+     * @return   array      array of year, week no as integers
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function weekOfYear4th(
+        $pn_day = 0,
+        $pn_month = 0,
+        $pn_year = null,
+        $pn_firstdayofweek = DATE_CALC_BEGIN_WEEKDAY
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_wd1 = Date_Calc::daysToDayOfWeek(Date_Calc::firstDayOfYear($pn_year));
+        $hn_day = Date_Calc::dayOfYear($pn_day, $pn_month, $pn_year);
+        $hn_week = floor(($hn_day +
+                (10 + $hn_wd1 - $pn_firstdayofweek) % 7 +
+                3) / 7);
+
+        if ($hn_week > 0) {
+            $hn_year = $pn_year;
+        } else {
+            // Week number is the last week of the previous year:
+            //
+            list($hn_year, $hn_lastmonth, $hn_lastday) =
+                explode(
+                    " ",
+                    Date_Calc::daysToDate(
+                        Date_Calc::lastDayOfYear($pn_year - 1),
+                        "%Y %m %d"
+                    )
+                );
+            list($hn_year, $hn_week) =
+                Date_Calc::weekOfYear4th(
+                    $hn_lastday,
+                    $hn_lastmonth,
+                    $hn_year,
+                    $pn_firstdayofweek
+                );
+        }
+
+        return array((int)$hn_year, (int)$hn_week);
+    }
+
+
+    // }}}
+    // {{{ weekOfYear7th()
+
+    /**
+     * Returns week of the year counting week 1 as the week that contains 7th
+     * January
+     *
+     * Week 1 is determined to be the week that includes the 7th January, and
+     * therefore can be defined as the first full week of the year.  The
+     * previous week is counted as week 52 or 53 of the previous year.  Note
+     * that this definition depends on which day is the first day of the week,
+     * and that if this is not passed as the '$pn_firstdayofweek' parameter, the
+     * default is assumed.
+     *
+     * Note also that the last day week of the year is likely to extend into
+     * the following year, except in the case that the last day of the week
+     * falls on 31st December.
+     *
+     * Returned week is an integer from 1 to 53.
+     *
+     * @param int $pn_day the day of the month, default is current
+     *                                local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is
+     *                                current local year
+     * @param int $pn_firstdayofweek optional integer specifying the first day
+     *                                of the week
+     *
+     * @return   array      array of year, week no as integers
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function weekOfYear7th(
+        $pn_day = 0,
+        $pn_month = 0,
+        $pn_year = null,
+        $pn_firstdayofweek = DATE_CALC_BEGIN_WEEKDAY
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_wd1 = Date_Calc::daysToDayOfWeek(Date_Calc::firstDayOfYear($pn_year));
+        $hn_day = Date_Calc::dayOfYear($pn_day, $pn_month, $pn_year);
+        $hn_week = floor(($hn_day + (6 + $hn_wd1 - $pn_firstdayofweek) % 7) / 7);
+
+        if ($hn_week > 0) {
+            $hn_year = $pn_year;
+        } else {
+            // Week number is the last week of the previous ISO year:
+            //
+            list($hn_year, $hn_lastmonth, $hn_lastday) = explode(" ", Date_Calc::daysToDate(Date_Calc::lastDayOfYear($pn_year - 1), "%Y %m %d"));
+            list($hn_year, $hn_week) = Date_Calc::weekOfYear7th($hn_lastday, $hn_lastmonth, $hn_year, $pn_firstdayofweek);
+        }
+
+        return array((int)$hn_year, (int)$hn_week);
+    }
+
+
+    // }}}
+    // {{{ dateSeason()
+
+    /**
+     * Determines julian date of the given season
+     *
+     * @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
+     *                        -1000 B.C. and 3000 A.D.
+     *
+     * @return   float      the julian date the season starts on
+     * @access   public
+     * @static
+     */
+    public 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;
+    }
+
+
+    // }}}
+    // {{{ dayOfYear()
+
+    /**
+     * Returns number of days since 31 December of year before given date
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is current
+     *                       local year
+     *
+     * @return   int
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function dayOfYear($pn_day = 0, $pn_month = 0, $pn_year = null)
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_jd = Date_Calc::dateToDays($pn_day, $pn_month, $pn_year);
+        $hn_jd1 = Date_Calc::firstDayOfYear($pn_year);
+        return $hn_jd - $hn_jd1 + 1;
+    }
+
+
+    // }}}
+    // {{{ julianDate()
+
+    /**
+     * Returns number of days since 31 December of year before given date
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is current
+     *                       local year
+     *
+     * @return     int
+     * @access     public
+     * @static
+     * @deprecated Method deprecated in Release 1.5.0
+     */
+    public function julianDate($pn_day = 0, $pn_month = 0, $pn_year = null)
+    {
+        return Date_Calc::dayOfYear($pn_day, $pn_month, $pn_year);
+    }
+
+
+    // }}}
+    // {{{ getWeekdayFullname()
+
+    /**
+     * Returns the full weekday name for the given date
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_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
+     */
+    public function getWeekdayFullname($pn_day = 0, $pn_month = 0, $pn_year = null)
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $weekday_names = Date_Calc::getWeekDays();
+        $weekday = Date_Calc::dayOfWeek($pn_day, $pn_month, $pn_year);
+        return $weekday_names[$weekday];
+    }
+
+
+    // }}}
+    // {{{ getWeekdayAbbrname()
+
+    /**
+     * Returns the abbreviated weekday name for the given date
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_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()
+     */
+    public function getWeekdayAbbrname(
+        $pn_day = 0,
+        $pn_month = 0,
+        $pn_year = null,
+        $length = 3
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $weekday_names = Date_Calc::getWeekDays(true);
+        $weekday = Date_Calc::dayOfWeek($pn_day, $pn_month, $pn_year);
+        return $weekday_names[$weekday];
+    }
+
+
+    // }}}
+    // {{{ 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
+     */
+    public 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
+     */
+    public function getMonthAbbrname($month, $length = 3)
+    {
+        $month = (int)$month;
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        $month_names = Date_Calc::getMonthNames(true);
+        return $month_names[$month];
+    }
+
+
+    // }}}
+    // {{{ 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   int        the month's number
+     * @access   public
+     * @static
+     */
+    public function getMonthFromFullName($month)
+    {
+        $month = strtolower($month);
+        $months = Date_Calc::getMonthNames();
+        while (list($id, $name) = each($months)) {
+            if (preg_match('/' . $month . '/', strtolower($name))) {
+                return $id;
+            }
+        }
+        return 0;
+    }
+
+
+    // }}}
+    // {{{ getWeekDays()
+
+    /**
+     * Returns an array of week day names
+     *
+     * Used to take advantage of the setlocale function to return language
+     * specific week days.
+     *
+     * @param int $pb_abbreviated whether to return the abbreviated form of the
+     *                             days
+     *
+     * @return   array      an array of week-day names
+     * @access   public
+     * @static
+     */
+    public function getWeekDays($pb_abbreviated = false)
+    {
+        for ($i = 0; $i < 7; $i++) {
+            $weekdays[$i] = strftime(
+                $pb_abbreviated ? '%a' : '%A',
+                mktime(0, 0, 0, 1, $i, 2001)
+            );
+        }
+        return $weekdays;
+    }
+
+
+    // }}}
+    // {{{ daysToDayOfWeek()
+
+    /**
+     * Returns day of week for specified 'Julian Day'
+     *
+     * The algorithm is valid for all years (positive and negative), and
+     * also for years preceding 4714 B.C. (i.e. for negative 'Julian Days'),
+     * and so the only limitation is platform-dependent (for 32-bit systems
+     * the maximum year would be something like about 1,465,190 A.D.).
+     *
+     * N.B. Monday, 24th November, 4714 B.C. is Julian Day '0'.
+     *
+     * @param int $pn_days the number of days since 24th November, 4714 B.C.
+     *
+     * @return   int        integer from 0 to 7 where 0 represents Sunday
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function daysToDayOfWeek($pn_days)
+    {
+        // On Julian day 0 the day is Monday (PHP day 1):
+        //
+        $ret = ($pn_days + 1) % 7;
+        return $ret < 0 ? $ret + 7 : $ret;
+    }
+
+
+    // }}}
+    // {{{ dayOfWeek()
+
+    /**
+     * Returns day of week for given date (0 = Sunday)
+     *
+     * The algorithm is valid for all years (positive and negative).
+     *
+     * @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
+     */
+    public function dayOfWeek($day = null, $month = null, $year = null)
+    {
+        if (is_null($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 += 12;
+        //     --$year;
+        // }
+
+        // $wd = ($day +
+        //        intval((13 * $month + 3) / 5) +
+        //        $year +
+        //        floor($year / 4) -
+        //        floor($year / 100) +
+        //        floor($year / 400) +
+        //        1) % 7;
+
+        // return (int) ($wd < 0 ? $wd + 7 : $wd);
+
+        return Date_Calc::daysToDayOfWeek(Date_Calc::dateToDays(
+            $day,
+            $month,
+            $year
+        ));
+    }
+
+
+    // }}}
+    // {{{ weekOfYearAbsolute()
+
+    /**
+     * Returns week of the year counting week 1 as 1st-7th January,
+     * regardless of what day 1st January falls on
+     *
+     * Returned value is an integer from 1 to 53.  Week 53 will start on
+     * 31st December and have only one day, except in a leap year, in
+     * which it will start a day earlier and contain two days.
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is current
+     *                       local year
+     *
+     * @return   int        integer from 1 to 53
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function weekOfYearAbsolute($pn_day = 0, $pn_month = 0, $pn_year = null)
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_day = Date_Calc::dayOfYear($pn_day, $pn_month, $pn_year);
+        return intval(($hn_day + 6) / 7);
+    }
+
+
+    // }}}
+    // {{{ weekOfYear1st()
+
+    /**
+     * Returns week of the year counting week 1 as the week that contains 1st
+     * January
+     *
+     * Week 1 is determined to be the week that includes the 1st January, even
+     * if this week extends into the previous year, in which case the week will
+     * only contain between 1 and 6 days of the current year.  Note that this
+     * definition depends on which day is the first day of the week, and that if
+     * this is not passed as the '$pn_firstdayofweek' parameter, the default is
+     * assumed.
+     *
+     * Note also that the last day week of the year is also likely to contain
+     * less than seven days, except in the case that the last day of the week
+     * falls on 31st December.
+     *
+     * Returned value is an integer from 1 to 54.  The year will only contain
+     * 54 weeks in the case of a leap year in which 1st January is the last day
+     * of the week, and 31st December is the first day of the week.  In this
+     * case, both weeks 1 and 54 will contain one day only.
+     *
+     * @param int $pn_day the day of the month, default is current
+     *                                local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is
+     *                                current local year
+     * @param int $pn_firstdayofweek optional integer specifying the first day
+     *                                of the week
+     *
+     * @return   int        integer from 1 to 54
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function weekOfYear1st(
+        $pn_day = 0,
+        $pn_month = 0,
+        $pn_year = null,
+        $pn_firstdayofweek = DATE_CALC_BEGIN_WEEKDAY
+    )
+    {
+        if (is_null($pn_year)) {
+            $pn_year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($pn_month)) {
+            $pn_month = Date_Calc::dateNow('%m');
+        }
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_wd1 = Date_Calc::daysToDayOfWeek(Date_Calc::firstDayOfYear($pn_year));
+        $hn_day = Date_Calc::dayOfYear($pn_day, $pn_month, $pn_year);
+        return floor(($hn_day + (7 + $hn_wd1 - $pn_firstdayofweek) % 7 + 6) / 7);
+    }
+
+
+    // }}}
+    // {{{ weekOfYear()
+
+    /**
+     * Returns week of the year, where first Sunday is first day of first week
+     *
+     * N.B. this function is equivalent to calling:
+     *
+     *  <code>Date_Calc::weekOfYear7th($day, $month, $year, 0);</code>
+     *
+     * Returned week is an integer from 1 to 53.
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     * @param int $pn_month the month, default is current local month
+     * @param int $pn_year the year in four digit format, default is current
+     *                       local year
+     *
+     * @return     int        integer from 1 to 53
+     * @access     public
+     * @static
+     * @see        Date_Calc::weekOfYear7th
+     * @deprecated Method deprecated in Release 1.5.0
+     */
+    public function weekOfYear($pn_day = 0, $pn_month = 0, $pn_year = null)
+    {
+        $ha_week = Date_Calc::weekOfYear7th($pn_day, $pn_month, $pn_year, 0);
+        return $ha_week[1];
+    }
+
+
+    // }}}
+    // {{{ weekOfMonthAbsolute()
+
+    /**
+     * Returns week of the month counting week 1 as 1st-7th of the month,
+     * regardless of what day the 1st falls on
+     *
+     * Returned value is an integer from 1 to 5.  Week 5 will start on
+     * the 29th of the month and have between 1 and 3 days, except
+     * in February in a non-leap year, when there will be 4 weeks only.
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     *
+     * @return   int        integer from 1 to 5
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function weekOfMonthAbsolute($pn_day = 0)
+    {
+        if (empty($pn_day)) {
+            $pn_day = Date_Calc::dateNow('%d');
+        }
+        return intval(($pn_day + 6) / 7);
+    }
+
+
+    // }}}
+    // {{{ weekOfMonth()
+
+    /**
+     * Alias for 'weekOfMonthAbsolute()'
+     *
+     * @param int $pn_day the day of the month, default is current local day
+     *
+     * @return   int        integer from 1 to 5
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function weekOfMonth($pn_day = 0)
+    {
+        return Date_Calc::weekOfMonthAbsolute($pn_day);
+    }
+
+
+    // }}}
+    // {{{ 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
+     */
+    public function quarterOfYear($day = 0, $month = 0, $year = null)
+    {
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        return intval(($month - 1) / 3 + 1);
+    }
+
+
+    // }}}
+    // {{{ daysInMonth()
+
+    /**
+     * Returns 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
+     */
+    public function daysInMonth($month = 0, $year = null)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        return Date_Calc::lastDayOfMonth($month, $year) -
+            Date_Calc::firstDayOfMonth($month, $year) +
+            1;
+    }
+
+
+    // }}}
+    // {{{ daysInYear()
+
+    /**
+     * Returns the number of days in the given year
+     *
+     * @param int $year the year in four digit format, default is current local
+     *                   year
+     *
+     * @return   int        the number of days the year has
+     * @access   public
+     * @static
+     */
+    public function daysInYear($year = null)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+
+        return Date_Calc::firstDayOfYear($year + 1) -
+            Date_Calc::firstDayOfYear($year);
+    }
+
+
+    // }}}
+    // {{{ 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
+     */
+    public function weeksInMonth($month = 0, $year = null)
+    {
+        if (is_null($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
+     */
+    public function getCalendarWeek(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($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
+     */
+    public function getCalendarMonth(
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($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::firstDayOfMonth($month, $year) - 6;
+            } else {
+                $curr_day = Date_Calc::firstDayOfMonth($month, $year)
+                    - Date_Calc::firstOfMonthWeekday($month, $year) + 1;
+            }
+        } else {
+            $curr_day = (Date_Calc::firstDayOfMonth($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
+     */
+    public function getCalendarYear($year = null, $format = DATE_CALC_FORMAT)
+    {
+        if (is_null($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
+     */
+    public function prevDay(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        if (empty($day)) {
+            $day = Date_Calc::dateNow('%d');
+        }
+
+        return Date_Calc::addDays(-1, $day, $month, $year, $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
+     */
+    public function nextDay(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        if (empty($day)) {
+            $day = Date_Calc::dateNow('%d');
+        }
+
+        return Date_Calc::addDays(1, $day, $month, $year, $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
+     */
+    public function prevWeekday(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($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
+     */
+    public function nextWeekday(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($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);
+    }
+
+
+    // }}}
+    // {{{ daysToPrevDayOfWeek()
+
+    /**
+     * Returns 'Julian Day' of the previous specific day of the week
+     * from the given date.
+     *
+     * @param int $dow the day of the week (0 = Sunday)
+     * @param int $days 'Julian Day', i.e. the no of days since 1st
+     *                          January, 4713 B.C.
+     * @param bool $onorbefore if true and days are same, returns current day
+     *
+     * @return   int        'Julian Day', i.e. the no of days since 1st January,
+     *                       4713 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function daysToPrevDayOfWeek($dow, $days, $onorbefore = false)
+    {
+        $curr_weekday = Date_Calc::daysToDayOfWeek($days);
+        if ($curr_weekday == $dow) {
+            if ($onorbefore) {
+                return $days;
+            } else {
+                return $days - 7;
+            }
+        } elseif ($curr_weekday < $dow) {
+            return $days - 7 + $dow - $curr_weekday;
+        } else {
+            return $days - $curr_weekday + $dow;
+        }
+    }
+
+
+    // }}}
+    // {{{ prevDayOfWeek()
+
+    /**
+     * Returns date of the previous 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 string $format the string indicating how to format the output
+     * @param bool $onorbefore if true and days are same, returns current day
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     */
+    public function prevDayOfWeek(
+        $dow,
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT,
+        $onorbefore = false
+    )
+    {
+        if (is_null($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);
+        $days = Date_Calc::daysToPrevDayOfWeek($dow, $days, $onorbefore);
+        return Date_Calc::daysToDate($days, $format);
+    }
+
+
+    // }}}
+    // {{{ daysToNextDayOfWeek()
+
+    /**
+     * Returns 'Julian Day' of the next specific day of the week
+     * from the given date.
+     *
+     * @param int $dow the day of the week (0 = Sunday)
+     * @param int $days 'Julian Day', i.e. the no of days since 1st
+     *                         January, 4713 B.C.
+     * @param bool $onorafter if true and days are same, returns current day
+     *
+     * @return   int        'Julian Day', i.e. the no of days since 1st January,
+     *                       4713 B.C.
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function daysToNextDayOfWeek($dow, $days, $onorafter = false)
+    {
+        $curr_weekday = Date_Calc::daysToDayOfWeek($days);
+        if ($curr_weekday == $dow) {
+            if ($onorafter) {
+                return $days;
+            } else {
+                return $days + 7;
+            }
+        } elseif ($curr_weekday > $dow) {
+            return $days + 7 - $curr_weekday + $dow;
+        } else {
+            return $days + $dow - $curr_weekday;
+        }
+    }
+
+
+    // }}}
+    // {{{ 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 string $format the string indicating how to format the output
+     * @param bool $onorafter if true and days are same, returns current day
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     */
+    public function nextDayOfWeek(
+        $dow,
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT,
+        $onorafter = false
+    )
+    {
+        if (is_null($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);
+        $days = Date_Calc::daysToNextDayOfWeek($dow, $days, $onorafter);
+        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
+     */
+    public function prevDayOfWeekOnOrBefore(
+        $dow,
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $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
+     */
+    public function nextDayOfWeekOnOrAfter(
+        $dow,
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $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 {@link 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
+     */
+    public function beginOfWeek(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        if (empty($day)) {
+            $day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_days = Date_Calc::dateToDays($day, $month, $year);
+        $this_weekday = Date_Calc::daysToDayOfWeek($hn_days);
+        $interval = (7 - DATE_CALC_BEGIN_WEEKDAY + $this_weekday) % 7;
+        return Date_Calc::daysToDate($hn_days - $interval, $format);
+    }
+
+
+    // }}}
+    // {{{ endOfWeek()
+
+    /**
+     * Find the month day of the end of week for given date,
+     * using {@link 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
+     */
+    public function endOfWeek(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        if (empty($day)) {
+            $day = Date_Calc::dateNow('%d');
+        }
+
+        $hn_days = Date_Calc::dateToDays($day, $month, $year);
+        $this_weekday = Date_Calc::daysToDayOfWeek($hn_days);
+        $interval = (6 + DATE_CALC_BEGIN_WEEKDAY - $this_weekday) % 7;
+        return Date_Calc::daysToDate($hn_days + $interval, $format);
+    }
+
+
+    // }}}
+    // {{{ beginOfPrevWeek()
+
+    /**
+     * Find the month day of the beginning of week before given date,
+     * using {@link 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
+     */
+    public function beginOfPrevWeek(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        if (empty($day)) {
+            $day = Date_Calc::dateNow('%d');
+        }
+
+        list($hn_pwyear, $hn_pwmonth, $hn_pwday) =
+            explode(" ", Date_Calc::daysToDate(
+                Date_Calc::dateToDays(
+                    $day,
+                    $month,
+                    $year
+                ) - 7,
+                '%Y %m %d'
+            ));
+        return Date_Calc::beginOfWeek(
+            $hn_pwday,
+            $hn_pwmonth,
+            $hn_pwyear,
+            $format
+        );
+    }
+
+
+    // }}}
+    // {{{ beginOfNextWeek()
+
+    /**
+     * Find the month day of the beginning of week after given date,
+     * using {@link 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
+     */
+    public function beginOfNextWeek(
+        $day = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        if (empty($day)) {
+            $day = Date_Calc::dateNow('%d');
+        }
+
+        list($hn_pwyear, $hn_pwmonth, $hn_pwday) =
+            explode(
+                " ",
+                Date_Calc::daysToDate(
+                    Date_Calc::dateToDays(
+                        $day,
+                        $month,
+                        $year
+                    ) + 7,
+                    '%Y %m %d'
+                )
+            );
+        return Date_Calc::beginOfWeek(
+            $hn_pwday,
+            $hn_pwmonth,
+            $hn_pwyear,
+            $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
+     */
+    public function beginOfMonth($month = 0, $year = null, $format = DATE_CALC_FORMAT)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        return Date_Calc::dateFormat(
+            Date_Calc::getFirstDayOfMonth(
+                $month,
+                $year
+            ),
+            $month,
+            $year,
+            $format
+        );
+    }
+
+
+    // }}}
+    // {{{ endOfMonth()
+
+    /**
+     * Return date of last 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()
+     * @since      Method available since Release 1.5.0
+     * @deprecated Method deprecated in Release 1.5.0
+     */
+    public function endOfMonth($month = 0, $year = null, $format = DATE_CALC_FORMAT)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        return Date_Calc::daysToDate(
+            Date_Calc::lastDayOfMonth($month, $year),
+            $format
+        );
+    }
+
+
+    // }}}
+    // {{{ beginOfPrevMonth()
+
+    /**
+     * Returns date of the first day of previous month of given date
+     *
+     * @param mixed $dummy irrelevant parameter
+     * @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
+     */
+    public function beginOfPrevMonth(
+        $dummy = null,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        list($hn_pmyear, $hn_prevmonth) = Date_Calc::prevMonth($month, $year);
+        return Date_Calc::dateFormat(
+            Date_Calc::getFirstDayOfMonth(
+                $hn_prevmonth,
+                $hn_pmyear
+            ),
+            $hn_prevmonth,
+            $hn_pmyear,
+            $format
+        );
+    }
+
+
+    // }}}
+    // {{{ endOfPrevMonth()
+
+    /**
+     * Returns date of the last day of previous month for given date
+     *
+     * @param mixed $dummy irrelevant parameter
+     * @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
+     */
+    public function endOfPrevMonth(
+        $dummy = null,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        return Date_Calc::daysToDate(
+            Date_Calc::firstDayOfMonth(
+                $month,
+                $year
+            ) - 1,
+            $format
+        );
+    }
+
+
+    // }}}
+    // {{{ beginOfNextMonth()
+
+    /**
+     * Returns date of begin of next month of given date
+     *
+     * @param mixed $dummy irrelevant parameter
+     * @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
+     */
+    public function beginOfNextMonth(
+        $dummy = null,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        list($hn_nmyear, $hn_nextmonth) = Date_Calc::nextMonth($month, $year);
+        return Date_Calc::dateFormat(
+            Date_Calc::getFirstDayOfMonth(
+                $hn_nextmonth,
+                $hn_nmyear
+            ),
+            $hn_nextmonth,
+            $hn_nmyear,
+            $format
+        );
+    }
+
+
+    // }}}
+    // {{{ endOfNextMonth()
+
+    /**
+     * Returns date of the last day of next month of given date
+     *
+     * @param mixed $dummy irrelevant parameter
+     * @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
+     */
+    public function endOfNextMonth(
+        $dummy = null,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        list($hn_nmyear, $hn_nextmonth) = Date_Calc::nextMonth($month, $year);
+        return Date_Calc::daysToDate(
+            Date_Calc::lastDayOfMonth(
+                $hn_nextmonth,
+                $hn_nmyear
+            ),
+            $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.
+     *                        Nought 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
+     */
+    public function beginOfMonthBySpan(
+        $months = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        return Date_Calc::addMonths(
+            $months,
+            Date_Calc::getFirstDayOfMonth($month, $year),
+            $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.
+     *                        Nought 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
+     */
+    public function endOfMonthBySpan(
+        $months = 0,
+        $month = 0,
+        $year = null,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+
+        $hn_days = Date_Calc::addMonthsToDays(
+                $months + 1,
+                Date_Calc::firstDayOfMonth($month, $year)
+            ) - 1;
+        return Date_Calc::daysToDate($hn_days, $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
+     */
+    public function firstOfMonthWeekday($month = 0, $year = null)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if (empty($month)) {
+            $month = Date_Calc::dateNow('%m');
+        }
+        return Date_Calc::daysToDayOfWeek(Date_Calc::firstDayOfMonth(
+            $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 to 5.  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.
+     * @param string $format the string indicating how to format the output
+     *
+     * @return   string     the date in the desired format
+     * @access   public
+     * @static
+     */
+    public function nWeekDayOfMonth(
+        $week,
+        $dow,
+        $month,
+        $year,
+        $format = DATE_CALC_FORMAT
+    )
+    {
+        if ((is_numeric($week) && ($week < 1 || $week > 5)) ||
+            (!is_numeric($week) && $week != "last")
+        ) {
+            return PEAR::raiseError("Invalid week value '$week', only 1-5 or 'last' accepted");
+        }
+
+        if ($dow < 0 || $dow > 6) {
+            return PEAR::raiseError("Invalid dow value '$dow', only 0-6 accepted");
+        }
+
+        if ($month < 1 || $month > 12) {
+            return PEAR::raiseError("Invalid month value '$month'");
+        }
+
+        if (is_numeric($week)) {
+            // the weekday of first day of month "1"
+            $DOW1 = Date_Calc::dayOfWeek(1, $month, $year);
+
+            // finds the sunday
+            $sunday = ($week - 1) * 7 + 1;
+            if ($DOW1 > 0) {
+                $sunday += (7 - $DOW1);
+            }
+
+            // adjust the sunday with dow addition
+            $wdate = $sunday + $dow;
+            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
+     *
+     * Uses the proleptic Gregorian calendar, with the year 0 (1 B.C.)
+     * assumed to be valid and also assumed to be a leap year.
+     *
+     * @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.
+     *
+     * @return   bool
+     * @access   public
+     * @static
+     */
+    public function isValidDate($day, $month, $year)
+    {
+        if ($day < 1 || $month < 1 || $month > 12) {
+            return false;
+        }
+        if ($month == 2) {
+            if (Date_Calc::isLeapYearGregorian($year)) {
+                return $day <= 29;
+            } else {
+                return $day <= 28;
+            }
+        } elseif ($month == 4 || $month == 6 || $month == 9 || $month == 11) {
+            return $day <= 30;
+        } else {
+            return $day <= 31;
+        }
+    }
+
+
+    // }}}
+    // {{{ isLeapYearGregorian()
+
+    /**
+     * Returns true for a leap year, else false
+     *
+     * Uses the proleptic Gregorian calendar.  The year 0 (1 B.C.) is
+     * assumed in this algorithm to be a leap year.  The function is
+     * valid for all years, positive and negative.
+     *
+     * @param int $year the year.  Use the complete year instead of the
+     *                   abbreviated version.  E.g. use 2005, not 05.
+     *
+     * @return   bool
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function isLeapYearGregorian($year = null)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        return (($year % 4 == 0) &&
+                ($year % 100 != 0)) ||
+            ($year % 400 == 0);
+    }
+
+
+    // }}}
+    // {{{ isLeapYearJulian()
+
+    /**
+     * Returns true for a leap year, else false
+     *
+     * Uses the proleptic Julian calendar.  The year 0 (1 B.C.) is
+     * assumed in this algorithm to be a leap year.  The function is
+     * valid for all years, positive and negative.
+     *
+     * @param int $year the year.  Use the complete year instead of the
+     *                   abbreviated version.  E.g. use 2005, not 05.
+     *
+     * @return   boolean
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function isLeapYearJulian($year = null)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        return $year % 4 == 0;
+    }
+
+
+    // }}}
+    // {{{ 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.
+     *
+     * @return   boolean
+     * @access   public
+     * @static
+     */
+    public function isLeapYear($year = null)
+    {
+        if (is_null($year)) {
+            $year = Date_Calc::dateNow('%Y');
+        }
+        if ($year < 1582) {
+            // pre Gregorio XIII - 1582
+            return Date_Calc::isLeapYearJulian($year);
+        } else {
+            // post Gregorio XIII - 1582
+            return Date_Calc::isLeapYearGregorian($year);
+        }
+    }
+
+
+    // }}}
+    // {{{ 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.
+     *
+     * @return   bool
+     * @access   public
+     * @static
+     */
+    public 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.
+     *
+     * @return   boolean
+     * @access   public
+     * @static
+     */
+    public 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.
+     * @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.
+     *
+     * @return   int        the absolute number of days between the two dates.
+     *                       If an error occurs, -1 is returned.
+     * @access   public
+     * @static
+     */
+    public 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.
+     * @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.
+     *
+     * @return   int        0 if the dates are equal. 1 if date 1 is later, -1
+     *                       if date 1 is earlier.
+     * @access   public
+     * @static
+     */
+    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;
+    }
+
+
+    // }}}
+    // {{{ round()
+
+    /**
+     * Rounds the date according to the specified precision
+     *
+     * The precision parameter must be one of the following constants:
+     *
+     *   - {@link DATE_PRECISION_YEAR}
+     *   - {@link DATE_PRECISION_MONTH}
+     *   - {@link DATE_PRECISION_DAY}
+     *   - {@link DATE_PRECISION_HOUR}
+     *   - {@link DATE_PRECISION_10MINUTES}
+     *   - {@link DATE_PRECISION_MINUTE}
+     *   - {@link DATE_PRECISION_10SECONDS}
+     *   - {@link DATE_PRECISION_SECOND}
+     *
+     * The precision can also be specified as an integral offset from
+     * one of these constants, where the offset reflects a precision
+     * of 10 to the power of the offset greater than the constant.
+     * For example:
+     *
+     *   - <b>(DATE_PRECISION_YEAR - 1)</b> rounds the date to the nearest 10
+     *                                      years
+     *   - <b>(DATE_PRECISION_YEAR - 3)</b> rounds the date to the nearest 1000
+     *                                      years
+     *   - <b>(DATE_PRECISION_SECOND + 1)</b> rounds the date to 1 decimal
+     *                                        point of a second
+     *   - <b>(DATE_PRECISION_SECOND + 1)</b> rounds the date to 3 decimal
+     *                                        points of a second
+     *   - <b>(DATE_PRECISION_SECOND + 1)</b> rounds the date to the nearest 10
+     *                                        seconds (thus it is equivalent to
+     *                                        <b>DATE_PRECISION_10SECONDS</b>)
+     *
+     * N.B. This function requires a time in UTC if both the precision is at
+     * least DATE_PRECISION_SECOND and leap seconds are being counted, otherwise
+     * any local time is acceptable.
+     *
+     * @param int $pn_precision a 'DATE_PRECISION_*' constant (defaults to
+     *                             {@link DATE_PRECISION_DAY})
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param mixed $pn_second the second as integer or float
+     * @param bool $pb_countleap whether to count leap seconds (defaults to
+     *                             {@link DATE_COUNT_LEAP_SECONDS})
+     *
+     * @return   array      array of year, month, day, hour, minute, second
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function round(
+        $pn_precision,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour = 0,
+        $pn_minute = 0,
+        $pn_second = 0,
+        $pb_countleap = DATE_COUNT_LEAP_SECONDS
+    )
+    {
+        if ($pn_precision <= DATE_PRECISION_YEAR) {
+            $hn_month = 0;
+            $hn_day = 0;
+            $hn_hour = 0;
+            $hn_minute = 0;
+            $hn_second = 0;
+
+            if ($pn_precision < DATE_PRECISION_YEAR) {
+                $hn_year = round($pn_year, $pn_precision - DATE_PRECISION_YEAR);
+            } else {
+                // Check part-year:
+                //
+                $hn_midyear = (Date_Calc::firstDayOfYear($pn_year + 1) -
+                        Date_Calc::firstDayOfYear($pn_year)) / 2;
+                if (($hn_days = Date_Calc::dayOfYear(
+                        $pn_day,
+                        $pn_month,
+                        $pn_year
+                    )) <=
+                    $hn_midyear - 1) {
+                    $hn_year = $pn_year;
+                } elseif ($hn_days >= $hn_midyear) {
+                    // Round up:
+                    //
+                    $hn_year = $pn_year + 1;
+                } else {
+                    // Take time into account:
+                    //
+                    $hn_partday = Date_Calc::secondsPastMidnight(
+                            $pn_hour,
+                            $pn_minute,
+                            $pn_second
+                        ) /
+                        86400;
+                    if ($hn_partday >= $hn_midyear - $hn_days) {
+                        // Round up:
+                        //
+                        $hn_year = $pn_year + 1;
+                    } else {
+                        $hn_year = $pn_year;
+                    }
+                }
+            }
+        } elseif ($pn_precision == DATE_PRECISION_MONTH) {
+            $hn_year = $pn_year;
+            $hn_day = 0;
+            $hn_hour = 0;
+            $hn_minute = 0;
+            $hn_second = 0;
+
+            $hn_firstofmonth = Date_Calc::firstDayOfMonth($pn_month, $pn_year);
+            $hn_midmonth = (Date_Calc::lastDayOfMonth($pn_month, $pn_year) +
+                    1 -
+                    $hn_firstofmonth) / 2;
+            if (($hn_days = Date_Calc::dateToDays(
+                        $pn_day,
+                        $pn_month,
+                        $pn_year
+                    ) -
+                    $hn_firstofmonth) <= $hn_midmonth - 1) {
+                $hn_month = $pn_month;
+            } elseif ($hn_days >= $hn_midmonth) {
+                // Round up:
+                //
+                list($hn_year, $hn_month) = Date_Calc::nextMonth(
+                    $pn_month,
+                    $pn_year
+                );
+            } else {
+                // Take time into account:
+                //
+                $hn_partday = Date_Calc::secondsPastMidnight(
+                        $pn_hour,
+                        $pn_minute,
+                        $pn_second
+                    ) /
+                    86400;
+                if ($hn_partday >= $hn_midmonth - $hn_days) {
+                    // Round up:
+                    //
+                    list($hn_year, $hn_month) = Date_Calc::nextMonth(
+                        $pn_month,
+                        $pn_year
+                    );
+                } else {
+                    $hn_month = $pn_month;
+                }
+            }
+        } elseif ($pn_precision == DATE_PRECISION_DAY) {
+            $hn_year = $pn_year;
+            $hn_month = $pn_month;
+            $hn_hour = 0;
+            $hn_minute = 0;
+            $hn_second = 0;
+
+            if (Date_Calc::secondsPastMidnight(
+                    $pn_hour,
+                    $pn_minute,
+                    $pn_second
+                ) >= 43200) {
+                // Round up:
+                //
+                list($hn_year, $hn_month, $hn_day) =
+                    explode(" ", Date_Calc::nextDay(
+                        $pn_day,
+                        $pn_month,
+                        $pn_year,
+                        "%Y %m %d"
+                    ));
+            } else {
+                $hn_day = $pn_day;
+            }
+        } elseif ($pn_precision == DATE_PRECISION_HOUR) {
+            $hn_year = $pn_year;
+            $hn_month = $pn_month;
+            $hn_day = $pn_day;
+            $hn_minute = 0;
+            $hn_second = 0;
+
+            if (Date_Calc::secondsPastTheHour($pn_minute, $pn_second) >= 1800) {
+                // Round up:
+                //
+                list($hn_year, $hn_month, $hn_day, $hn_hour) =
+                    Date_Calc::addHours(
+                        1,
+                        $pn_day,
+                        $pn_month,
+                        $pn_year,
+                        $pn_hour
+                    );
+            } else {
+                $hn_hour = $pn_hour;
+            }
+        } elseif ($pn_precision <= DATE_PRECISION_MINUTE) {
+            $hn_year = $pn_year;
+            $hn_month = $pn_month;
+            $hn_day = $pn_day;
+            $hn_hour = $pn_hour;
+            $hn_second = 0;
+
+            if ($pn_precision < DATE_PRECISION_MINUTE) {
+                $hn_minute = round(
+                    $pn_minute,
+                    $pn_precision - DATE_PRECISION_MINUTE
+                );
+            } else {
+                // Check seconds:
+                //
+                if ($pn_second >= 30) {
+                    // Round up:
+                    //
+                    list($hn_year,
+                        $hn_month,
+                        $hn_day,
+                        $hn_hour,
+                        $hn_minute) =
+                        Date_Calc::addMinutes(
+                            1,
+                            $pn_day,
+                            $pn_month,
+                            $pn_year,
+                            $pn_hour,
+                            $pn_minute
+                        );
+                } else {
+                    $hn_minute = $pn_minute;
+                }
+            }
+        } else {
+            // Precision is at least (DATE_PRECISION_SECOND - 1):
+            //
+            $hn_year = $pn_year;
+            $hn_month = $pn_month;
+            $hn_day = $pn_day;
+            $hn_hour = $pn_hour;
+            $hn_minute = $pn_minute;
+
+            $hn_second = round(
+                $pn_second,
+                $pn_precision - DATE_PRECISION_SECOND
+            );
+
+            if (fmod($hn_second, 1) == 0.0) {
+                $hn_second = (int)$hn_second;
+
+                if ($hn_second != intval($pn_second)) {
+                    list($hn_year,
+                        $hn_month,
+                        $hn_day,
+                        $hn_hour,
+                        $hn_minute,
+                        $hn_second) =
+                        Date_Calc::addSeconds(
+                            $hn_second - intval($pn_second),
+                            $pn_day,
+                            $pn_month,
+                            $pn_year,
+                            $pn_hour,
+                            $pn_minute,
+                            intval($pn_second),
+                            $pn_precision >=
+                            DATE_PRECISION_SECOND &&
+                            $pb_countleap
+                        );
+                    //
+                    // (N.B. if rounded to nearest 10 seconds,
+                    // user does not expect seconds to be '60')
+                }
+            }
+        }
+
+        return array((int)$hn_year,
+            (int)$hn_month,
+            (int)$hn_day,
+            (int)$hn_hour,
+            (int)$hn_minute,
+            $hn_second);
+    }
+
+
+    // }}}
+    // {{{ roundSeconds()
+
+    /**
+     * Rounds seconds up or down to the nearest specified unit
+     *
+     * @param int $pn_precision number of digits after the decimal point
+     * @param int $pn_day the day of the month
+     * @param int $pn_month the month
+     * @param int $pn_year the year
+     * @param int $pn_hour the hour
+     * @param int $pn_minute the minute
+     * @param mixed $pn_second the second as integer or float
+     * @param bool $pb_countleap whether to count leap seconds (defaults to
+     *                             DATE_COUNT_LEAP_SECONDS)
+     *
+     * @return   array      array of year, month, day, hour, minute, second
+     * @access   public
+     * @static
+     * @since    Method available since Release 1.5.0
+     */
+    public function roundSeconds(
+        $pn_precision,
+        $pn_day,
+        $pn_month,
+        $pn_year,
+        $pn_hour,
+        $pn_minute,
+        $pn_second,
+        $pb_countleap = DATE_COUNT_LEAP_SECONDS
+    )
+    {
+        return Date_Calc::round(
+            DATE_PRECISION_SECOND + $pn_precision,
+            $pn_day,
+            $pn_month,
+            $pn_year,
+            $pn_hour,
+            $pn_minute,
+            $pn_second
+        );
+    }
+
+
+    // }}}
+    // {{{ isoWeekToDate()
+
+    /**
+     * Converts the Week number and Day-of-Week to Date
+     *
+     * Calculation algorithm taken from
+     * {@link http://www.merlyn.demon.co.uk/weekcalc.htm}.
+     *
+     * @param int $dow day of week from 1 (Monday) to 7 (Sunday)
+     * @param int $week number of week from 1 to 53
+     * @param int $year four digits of year
+     * @param string $format the output format
+     *
+     * @return  string formatted date
+     * @access  public
+     * @static
+     * @since   Method available since Release 1.5.0a2
+     */
+    public function isoWeekToDate($dow, $week, $year, $format = DATE_CALC_FORMAT)
+    {
+        // validates the week number
+        list(, $nweeks) = Date_Calc::isoWeekDate(28, 12, $year);
+        if ($week > $nweeks) {
+            return PEAR::raiseError(
+                "ISO week number for $year cannot be greater than $nweeks",
+                DATE_ERROR_INVALIDDATE
+            );
+        }
+
+        // validates the day of week
+        if ($dow < 1 || $dow > 7) {
+            return PEAR::raiseError(
+                "ISO day of week must be between 1 and 7",
+                DATE_ERROR_INVALIDDATE
+            );
+        }
+
+        // finds the day of week of January 4th.
+        $jan4th = Date_Calc::dayOfWeek(4, 1, $year);
+        if ($jan4th == 0) {
+            $jan4th = 7;
+        }
+
+        // offset to the monday of that week
+        $offset = -($jan4th - 1);
+
+        // increment the days starting from january 4th.
+        $days = Date_Calc::dateToDays(1, 1, $year) + $offset + 7 * ($week - 1) + ($dow - 1) + 3;
+
+        return Date_Calc::daysToDate($days, $format);
+    }
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
diff --git a/extlib/Date/Human.php b/extlib/Date/Human.php
new file mode 100644 (file)
index 0000000..2d21025
--- /dev/null
@@ -0,0 +1,242 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+// {{{ Header
+
+/**
+ * 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
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 1997-2006 Allan Kent
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the BSD License.
+ *
+ * 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.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     Allan Kent <allan@lodestone.co.za>
+ * @copyright  1997-2006 Allan Kent
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @version    CVS: $Id$
+ * @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
+ *
+ * @category  Date and Time
+ * @package   Date
+ * @author    Allan Kent <allan@lodestone.co.za>
+ * @copyright 1997-2005 Allan Kent
+ * @license   http://www.opensource.org/licenses/bsd-license.php
+ *            BSD License
+ * @version   Release: 1.5.0a4
+ * @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.
+     *
+     * 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.
+     *
+     * @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
+     *
+     * @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
+     *               )
+     * @access   public
+     * @static
+     */
+    public 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
+     *
+     * @return   int unix timestamp of date
+     * @access   public
+     * @static
+     */
+    public 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:
+ */
diff --git a/extlib/Date/Span.php b/extlib/Date/Span.php
new file mode 100644 (file)
index 0000000..14eaee8
--- /dev/null
@@ -0,0 +1,1181 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+// {{{ Header
+
+/**
+ * Generic time span handling class for PEAR
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 1997-2005 Leandro Lucarella, Pierre-Alain Joye
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the BSD License.
+ *
+ * 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.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     Leandro Lucarella <llucax@php.net>
+ * @author     Pierre-Alain Joye <pajoye@php.net>
+ * @copyright  1997-2006 Leandro Lucarella, Pierre-Alain Joye
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @version    CVS: $Id$
+ * @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:
+ *
+ *  <b>days</b><sep><b>hours</b><sep><b>minutes</b><sep><b>seconds</b>
+ *
+ * Where '<sep>' is any quantity of non numeric chars. If no values are
+ * given, time span is set to zero, if one value is given, it is used for
+ * hours, if two values are given it's used for hours and minutes and if
+ * three values are given, it is used for hours, minutes and seconds.
+ *
+ * Examples:
+ *
+ *  - <b>""</b>                   -> 0, 0, 0, 0 (days, hours, minutes, seconds)
+ *  - <b>"12"</b>                 -> 0, 12, 0, 0
+ *  - <b>"12.30"</b>              -> 0, 12, 30, 0
+ *  - <b>"12:30:18"</b>           -> 0, 12, 30, 18
+ *  - <b>"3-12-30-18"</b>         -> 3, 12, 30, 18
+ *  - <b>"3 days, 12-30-18"</b>   -> 3, 12, 30, 18
+ *  - <b>"12:30 with 18 secs"</b> -> 0, 12, 30, 18
+ *
+ * @see      Date_Span::setFromString()
+ */
+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
+ *
+ * @category  Date and Time
+ * @package   Date
+ * @author    Leandro Lucarella <llucax@php.net>
+ * @author    Pierre-Alain Joye <pajoye@php.net>
+ * @copyright 1997-2006 Leandro Lucarella, Pierre-Alain Joye
+ * @license   http://www.opensource.org/licenses/bsd-license.php
+ *            BSD License
+ * @version   Release: 1.5.0a1
+ * @link      http://pear.php.net/package/Date
+ * @since     Class available since Release 1.4
+ */
+class Date_Span
+{
+
+    // {{{ Properties
+
+    /**
+     * The no of days
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $day;
+
+    /**
+     * The no of hours (0 to 23)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $hour;
+
+    /**
+     * The no of minutes (0 to 59)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $minute;
+
+    /**
+     * The no of seconds (0 to 59)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $second;
+
+
+    // }}}
+    // {{{ Constructor
+
+    /**
+     * Constructor
+     *
+     * Creates the time span object calling {@link Date_Span::set()}
+     *
+     * @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
+     *
+     * @access   public
+     * @see      set()
+     */
+    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
+     * @access   public
+     * @see      Date_Span::copy(), Date_Span::setFromArray(),
+     *            Date_Span::setFromString(), Date_Span::setFromSeconds(),
+     *            Date_Span::setFromDateDiff()
+     */
+    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) || is_string($format)) {
+            return $this->setFromString((string)$time, $format);
+        } elseif (is_int($time)) {
+            return $this->setFromSeconds($time);
+        } else {
+            return $this->setFromSeconds(0);
+        }
+    }
+
+
+    // }}}
+    // {{{ setFromArray()
+
+    /**
+     * Set the time span from an array
+     *
+     * Any value can be a float (but it has no sense in seconds), for example:
+     *
+     *  <code>$object->setFromArray(array(23.5, 20, 0));</code>
+     *
+     * is interpreted as 23 hours, 0.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
+     * @see      Date_Span::set()
+     */
+    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()
+
+    /**
+     * Sets the time span from a string, based on an input format
+     *
+     * This is some like a mix of the PHP functions
+     * {@link http://www.php.net/strftime strftime()} and
+     * {@link http://www.php.net/sscanf sscanf()}.
+     * The error checking and validation of this function is very primitive,
+     * so you should be careful when using it with unknown 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:
+     *
+     *   <code>$object->setFromString('10, 20', '%H, %h');</code>
+     *
+     * your time span would be 20 hours long.  Always remember that this
+     * method sets all the values, so if you had a span object 30
+     * minutes long and you call:
+     *
+     *   <code>$object->setFromString('20 hours', '%H hours');</code>
+     *
+     * the span object would be 20 hours long (and not 20 hours and 30
+     * minutes).
+     *
+     * Input format options:
+     *
+     *  - <b>%C</b> - Days with time, equivalent to '<b>D, %H:%M:%S</b>'
+     *  - <b>%d</b> - Total days as a float number
+     *                  (2 days, 12 hours = 2.5 days)
+     *  - <b>%D</b> - Days as a decimal number
+     *  - <b>%e</b> - Total hours as a float number
+     *                  (1 day, 2 hours, 30 minutes = 26.5 hours)
+     *  - <b>%f</b> - Total minutes as a float number
+     *                  (2 minutes, 30 seconds = 2.5 minutes)
+     *  - <b>%g</b> - Total seconds as a decimal number
+     *                  (2 minutes, 30 seconds = 90 seconds)
+     *  - <b>%h</b> - Hours as decimal number
+     *  - <b>%H</b> - Hours as decimal number limited to 2 digits
+     *  - <b>%m</b> - Minutes as a decimal number
+     *  - <b>%M</b> - Minutes as a decimal number limited to 2 digits
+     *  - <b>%n</b> - Newline character (\n)
+     *  - <b>%p</b> - 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.
+     *  - <b>%r</b> - Time in am/pm notation, equivalent to '<b>H:%M:%S %p</b>'
+     *  - <b>%R</b> - Time in 24-hour notation, equivalent to '<b>H:%M</b>'
+     *  - <b>%s</b> - Seconds as a decimal number
+     *  - <b>%S</b> - Seconds as a decimal number limited to 2 digits
+     *  - <b>%t</b> - Tab character (\t)
+     *  - <b>%T</b> - Current time equivalent, equivalent to '<b>H:%M:%S</b>'
+     *  - <b>%%</b> - 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
+     * @see      Date_Span::set(), DATE_SPAN_INPUT_FORMAT_NNSV
+     */
+    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));
+        } elseif (is_integer($format)) {
+            // If format is a integer, it uses a predefined format
+            // detection method.
+            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
+     * @see      Date_Span::set(), Date_Span::setFromDays(),
+     *            Date_Span::setFromHours(), Date_Span::setFromMinutes()
+     */
+    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()
+
+    /**
+     * Sets the time span from a total number of minutes
+     *
+     * @param float $minutes total number of minutes
+     *
+     * @return   bool       true on success
+     * @access   public
+     * @see      Date_Span::set(), Date_Span::setFromDays(),
+     *            Date_Span::setFromHours(), Date_Span::setFromSeconds()
+     */
+    public function setFromMinutes($minutes)
+    {
+        return $this->setFromSeconds(round($minutes * 60));
+    }
+
+
+    // }}}
+    // {{{ setFromHours()
+
+    /**
+     * Sets the time span from a total number of hours
+     *
+     * @param float $hours total number of hours
+     *
+     * @return   bool       true on success
+     * @access   public
+     * @see      Date_Span::set(), Date_Span::setFromDays(),
+     *            Date_Span::setFromHours(), Date_Span::setFromMinutes()
+     */
+    public function setFromHours($hours)
+    {
+        return $this->setFromSeconds(round($hours * 3600));
+    }
+
+
+    // }}}
+    // {{{ setFromDays()
+
+    /**
+     * Sets the time span from a total number of days
+     *
+     * @param float $days total number of days
+     *
+     * @return   bool       true on success
+     * @access   public
+     * @see      Date_Span::set(), Date_Span::setFromHours(),
+     *            Date_Span::setFromMinutes(), Date_Span::setFromSeconds()
+     */
+    public function setFromDays($days)
+    {
+        return $this->setFromSeconds(round($days * 86400));
+    }
+
+
+    // }}}
+    // {{{ setFromDateDiff()
+
+    /**
+     * Sets the span from the elapsed time between two dates
+     *
+     * The time span is unsigned, so the date's order is not important.
+     *
+     * @param object $date1 first Date
+     * @param object $date2 second Date
+     *
+     * @return   bool       true on success
+     * @access   public
+     * @see      Date_Span::set()
+     */
+    public function setFromDateDiff($date1, $date2)
+    {
+        if (!is_a($date1, 'date') or !is_a($date2, 'date')) {
+            return false;
+        }
+
+        // create a local copy of instance, in order avoid changes the object
+        // reference when its object has converted to UTC due PHP5 is always
+        // passed the object by reference.
+        $tdate1 = new Date($date1);
+        $tdate2 = new Date($date2);
+
+        // convert to UTC
+        $tdate1->toUTC();
+        $tdate2->toUTC();
+
+        if ($tdate1->after($tdate2)) {
+            list($tdate1, $tdate2) = array($tdate2, $tdate1);
+        }
+
+        $days = Date_Calc::dateDiff(
+            $tdate1->getDay(),
+            $tdate1->getMonth(),
+            $tdate1->getYear(),
+            $tdate2->getDay(),
+            $tdate2->getMonth(),
+            $tdate2->getYear()
+        );
+
+        $hours = $tdate2->getHour() - $tdate1->getHour();
+        $mins = $tdate2->getMinute() - $tdate1->getMinute();
+        $secs = $tdate2->getSecond() - $tdate1->getSecond();
+
+        $this->setFromSeconds($days * 86400 +
+            $hours * 3600 +
+            $mins * 60 + $secs);
+        return true;
+    }
+
+    // }}}
+    // {{{ copy()
+
+    /**
+     * Sets the time span from another time object
+     *
+     * @param object $time source time span object
+     *
+     * @return   bool       true on success
+     * @access   public
+     */
+    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()
+
+    /**
+     * Formats time span according to specified code (similar to
+     * {@link Date::formatLikeStrftime()})
+     *
+     * Uses a code based on {@link http://www.php.net/strftime strftime()}.
+     *
+     * Formatting options:
+     *
+     *  - <b>%C</b> - Days with time, equivalent to '<b>%D, %H:%M:%S</b>'
+     *  - <b>%d</b> - Total days as a float number
+     *                  (2 days, 12 hours = 2.5 days)
+     *  - <b>%D</b> - Days as a decimal number
+     *  - <b>%e</b> - Total hours as a float number
+     *                  (1 day, 2 hours, 30 minutes = 26.5 hours)
+     *  - <b>%E</b> - Total hours as a decimal number
+     *                  (1 day, 2 hours, 40 minutes = 26 hours)
+     *  - <b>%f</b> - Total minutes as a float number
+     *                  (2 minutes, 30 seconds = 2.5 minutes)
+     *  - <b>%F</b> - Total minutes as a decimal number
+     *                  (1 hour, 2 minutes, 40 seconds = 62 minutes)
+     *  - <b>%g</b> - Total seconds as a decimal number
+     *                  (2 minutes, 30 seconds = 90 seconds)
+     *  - <b>%h</b> - Hours as decimal number (0 to 23)
+     *  - <b>%H</b> - Hours as decimal number (00 to 23)
+     *  - <b>%i</b> - Hours as decimal number on 12-hour clock
+     *                  (1 to 12)
+     *  - <b>%I</b> - Hours as decimal number on 12-hour clock
+     *                  (01 to 12)
+     *  - <b>%m</b> - Minutes as a decimal number (0 to 59)
+     *  - <b>%M</b> - Minutes as a decimal number (00 to 59)
+     *  - <b>%n</b> - Newline character (\n)
+     *  - <b>%p</b> - Either 'am' or 'pm' depending on the time
+     *  - <b>%P</b> - Either 'AM' or 'PM' depending on the time
+     *  - <b>%r</b> - Time in am/pm notation, equivalent to '<b>%I:%M:%S %p</b>'
+     *  - <b>%R</b> - Time in 24-hour notation, equivalent to '<b>%H:%M</b>'
+     *  - <b>%s</b> - Seconds as a decimal number (0 to 59)
+     *  - <b>%S</b> - Seconds as a decimal number (00 to 59)
+     *  - <b>%t</b> - Tab character (\t)
+     *  - <b>%T</b> - Current time equivalent, equivalent to '<b>%H:%M:%S</b>'
+     *  - <b>%%</b> - Literal '%'
+     *
+     * @param string $format the format string for returned time span
+     *
+     * @return   string     the time span in specified format
+     * @access   public
+     */
+    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':
+                    case 'I':
+                        $hour = $this->hour + 1 > 12 ?
+                            $this->hour - 12 :
+                            $this->hour;
+                        $output .= $hour == 0 ?
+                            12 :
+                            ($nextchar == "i" ?
+                                $hour :
+                                sprintf('%02d', $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()
+
+    /**
+     * Converts time span to seconds
+     *
+     * @return   int        time span as an integer number of seconds
+     * @access   public
+     * @see      Date_Span::toDays(), Date_Span::toHours(),
+     *            Date_Span::toMinutes()
+     */
+    public function toSeconds()
+    {
+        return $this->day * 86400 + $this->hour * 3600 +
+            $this->minute * 60 + $this->second;
+    }
+
+
+    // }}}
+    // {{{ toMinutes()
+
+    /**
+     * Converts time span to minutes
+     *
+     * @return   float      time span as a decimal number of minutes
+     * @access   public
+     * @see      Date_Span::toDays(), Date_Span::toHours(),
+     *            Date_Span::toSeconds()
+     */
+    public function toMinutes()
+    {
+        return $this->day * 1440 + $this->hour * 60 + $this->minute +
+            $this->second / 60;
+    }
+
+
+    // }}}
+    // {{{ toHours()
+
+    /**
+     * Converts time span to hours
+     *
+     * @return   float      time span as a decimal number of hours
+     * @access   public
+     * @see      Date_Span::toDays(), Date_Span::toMinutes(),
+     *            Date_Span::toSeconds()
+     */
+    public function toHours()
+    {
+        return $this->day * 24 + $this->hour + $this->minute / 60 +
+            $this->second / 3600;
+    }
+
+
+    // }}}
+    // {{{ toDays()
+
+    /**
+     * Converts time span to days
+     *
+     * @return   float      time span as a decimal number of days
+     * @access   public
+     * @see      Date_Span::toHours(), Date_Span::toMinutes(),
+     *            Date_Span::toSeconds()
+     */
+    public function toDays()
+    {
+        return $this->day + $this->hour / 24 + $this->minute / 1440 +
+            $this->second / 86400;
+    }
+
+
+    // }}}
+    // {{{ add()
+
+    /**
+     * Adds a time span
+     *
+     * @param object $time time span to add
+     *
+     * @return   void
+     * @access   public
+     * @see      Date_Span::subtract()
+     */
+    public function add($time)
+    {
+        return $this->setFromSeconds($this->toSeconds() +
+            $time->toSeconds());
+    }
+
+
+    // }}}
+    // {{{ subtract()
+
+    /**
+     * 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 $time time span to subtract
+     *
+     * @return   void
+     * @access   public
+     * @see      Date_Span::add()
+     */
+    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 $time time span to compare to
+     *
+     * @return   bool       true if the time spans are equal
+     * @access   public
+     * @see      Date_Span::greater(), Date_Span::greaterEqual()
+     *            Date_Span::lower(), Date_Span::lowerEqual()
+     */
+    public function equal($time)
+    {
+        return $this->toSeconds() == $time->toSeconds();
+    }
+
+
+    // }}}
+    // {{{ greaterEqual()
+
+    /**
+     * Tells if this time span is greater or equal than $time
+     *
+     * @param object $time time span to compare to
+     *
+     * @return   bool       true if this time span is greater or equal than $time
+     * @access   public
+     * @see      Date_Span::greater(), Date_Span::lower(),
+     *            Date_Span::lowerEqual(), Date_Span::equal()
+     */
+    public function greaterEqual($time)
+    {
+        return $this->toSeconds() >= $time->toSeconds();
+    }
+
+
+    // }}}
+    // {{{ lowerEqual()
+
+    /**
+     * Tells if this time span is lower or equal than $time
+     *
+     * @param object $time time span to compare to
+     *
+     * @return   bool       true if this time span is lower or equal than $time
+     * @access   public
+     * @see      Date_Span::lower(), Date_Span::greater(),
+     *            Date_Span::greaterEqual(), Date_Span::equal()
+     */
+    public function lowerEqual($time)
+    {
+        return $this->toSeconds() <= $time->toSeconds();
+    }
+
+
+    // }}}
+    // {{{ greater()
+
+    /**
+     * Tells if this time span is greater than $time
+     *
+     * @param object $time time span to compare to
+     *
+     * @return   bool       true if this time span is greater than $time
+     * @access   public
+     * @see      Date_Span::greaterEqual(), Date_Span::lower(),
+     *            Date_Span::lowerEqual(), Date_Span::equal()
+     */
+    public function greater($time)
+    {
+        return $this->toSeconds() > $time->toSeconds();
+    }
+
+
+    // }}}
+    // {{{ lower()
+
+    /**
+     * Tells if this time span is lower than $time
+     *
+     * @param object $time time span to compare to
+     *
+     * @return   bool       true if this time span is lower than $time
+     * @access   public
+     * @see      Date_Span::lowerEqual(), Date_Span::greater(),
+     *            Date_Span::greaterEqual(), Date_Span::equal()
+     */
+    public function lower($time)
+    {
+        return $this->toSeconds() < $time->toSeconds();
+    }
+
+
+    // }}}
+    // {{{ compare()
+
+    /**
+     * Compares two time spans
+     *
+     * Suitable for use in sorting functions.
+     *
+     * @param object $time1 the first time span
+     * @param object $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
+     * @access   public
+     * @static
+     */
+    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 if empty
+     * @access   public
+     */
+    public function isEmpty()
+    {
+        return !$this->day && !$this->hour && !$this->minute && !$this->second;
+    }
+
+
+    // }}}
+    // {{{ setDefaultInputFormat()
+
+    /**
+     * Sets the default input format
+     *
+     * @param mixed $format new default input format
+     *
+     * @return   mixed      previous default input format
+     * @access   public
+     * @static
+     * @see      Date_Span::getDefaultInputFormat(), Date_Span::setDefaultFormat()
+     */
+    public function setDefaultInputFormat($format)
+    {
+        $old = $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
+        $GLOBALS['_DATE_SPAN_INPUT_FORMAT'] = $format;
+        return $old;
+    }
+
+
+    // }}}
+    // {{{ getDefaultInputFormat()
+
+    /**
+     * Returns the default input format
+     *
+     * @return   mixed      default input format
+     * @access   public
+     * @static
+     * @see      Date_Span::setDefaultInputFormat(), Date_Span::getDefaultFormat()
+     */
+    public function getDefaultInputFormat()
+    {
+        return $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
+    }
+
+
+    // }}}
+    // {{{ setDefaultFormat()
+
+    /**
+     * Sets the default format
+     *
+     * @param mixed $format new default format
+     *
+     * @return   mixed      previous default format
+     * @access   public
+     * @static
+     * @see      Date_Span::getDefaultFormat(), Date_Span::setDefaultInputFormat()
+     */
+    public function setDefaultFormat($format)
+    {
+        $old = $GLOBALS['_DATE_SPAN_FORMAT'];
+        $GLOBALS['_DATE_SPAN_FORMAT'] = $format;
+        return $old;
+    }
+
+
+    // }}}
+    // {{{ getDefaultFormat()
+
+    /**
+     * Returns the default format
+     *
+     * @return   mixed      default format
+     * @access   public
+     * @static
+     * @see      Date_Span::setDefaultFormat(), Date_Span::getDefaultInputFormat()
+     */
+    public function getDefaultFormat()
+    {
+        return $GLOBALS['_DATE_SPAN_FORMAT'];
+    }
+
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
diff --git a/extlib/Date/TimeZone.php b/extlib/Date/TimeZone.php
new file mode 100644 (file)
index 0000000..9ec339a
--- /dev/null
@@ -0,0 +1,7402 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+
+// {{{ Header
+
+/**
+ * TimeZone representation class, along with time zone information data
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 1997-2007 Baba Buehler, Pierre-Alain Joye, C.A. Woodcock
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the BSD License.
+ *
+ * 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.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     Baba Buehler <baba@babaz.com>
+ * @author     Pierre-Alain Joye <pajoye@php.net>
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  1997-2007 Baba Buehler, Pierre-Alain Joye, C.A. Woodcock
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @version    CVS: $Id$
+ * @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
+ * {@link Date_TimeZone::setDefault()}.
+ *
+ * This class includes time zone data (from zoneinfo) in the form of a
+ * global array, $_DATE_TIMEZONE_DATA.
+ *
+ * @category  Date and Time
+ * @package   Date
+ * @author    Baba Buehler <baba@babaz.com>
+ * @author    C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, C.A. Woodcock
+ * @license   http://www.opensource.org/licenses/bsd-license.php
+ *            BSD License
+ * @version   Release: 1.5.0a1
+ * @link      http://pear.php.net/package/Date
+ */
+class Date_TimeZone
+{
+
+    // {{{ Properties
+
+    /**
+     * Unique time Zone ID of this time zone
+     *
+     * @var      string
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $id;
+
+    /**
+     * Offset, in milliseconds, of this timezone
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $offset;
+
+    /**
+     * Short name of this time zone (e.g. "CST")
+     *
+     * @var      string
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $shortname;
+
+    /**
+     * DST short name of this timezone (e.g. 'BST')
+     *
+     * @var      string
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $dstshortname;
+
+    /**
+     * Long name of this time zone (e.g. "Central Standard Time")
+     *
+     * N.B. this is not necessarily unique
+     *
+     * @since    1.0
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $longname;
+
+    /**
+     * DST long name of this time zone (e.g. 'British Summer Time')
+     *
+     * @var      string
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $dstlongname;
+
+    /**
+     * Whether this time zone observes daylight savings time
+     *
+     * @var      bool
+     * @access   private
+     * @since    Property available since Release 1.0
+     */
+    public $hasdst;
+
+    /**
+     * Additional offset of Summer time from the standard time of the
+     * time zone in milli-seconds
+     *
+     * The value is usually 3600000, i.e. one hour, and always positive
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_summertimeoffset;
+
+    /**
+     * Month no (1-12) in which Summer time starts (the clocks go forward)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_summertimestartmonth;
+
+    /**
+     * Definition of when Summer time starts in the specified month
+     *
+     * Can take one of the following forms:
+     *
+     *  5        the fifth of the month
+     *  lastSun  the last Sunday in the month
+     *  lastMon  the last Monday in the month
+     *  Sun>=8   first Sunday on or after the 8th
+     *  Sun<=25  last Sunday on or before the 25th
+     *
+     * @var      string
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $os_summertimestartday;
+
+    /**
+     * Time in milli-seconds relative to midnight UTC when
+     * Summer time starts (the clocks go forward)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_summertimestarttime;
+
+    /**
+     * Month no (1-12) in which Summer time ends (the clocks go back)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_summertimeendmonth;
+
+    /**
+     * Definition of when Summer time ends in the specified month
+     *
+     * @var      string
+     * @access   private
+     * @see      Date_TimeZone::$os_summertimestartday
+     * @since    Property available since Release 1.5.0
+     */
+    public $os_summertimeendday;
+
+    /**
+     * Time in milli-seconds relative to midnight UTC when
+     * Summer time ends (the clocks go back)
+     *
+     * @var      int
+     * @access   private
+     * @since    Property available since Release 1.5.0
+     */
+    public $on_summertimeendtime;
+
+
+    // }}}
+    // {{{ Constructor
+
+    /**
+     * Constructor
+     *
+     * If the supplied ID is invalid, the created time zone is "UTC".
+     *
+     * A note about time zones of the form 'Etc/*' (quoted from the public
+     * domain 'tz' data-base (see {@link ftp://elsie.nci.nih.gov/pub/}
+     * [file 'etcetera']):
+     *
+     *  These entries are mostly present for historical reasons, so that
+     *  people in areas not otherwise covered by the tz files could use
+     *  a time zone that was right for their area.  These days, the
+     *  tz files cover almost all the inhabited world, and the only practical
+     *  need now for the entries that are not on UTC are for ships at sea
+     *  that cannot use POSIX TZ settings.
+     *
+     *  - <b>Etc/GMT</b>  (GMT)
+     *  - <b>Etc/UTC</b>  (UTC)
+     *  - <b>Etc/UCT</b>  (UCT)
+     *
+     *  The following link uses older naming conventions, but it belongs here.
+     *  We want this to work even on installations that omit the other older
+     *  names.
+     *
+     *  - <b>Etc/GMT</b>  (equivalent to GMT)
+     *
+     *  - <b>Etc/UTC</b>  (equivalent to Etc/Universal)
+     *  - <b>Etc/UTC</b>  (equivalent to Etc/Zulu)
+     *
+     *  - <b>Etc/GMT</b>  (equivalent to Etc/Greenwich)
+     *  - <b>Etc/GMT</b>  (equivalent to Etc/GMT-0)
+     *  - <b>Etc/GMT</b>  (equivalent to Etc/GMT+0)
+     *  - <b>Etc/GMT</b>  (equivalent to Etc/GMT0)
+     *
+     *  We use POSIX-style signs in the Zone names and the output abbreviations,
+     *  even though this is the opposite of what many people expect.
+     *  POSIX has positive signs west of Greenwich, but many people expect
+     *  positive signs east of Greenwich.  For example, TZ='Etc/GMT+4' uses
+     *  the abbreviation "GMT+4" and corresponds to 4 hours behind UTC
+     *  (i.e. west of Greenwich) even though many people would expect it to
+     *  mean 4 hours ahead of UTC (i.e. east of Greenwich).
+     *
+     *  In the draft 5 of POSIX 1003.1-200x, the angle bracket notation
+     *  (which is not yet supported by the tz code) allows for
+     *  TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
+     *  ISO 8601 you can use TZ='<-0400>+4'.  Thus the commonly-expected
+     *  offset is kept within the angle bracket (and is used for display)
+     *  while the POSIX sign is kept outside the angle bracket (and is used
+     *  for calculation).
+     *
+     *  Do not use a TZ setting like TZ='GMT+4', which is four hours behind
+     *  GMT but uses the completely misleading abbreviation "GMT".
+     *
+     *  Earlier incarnations of this package were not POSIX-compliant, and
+     *  we did not want things to change quietly if someone accustomed to the
+     *  old way uses the codes from previous versions so we moved the names
+     *  into the Etc subdirectory.
+     *
+     *  - <b>Etc/GMT-14</b>  (14 hours ahead of Greenwich)
+     *  - <b>Etc/GMT-13</b>  (13)
+     *  - <b>Etc/GMT-12</b>  (12)
+     *  - <b>Etc/GMT-11</b>  (11)
+     *  - <b>Etc/GMT-10</b>  (10)
+     *  - <b>Etc/GMT-9</b>   (9)
+     *  - <b>Etc/GMT-8</b>   (8)
+     *  - <b>Etc/GMT-7</b>   (7)
+     *  - <b>Etc/GMT-6</b>   (6)
+     *  - <b>Etc/GMT-5</b>   (5)
+     *  - <b>Etc/GMT-4</b>   (4)
+     *  - <b>Etc/GMT-3</b>   (3)
+     *  - <b>Etc/GMT-2</b>   (2)
+     *  - <b>Etc/GMT-1</b>   (1)
+     *  - <b>Etc/GMT+1</b>   (1 hour behind Greenwich)
+     *  - <b>Etc/GMT+2</b>   (2)
+     *  - <b>Etc/GMT+3</b>   (3)
+     *  - <b>Etc/GMT+4</b>   (4)
+     *  - <b>Etc/GMT+5</b>   (5)
+     *  - <b>Etc/GMT+6</b>   (6)
+     *  - <b>Etc/GMT+7</b>   (7)
+     *  - <b>Etc/GMT+8</b>   (8)
+     *  - <b>Etc/GMT+9</b>   (9)
+     *  - <b>Etc/GMT+10</b>  (10)
+     *  - <b>Etc/GMT+11</b>  (11)
+     *  - <b>Etc/GMT+12</b>  (12)
+     *
+     * @param string $ps_id the time zone ID
+     *
+     * @return   void
+     * @access   public
+     * @see      Date::setTZ(), Date::setTZByID(), Date_TimeZone::isValidID()
+     */
+    public function Date_TimeZone($ps_id)
+    {
+        $_DATE_TIMEZONE_DATA =& $GLOBALS['_DATE_TIMEZONE_DATA'];
+
+        if (isset($GLOBALS['_DATE_TIMEZONE_DATA'][$ps_id])) {
+            $this->id = $ps_id;
+
+            $this->shortname = $_DATE_TIMEZONE_DATA[$ps_id]['shortname'];
+            $this->longname = $_DATE_TIMEZONE_DATA[$ps_id]['longname'];
+            $this->offset = $_DATE_TIMEZONE_DATA[$ps_id]['offset'];
+            $this->dstshortname =
+                array_key_exists(
+                    "dstshortname",
+                    $_DATE_TIMEZONE_DATA[$ps_id]
+                ) ?
+                    $_DATE_TIMEZONE_DATA[$ps_id]['dstshortname'] :
+                    null;
+            if ($this->hasdst = !is_null($this->dstshortname)) {
+                $this->dstlongname =
+                    array_key_exists(
+                        "dstlongname",
+                        $_DATE_TIMEZONE_DATA[$ps_id]
+                    ) ?
+                        $_DATE_TIMEZONE_DATA[$ps_id]['dstlongname'] :
+                        null;
+                if (isset($_DATE_TIMEZONE_DATA[$ps_id]["summertimeoffset"])) {
+                    $this->on_summertimeoffset = $_DATE_TIMEZONE_DATA[$ps_id]["summertimeoffset"];
+                    $this->on_summertimestartmonth = $_DATE_TIMEZONE_DATA[$ps_id]["summertimestartmonth"];
+                    $this->os_summertimestartday = $_DATE_TIMEZONE_DATA[$ps_id]["summertimestartday"];
+                    $this->on_summertimestarttime = $_DATE_TIMEZONE_DATA[$ps_id]["summertimestarttime"];
+                    $this->on_summertimeendmonth = $_DATE_TIMEZONE_DATA[$ps_id]["summertimeendmonth"];
+                    $this->os_summertimeendday = $_DATE_TIMEZONE_DATA[$ps_id]["summertimeendday"];
+                    $this->on_summertimeendtime = $_DATE_TIMEZONE_DATA[$ps_id]["summertimeendtime"];
+                } else {
+                    $this->on_summertimeoffset = null;
+                }
+            }
+        } else {
+            $this->hasdst = false;
+
+            if (preg_match(
+                '/^UTC([+\-])([0-9]{2,2}):?([0-5][0-9])$/',
+                $ps_id,
+                $ha_matches
+            )) {
+                $this->id = $ps_id;
+                $this->offset = ($ha_matches[1] .
+                        ($ha_matches[2] * 3600 +
+                            $ha_matches[3] * 60)) * 1000;
+
+                if (!($hb_isutc = $this->offset == 0)) {
+                    $this->id = $ps_id;
+                    $this->shortname = "UTC" .
+                        $ha_matches[1] .
+                        ($ha_matches[3] == "00" ?
+                            ltrim($ha_matches[2], "0") :
+                            $ha_matches[2] . $ha_matches[3]);
+                    $this->longname = "UTC" .
+                        $ha_matches[1] .
+                        $ha_matches[2] .
+                        ":" .
+                        $ha_matches[3];
+                }
+            } elseif (preg_match(
+                '/^UTC([+\-])([0-9]{1,2})$/',
+                $ps_id,
+                $ha_matches
+            )) {
+                $this->id = $ps_id;
+                $this->offset = ($ha_matches[1] .
+                        ($ha_matches[2] * 3600)) * 1000;
+
+                if (!($hb_isutc = $this->offset == 0)) {
+                    $this->shortname = "UTC" .
+                        $ha_matches[1] .
+                        ltrim($ha_matches[2], "0");
+                    $this->longname = "UTC" .
+                        $ha_matches[1] .
+                        sprintf("%02d", $ha_matches[2]) .
+                        ":00";
+                }
+            } else {
+                $this->id = "UTC";
+                $hb_isutc = true;
+            }
+
+            if ($hb_isutc) {
+                $this->shortname = $_DATE_TIMEZONE_DATA["UTC"]['shortname'];
+                $this->longname = $_DATE_TIMEZONE_DATA["UTC"]['longname'];
+                $this->offset = $_DATE_TIMEZONE_DATA["UTC"]['offset'];
+            }
+        }
+    }
+
+
+    // }}}
+    // {{{ getDefault()
+
+    /**
+     * Returns a TimeZone object representing the system default time zone
+     *
+     * The system default time zone is initialized during the loading of
+     * this file.
+     *
+     * @return   object     Date_TimeZone object of the default time zone
+     * @access   public
+     */
+    public function getDefault()
+    {
+        return new Date_TimeZone($GLOBALS['_DATE_TIMEZONE_DEFAULT']);
+    }
+
+
+    // }}}
+    // {{{ setDefault()
+
+    /**
+     * Sets the system default time zone to the time zone in $id
+     *
+     * @param string $id the time zone id to use
+     *
+     * @return   void
+     * @access   public
+     */
+    public function setDefault($id)
+    {
+        if (Date_TimeZone::isValidID($id)) {
+            $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = $id;
+        } else {
+            return PEAR::raiseError("Invalid time zone ID '$id'");
+        }
+    }
+
+
+    // }}}
+    // {{{ isValidID()
+
+    /**
+     * Tests if given time zone ID (e.g. 'London/Europe') is valid and unique
+     *
+     * Checks if given ID is either represented in the $_DATE_TIMEZONE_DATA
+     * time zone data, or is a UTC offset in one of the following forms,
+     * i.e. an offset with no geographical or political base:
+     *
+     *  - <b>UTC[+/-][hh]:[mm]</b> - e.g. UTC+03:00
+     *  - <b>UTC[+/-][hh][mm]</b>  - e.g. UTC-0530
+     *  - <b>UTC[+/-][hh]</b>      - e.g. UTC+03
+     *  - <b>UTC[+/-][h]</b>       - e.g. UTC-1
+     *
+     * (the last is not an ISO 8601 standard but is the preferred form)
+     *
+     * N.B. these are not sanctioned by any ISO standard, but the form of
+     * the offset itself, i.e. the part after the characters 'UTC', is the
+     * ISO 8601 standard form for representing this part.
+     *
+     * The form '<b>[+/-][h]</b>' is not ISO conformant, but ISO 8601 only
+     * defines the form of the time zone offset of a particular time, that
+     * is, it actually defines the form '<b><time>UTC[+/-][hh]</b>', and
+     * its purview does not apparently cover the name of the time zone
+     * itself. For this there is no official international standard (or
+     * even a non- international standard).  The closest thing to a
+     * sanctioning body is the 'tz' database
+     * ({@link http://www.twinsun.com/tz/tz-link.htm})
+     * which is run by volunteers but which is heavily relied upon by
+     * various programming languages and the internet community.  However
+     * they mainly define geographical/political time zone names of the
+     * form 'London/Europe' because their main aim is to collate the time
+     * zone definitions which are set by individual countries/states, not
+     * to prescribe any standard.
+     *
+     * However it seems that the de facto standard to describe time zones
+     * as non-geographically/politically-based areas where the local time
+     * on all clocks reads the same seems to be the form '<b>UTC[+/-][h]</b>'
+     * for integral numbers of hours, and '<b>UTC[+/-][hh]:[mm]</b>'
+     * otherwise.
+     * (See {@link http://en.wikipedia.org/wiki/List_of_time_zones})
+     *
+     * N.B. 'GMT' is also commonly used instead of 'UTC', but 'UTC' seems
+     * to be technically preferred.  GMT-based IDs still exist in the 'tz
+     * data-base', but beware of POSIX-style offsets which are the opposite
+     * way round to what people normally expect.
+     *
+     * @param string $ps_id the time zone ID to test
+     *
+     * @return   bool       true if the supplied ID is valid
+     * @access   public
+     * @see      Date::setTZByID(), Date_TimeZone::Date_TimeZone()
+     */
+    public function isValidID($ps_id)
+    {
+        if (isset($GLOBALS['_DATE_TIMEZONE_DATA'][$ps_id])) {
+            return true;
+        } elseif (preg_match(
+            '/^UTC[+\-]([0-9]{2,2}:?[0-5][0-9]|[0-9]{1,2})$/',
+            $ps_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.
+     *
+     * @param object $tz the Date_TimeZone object to test
+     *
+     * @return   bool       true if this time zone is equal to the supplied
+     *                       time zone
+     * @access   public
+     * @see      Date_TimeZone::isEquivalent()
+     */
+    public 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 consists in the two time zones having:
+     *
+     *  - an equal offset from UTC in both standard and Summer time (if
+     *              the time zones observe Summer time)
+     *  - the same Summer time start and end rules, that is, the two time
+     *              zones must switch from standard time to Summer time,
+     *              and vice versa, on the same day and at the same time
+     *
+     * @param object $pm_tz the Date_TimeZone object to test, or a valid time
+     *                       zone ID
+     *
+     * @return   bool       true if this time zone is equivalent to the supplied
+     *                       time zone
+     * @access   public
+     * @see      Date_TimeZone::isEqual(), Date::inEquivalentTimeZones()
+     */
+    public function isEquivalent($pm_tz)
+    {
+        if (is_a($pm_tz, "Date_TimeZone")) {
+            if ($pm_tz->getID() == $this->id) {
+                return true;
+            }
+        } else {
+            if (!Date_TimeZone::isValidID($pm_tz)) {
+                return PEAR::raiseError(
+                    "Invalid time zone ID '$pm_tz'",
+                    DATE_ERROR_INVALIDTIMEZONE
+                );
+            }
+            if ($pm_tz == $this->id) {
+                return true;
+            }
+
+            $pm_tz = new Date_TimeZone($pm_tz);
+        }
+
+        if ($this->getRawOffset() == $pm_tz->getRawOffset() &&
+            $this->hasDaylightTime() == $pm_tz->hasDaylightTime() &&
+            $this->getDSTSavings() == $pm_tz->getDSTSavings() &&
+            $this->getSummerTimeStartMonth() == $pm_tz->getSummerTimeStartMonth() &&
+            $this->getSummerTimeStartDay() == $pm_tz->getSummerTimeStartDay() &&
+            $this->getSummerTimeStartTime() == $pm_tz->getSummerTimeStartTime() &&
+            $this->getSummerTimeEndMonth() == $pm_tz->getSummerTimeEndMonth() &&
+            $this->getSummerTimeEndDay() == $pm_tz->getSummerTimeEndDay() &&
+            $this->getSummerTimeEndTime() == $pm_tz->getSummerTimeEndTime()
+        ) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    // }}}
+    // {{{ hasDaylightTime()
+
+    /**
+     * Returns true if this zone observes daylight savings time
+     *
+     * @return   bool       true if this time zone has DST
+     * @access   public
+     */
+    public function hasDaylightTime()
+    {
+        return $this->hasdst;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeLimitDay()
+
+    /**
+     * Returns day on which Summer time starts or ends for given year
+     *
+     * The limit (start or end) code can take the following forms:
+     *
+     *  - <b>5</b>       -       the fifth of the month
+     *  - <b>lastSun</b> -       the last Sunday in the month
+     *  - <b>lastMon</b> -       the last Monday in the month
+     *  - <b>Sun>=8</b>  -       first Sunday on or after the 8th
+     *  - <b>Sun<=25</b> -       last Sunday on or before the 25th
+     *
+     * @param string $ps_summertimelimitcode code which specifies Summer time
+     *                                        limit day
+     * @param int $pn_month start or end month
+     * @param int $pn_year year for which to calculate Summer
+     *                                        time limit day
+     *
+     * @return   int
+     * @access   private
+     * @see      Date_TimeZone::getSummerTimeStartDay()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeLimitDay($ps_summertimelimitcode, $pn_month, $pn_year)
+    {
+        if (preg_match('/^[0-9]+$/', $ps_summertimelimitcode)) {
+            $hn_day = $ps_summertimelimitcode;
+        } else {
+            if (!isset($ha_daysofweek)) {
+                static $ha_daysofweek = array("Sun" => 0,
+                    "Mon" => 1,
+                    "Tue" => 2,
+                    "Wed" => 3,
+                    "Thu" => 4,
+                    "Fri" => 5,
+                    "Sat" => 6);
+            }
+
+            if (preg_match(
+                '/^last(Sun|Mon|Tue|Wed|Thu|Fri|Sat)$/',
+                $ps_summertimelimitcode,
+                $ha_matches
+            )) {
+                list($hn_nmyear, $hn_nextmonth, $hn_nmday) =
+                    explode(" ", Date_Calc::beginOfMonthBySpan(
+                        1,
+                        $pn_month,
+                        $pn_year,
+                        "%Y %m %d"
+                    ));
+                list($hn_year, $hn_month, $hn_day) =
+                    explode(
+                        " ",
+                        Date_Calc::prevDayOfWeek(
+                            $ha_daysofweek[$ha_matches[1]],
+                            $hn_nmday,
+                            $hn_nextmonth,
+                            $hn_nmyear,
+                            "%Y %m %d",
+                            false
+                        )
+                    ); // not including
+                // this day
+
+                if ($hn_month != $pn_month) {
+                    // This code happen legitimately if the calendar jumped some days
+                    // e.g. in a calendar switch, or the limit day is badly defined:
+                    //
+                    $hn_day = Date_Calc::getFirstDayOfMonth($pn_month, $pn_year);
+                }
+            } elseif (preg_match(
+                '/^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)([><]=)([0-9]+)$/',
+                $ps_summertimelimitcode,
+                $ha_matches
+            )) {
+                if ($ha_matches[2] == "<=") {
+                    list($hn_year, $hn_month, $hn_day) =
+                        explode(
+                            " ",
+                            Date_Calc::prevDayOfWeek(
+                                $ha_daysofweek[$ha_matches[1]],
+                                $ha_matches[3],
+                                $pn_month,
+                                $pn_year,
+                                "%Y %m %d",
+                                true
+                            )
+                        ); // including
+                    // this day
+
+                    if ($hn_month != $pn_month) {
+                        $hn_day = Date_Calc::getFirstDayOfMonth($pn_month, $pn_year);
+                    }
+                } else {
+                    list($hn_year, $hn_month, $hn_day) =
+                        explode(
+                            " ",
+                            Date_Calc::nextDayOfWeek(
+                                $ha_daysofweek[$ha_matches[1]],
+                                $ha_matches[3],
+                                $pn_month,
+                                $pn_year,
+                                "%Y %m %d",
+                                true
+                            )
+                        ); // including
+                    // this day
+
+                    if ($hn_month != $pn_month) {
+                        $hn_day = Date_Calc::daysInMonth($pn_month, $pn_year);
+                    }
+                }
+            }
+        }
+
+        return $hn_day;
+    }
+
+
+    // }}}
+    // {{{ inDaylightTime()
+
+    /**
+     * Returns whether the given date/time is in DST for this time zone
+     *
+     * Works for all years, positive and negative.  Possible problems
+     * are that when the clocks go forward, there is an invalid hour
+     * which is skipped.  If a time in this hour is specified, this
+     * function returns an error.  When the clocks go back, there is an
+     * hour which is repeated, that is, the hour is gone through twice -
+     * once in Summer time and once in standard time.  If this time
+     * is specified, then this function returns '$pb_repeatedhourdefault',
+     * because there is no way of knowing which is correct, and
+     * both possibilities are equally likely.
+     *
+     * Also bear in mind that the clocks go forward at the instant of
+     * the hour specified in the time-zone array below, and if this
+     * exact hour is specified then the clocks have actually changed,
+     * and this function reflects this.
+     *
+     * @param object $pm_date Date object to test or array of
+     *                                        day, month, year, seconds past
+     *                                        midnight
+     * @param bool $pb_repeatedhourdefault value to return if repeated hour is
+     *                                        specified (defaults to false)
+     *
+     * @return   bool       true if this date is in Summer time for this time
+     *                       zone
+     * @access   public
+     * @see      Date_TimeZone::inDaylightTimeStandard()
+     */
+    public function inDaylightTime($pm_date, $pb_repeatedhourdefault = false)
+    {
+        if (!$this->hasdst) {
+            return false;
+        }
+
+        if (is_a($pm_date, "Date")) {
+            $hn_day = $pm_date->getDay();
+            $hn_month = $pm_date->getMonth();
+            $hn_year = $pm_date->getYear();
+            $hn_seconds = $pm_date->getSecondsPastMidnight();
+        } else {
+            $hn_day = $pm_date[0];
+            $hn_month = $pm_date[1];
+            $hn_year = $pm_date[2];
+            $hn_seconds = $pm_date[3];  // seconds past midnight
+        }
+
+        if (($this->on_summertimestartmonth < $this->on_summertimeendmonth &&
+                $hn_month >= $this->on_summertimestartmonth &&
+                $hn_month <= $this->on_summertimeendmonth) ||
+            ($this->on_summertimestartmonth > $this->on_summertimeendmonth &&
+                $hn_month >= $this->on_summertimestartmonth &&
+                $hn_month <= $this->on_summertimeendmonth)
+        ) {
+            if ($hn_month == $this->on_summertimestartmonth) {
+                $hn_startday =
+                    $this->getSummerTimeLimitDay(
+                        $this->os_summertimestartday,
+                        $this->on_summertimestartmonth,
+                        $hn_year
+                    );
+
+                if ($hn_day < $hn_startday) {
+                    return false;
+                } elseif ($hn_day > $hn_startday) {
+                    return true;
+                } elseif (($hn_gmt = $hn_seconds * 1000 - $this->offset) -
+                    $this->on_summertimeoffset >=
+                    $this->on_summertimestarttime) {
+                    return true;
+                } elseif (($hn_gmt = $hn_seconds * 1000 - $this->offset) >=
+                    $this->on_summertimestarttime) {
+                    return PEAR::raiseError(
+                        "Invalid time specified for date '" .
+                        Date_Calc::dateFormat(
+                            $hn_day,
+                            $hn_month,
+                            $hn_year,
+                            "%Y-%m-%d"
+                        ) .
+                        "'",
+                        DATE_ERROR_INVALIDTIME
+                    );
+                } else {
+                    return false;
+                }
+            } elseif ($hn_month == $this->on_summertimeendmonth) {
+                $hn_endday =
+                    $this->getSummerTimeLimitDay(
+                        $this->os_summertimeendday,
+                        $this->on_summertimeendmonth,
+                        $hn_year
+                    );
+
+                if ($hn_day < $hn_endday) {
+                    return true;
+                } elseif ($hn_day > $hn_endday) {
+                    return false;
+                } elseif (($hn_gmt = $hn_seconds * 1000 - $this->offset) -
+                    $this->on_summertimeoffset >=
+                    $this->on_summertimeendtime) {
+                    return false;
+                } elseif ($hn_gmt >= $this->on_summertimeendtime) {
+                    // There is a 50:50 chance that it's Summer time, but there
+                    // is no way of knowing (the hour is repeated), so return
+                    // default:
+                    //
+                    return $pb_repeatedhourdefault;
+                } else {
+                    return true;
+                }
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+
+    // }}}
+    // {{{ inDaylightTimeStandard()
+
+    /**
+     * Returns whether the given date/time in local standard time is
+     * in Summer time
+     *
+     * For example, if the clocks go forward at 1.00 standard time,
+     * then if the specified date/time is at 1.00, the function will
+     * return true, although the correct local time will actually
+     * be 2.00.
+     *
+     * This function is reliable for all dates and times, unlike the
+     * related function '{@link Date_TimeZone::inDaylightTime()}',
+     * which will fail if passed
+     * an invalid time (the skipped hour) and will be wrong half the
+     * time if passed an ambiguous time (the repeated hour).
+     *
+     * @param object $pm_date Date object to test or array of day, month, year,
+     *                         seconds past midnight
+     *
+     * @return   bool       true if this date is in Summer time for this time
+     *                       zone
+     * @access   public
+     * @see      Date_TimeZone::inDaylightTime()
+     * @since    Method available since Release 1.5.0
+     */
+    public function inDaylightTimeStandard($pm_date)
+    {
+        if (!$this->hasdst) {
+            return false;
+        }
+
+        if (is_a($pm_date, "Date")) {
+            $hn_day = $pm_date->getDay();
+            $hn_month = $pm_date->getMonth();
+            $hn_year = $pm_date->getYear();
+            $hn_seconds = $pm_date->getSecondsPastMidnight();
+        } else {
+            $hn_day = $pm_date[0];
+            $hn_month = $pm_date[1];
+            $hn_year = $pm_date[2];
+            $hn_seconds = $pm_date[3];
+        }
+
+        if (($this->on_summertimestartmonth < $this->on_summertimeendmonth &&
+                $hn_month >= $this->on_summertimestartmonth &&
+                $hn_month <= $this->on_summertimeendmonth) ||
+            ($this->on_summertimestartmonth > $this->on_summertimeendmonth &&
+                $hn_month >= $this->on_summertimestartmonth &&
+                $hn_month <= $this->on_summertimeendmonth)
+        ) {
+            if ($hn_month == $this->on_summertimestartmonth) {
+                $hn_startday =
+                    $this->getSummerTimeLimitDay(
+                        $this->os_summertimestartday,
+                        $this->on_summertimestartmonth,
+                        $hn_year
+                    );
+
+                if ($hn_day < $hn_startday) {
+                    return false;
+                } elseif ($hn_day > $hn_startday) {
+                    return true;
+                } elseif ($hn_seconds * 1000 - $this->offset >=
+                    $this->on_summertimestarttime) {
+                    return true;
+                } else {
+                    return false;
+                }
+            } elseif ($hn_month == $this->on_summertimeendmonth) {
+                $hn_endday =
+                    $this->getSummerTimeLimitDay(
+                        $this->os_summertimeendday,
+                        $this->on_summertimeendmonth,
+                        $hn_year
+                    );
+
+                if ($hn_day < $hn_endday) {
+                    return true;
+                } elseif ($hn_day > $hn_endday) {
+                    return false;
+                } elseif ($hn_seconds * 1000 - $this->offset >=
+                    $this->on_summertimeendtime) {
+                    return false;
+                } else {
+                    return true;
+                }
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+
+    // }}}
+    // {{{ 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.  If the offset is not
+     * known, the function returns one hour.
+     *
+     * @return   int        the DST offset, in milliseconds or nought if the
+     *                       zone does not observe DST
+     * @access   public
+     */
+    public function getDSTSavings()
+    {
+        if ($this->hasdst) {
+            // If offset is not specified, guess one hour.  (This is almost
+            // always correct anyway).  This cannot be improved upon, because
+            // where it is unset, the offset is either unknowable because the
+            // time-zone covers more than one political area (which may have
+            // different Summer time policies), or they might all have the
+            // same policy, but there is no way to automatically maintain
+            // this data at the moment, and manually it is simply not worth
+            // the bother.  If a user wants this functionality and refuses
+            // to use the standard time-zone IDs, then he can always update
+            // the array himself.
+            //
+            return isset($this->on_summertimeoffset) ?
+                $this->on_summertimeoffset :
+                3600000;
+        } else {
+            return 0;
+        }
+    }
+
+
+    // }}}
+    // {{{ getRawOffset()
+
+    /**
+     * Returns the raw (non-DST-corrected) offset from UTC/GMT for this time
+     * zone
+     *
+     * @return   int        the offset, in milliseconds
+     * @access   public
+     * @see      Date_TimeZone::getOffset()
+     */
+    public function getRawOffset()
+    {
+        return $this->offset;
+    }
+
+
+    // }}}
+    // {{{ getOffset()
+
+    /**
+     * Returns the DST-corrected offset from UTC for the given date
+     *
+     * Gets 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.
+     *
+     * N.B. that the offset is calculated historically
+     * and in the future according to the current Summer time rules,
+     * and so this function is proleptically correct, but not necessarily
+     * historically correct.  (Although if you want to be correct about
+     * times in the distant past, this class is probably not for you
+     * because the whole notion of time zones does not apply, and
+     * historically there are so many time zone changes, Summer time
+     * rule changes, name changes, calendar changes, that calculating
+     * this sort of information is beyond the scope of this package
+     * altogether.)
+     *
+     * @param mixed $pm_insummertime a boolean specifying whether or not the
+     *                                date is in Summer time, or,
+     *                               a Date object to test for this condition
+     *
+     * @return   int        the corrected offset to UTC in milliseconds
+     * @access   public
+     * @see      Date_TimeZone::getRawOffset(), Date::getTZOffset()
+     */
+    public function getOffset($pm_insummertime)
+    {
+        if ($this->hasdst) {
+            if (is_a($pm_insummertime, "Date")) {
+                $hb_insummertime = $pm_insummertime->inDaylightTime();
+                if (PEAR::isError($hb_insummertime)) {
+                    return $hb_insummertime;
+                }
+            } else {
+                $hb_insummertime = $pm_insummertime;
+            }
+
+            if ($hb_insummertime) {
+                return $this->offset + $this->getDSTSavings();
+            }
+        }
+
+        return $this->offset;
+    }
+
+
+    // }}}
+    // {{{ getAvailableIDs()
+
+    /**
+     * Returns the list of valid time zone id strings
+     *
+     * @return   array      an array of strings with the valid time zone IDs
+     * @access   public
+     */
+    public function getAvailableIDs()
+    {
+        return array_keys($GLOBALS['_DATE_TIMEZONE_DATA']);
+    }
+
+
+    // }}}
+    // {{{ getID()
+
+    /**
+     * Returns the time zone id for this time zone, e.g. "America/Chicago"
+     *
+     * @return   string     the time zone ID
+     * @access   public
+     */
+    public function getID()
+    {
+        return $this->id;
+    }
+
+
+    // }}}
+    // {{{ getLongName()
+
+    /**
+     * Returns the long name for this time zone
+     *
+     * Long form of time zone name, e.g. 'Greenwich Mean Time'. Additionally
+     * a Date object can be passed in which case the Summer time name will
+     * be returned instead if the date falls in Summer time, e.g. 'British
+     * Summer Time', or a Boolean can be passed which explicitly specifies
+     * whether the date is in Summer time.
+     *
+     * N.B. this is not a unique identifier - for this purpose use the
+     * time zone ID.
+     *
+     * @param mixed $pm_insummertime a boolean specifying whether or not the
+     *                                date is in Summer time, or,
+     *                               a Date object to test for this condition
+     *
+     * @return   string     the long name
+     * @access   public
+     * @see      Date_TimeZone::getShortName(), Date_TimeZone::getDSTLongName(),
+     *            Date::getTZLongName()
+     */
+    public function getLongName($pm_insummertime = false)
+    {
+        if ($this->hasdst) {
+            if (is_a($pm_insummertime, "Date")) {
+                $hb_insummertime = $pm_insummertime->inDaylightTime();
+                if (PEAR::isError($hb_insummertime)) {
+                    return $hb_insummertime;
+                }
+            } else {
+                $hb_insummertime = $pm_insummertime;
+            }
+
+            if ($hb_insummertime) {
+                return $this->dstlongname;
+            }
+        }
+
+        return $this->longname;
+    }
+
+
+    // }}}
+    // {{{ getShortName()
+
+    /**
+     * Returns the short name for this time zone
+     *
+     * Returns abbreviated form of time zone name, e.g. 'GMT'. Additionally
+     * a Date object can be passed in which case the Summer time name will
+     * be returned instead if the date falls in Summer time, e.g. 'BST'.
+     *
+     * N.B. this is not a unique identifier - for this purpose use the
+     * time zone ID.
+     *
+     * @param mixed $pm_insummertime a boolean specifying whether or not the
+     *                                date is in Summer time, or,
+     *                               a Date object to test for this condition
+     *
+     * @return   string     the short name
+     * @access   public
+     * @see      Date_TimeZone::getLongName(), Date_TimeZone::getDSTShortName(),
+     *            Date::getTZShortName()
+     */
+    public function getShortName($pm_insummertime = false)
+    {
+        if ($this->hasdst) {
+            if (is_a($pm_insummertime, "Date")) {
+                $hb_insummertime = $pm_insummertime->inDaylightTime();
+                if (PEAR::isError($hb_insummertime)) {
+                    return $hb_insummertime;
+                }
+            } else {
+                $hb_insummertime = $pm_insummertime;
+            }
+
+            if ($hb_insummertime) {
+                return $this->dstshortname;
+            }
+        }
+
+        return $this->shortname;
+    }
+
+
+    // }}}
+    // {{{ getDSTLongName()
+
+    /**
+     * Returns the DST long name for this time zone, e.g.
+     * 'Central Daylight Time'
+     *
+     * @return   string     the daylight savings time long name
+     * @access   public
+     * @see      Date_TimeZone::getDSTShortName(), Date_TimeZone::getLongName()
+     */
+    public function getDSTLongName()
+    {
+        return $this->hasdst ? $this->dstlongname : $this->longname;
+    }
+
+
+    // }}}
+    // {{{ getDSTShortName()
+
+    /**
+     * Returns the DST short name for this time zone, e.g. 'CDT'
+     *
+     * @return   string     the daylight savings time short name
+     * @access   public
+     * @see      Date_TimeZone::getDSTLongName(), Date_TimeZone::getShortName()
+     */
+    public function getDSTShortName()
+    {
+        return $this->hasdst ? $this->dstshortname : $this->shortname;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeStartMonth()
+
+    /**
+     * Returns the month number in which Summer time starts
+     *
+     * @return   int        integer representing the month (1 to 12)
+     * @access   public
+     * @see      Date_TimeZone::getSummerTimeEndMonth(),
+     *            Date_TimeZone::getSummerTimeStartTime(),
+     *            Date_TimeZone::getSummerTimeStartDay()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeStartMonth()
+    {
+        return $this->hasdst ? $this->on_summertimestartmonth : null;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeStartDay()
+
+    /**
+     * Returns a code representing the day on which Summer time starts
+     *
+     * Returns a string in one of the following forms:
+     *
+     *  - <b>5</b>       - the fifth of the month
+     *  - <b>lastSun</b> - the last Sunday in the month
+     *  - <b>lastMon</b> - the last Monday in the month
+     *  - <b>Sun>=8</b>  - first Sunday on or after the 8th
+     *  - <b>Sun<=25</b> - last Sunday on or before the 25th
+     *
+     * @return   string
+     * @access   public
+     * @see      Date_TimeZone::getSummerTimeEndDay(),
+     *            Date_TimeZone::getSummerTimeStartTime(),
+     *            Date_TimeZone::getSummerTimeStartMonth(),
+     *            Date_TimeZone::getSummerTimeLimitDay()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeStartDay()
+    {
+        return $this->hasdst ? $this->os_summertimestartday : null;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeStartTime()
+
+    /**
+     * Returns the time of day at which which Summer time starts
+     *
+     * The returned time is an offset, in milliseconds, from midnight UTC.  Note
+     * that the offset can be negative, which represents the fact that the time
+     * zone is East of Greenwich, and that when the clocks change locally, the
+     * time in Greenwich is actually a time belonging to the previous day in
+     * UTC.  This, obviously, is unhelpful if you want to know the local time
+     * at which the clocks change, but it is of immense value for the purpose
+     * of calculation.
+     *
+     * @return   int        integer representing the month (1 to 12)
+     * @access   public
+     * @see      Date_TimeZone::getSummerTimeEndTime(),
+     *            Date_TimeZone::getSummerTimeStartDay(),
+     *            Date_TimeZone::getSummerTimeStartMonth()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeStartTime()
+    {
+        return $this->hasdst ? $this->on_summertimestarttime : null;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeEndMonth()
+
+    /**
+     * Returns the month number in which Summer time ends
+     *
+     * @return   int        integer representing the month (1 to 12)
+     * @access   public
+     * @see      Date_TimeZone::getSummerTimeStartMonth(),
+     *            Date_TimeZone::getSummerTimeEndTime(),
+     *            Date_TimeZone::getSummerTimeEndDay()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeEndMonth()
+    {
+        return $this->hasdst ? $this->on_summertimeendmonth : null;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeEndDay()
+
+    /**
+     * Returns a code representing the day on which Summer time ends
+     *
+     * Returns a string in one of the following forms:
+     *
+     *  - <b>5</b>       - the fifth of the month
+     *  - <b>lastSun</b> - the last Sunday in the month
+     *  - <b>lastMon</b> - the last Monday in the month
+     *  - <b>Sun>=8</b>  - first Sunday on or after the 8th
+     *  - <b>Sun<=25</b> - last Sunday on or before the 25th
+     *
+     * @return   string
+     * @access   public
+     * @see      Date_TimeZone::getSummerTimeStartDay(),
+     *            Date_TimeZone::getSummerTimeEndTime(),
+     *            Date_TimeZone::getSummerTimeEndMonth(),
+     *            Date_TimeZone::getSummerTimeLimitDay()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeEndDay()
+    {
+        return $this->hasdst ? $this->os_summertimeendday : null;
+    }
+
+
+    // }}}
+    // {{{ getSummerTimeEndTime()
+
+    /**
+     * Returns the time of day at which which Summer time ends
+     *
+     * @return   int        integer representing the month (1 to 12)
+     * @access   public
+     * @see      Date_TimeZone::getSummerTimeStartTime(),
+     *            Date_TimeZone::getSummerTimeEndDay(),
+     *            Date_TimeZone::getSummerTimeEndMonth()
+     * @since    Method available since Release 1.5.0
+     */
+    public function getSummerTimeEndTime()
+    {
+        return $this->hasdst ? $this->on_summertimeendtime : null;
+    }
+
+
+    // }}}
+}
+
+// }}}
+
+/**
+ * Time Zone Data (correct as of 15.iii.2007)
+ *
+ * N.B. offsets are in milliseconds
+ *
+ * @global array $GLOBALS ['_DATE_TIMEZONE_DATA']
+ */
+$GLOBALS['_DATE_TIMEZONE_DATA'] = array(
+    'Africa/Abidjan' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Accra' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Addis_Ababa' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Algiers' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => null,
+        'longname' => 'Central European Time'),
+    'Africa/Asmara' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Asmera' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Bamako' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Bangui' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Banjul' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Bissau' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Blantyre' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Brazzaville' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Bujumbura' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Cairo' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastFri',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 8,
+        'summertimeendday' => 'lastThu',
+        'summertimeendtime' => 75600000),
+    'Africa/Casablanca' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => null,
+        'longname' => 'Western European Time'),
+    'Africa/Ceuta' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Africa/Conakry' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Dakar' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Dar_es_Salaam' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Djibouti' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Douala' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/El_Aaiun' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => null,
+        'longname' => 'Western European Time'),
+    'Africa/Freetown' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Gaborone' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Harare' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Johannesburg' => array(
+        'offset' => 7200000,
+        'shortname' => 'SAST',
+        'dstshortname' => null,
+        'longname' => 'South Africa Standard Time'),
+    'Africa/Kampala' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Khartoum' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Kigali' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Kinshasa' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Lagos' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Libreville' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Lome' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Luanda' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Lubumbashi' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Lusaka' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Malabo' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Maputo' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'dstshortname' => null,
+        'longname' => 'Central African Time'),
+    'Africa/Maseru' => array(
+        'offset' => 7200000,
+        'shortname' => 'SAST',
+        'dstshortname' => null,
+        'longname' => 'South Africa Standard Time'),
+    'Africa/Mbabane' => array(
+        'offset' => 7200000,
+        'shortname' => 'SAST',
+        'dstshortname' => null,
+        'longname' => 'South Africa Standard Time'),
+    'Africa/Mogadishu' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Monrovia' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Nairobi' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Africa/Ndjamena' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Niamey' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Nouakchott' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Ouagadougou' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Porto-Novo' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => null,
+        'longname' => 'Western African Time'),
+    'Africa/Sao_Tome' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Timbuktu' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Africa/Tripoli' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => null,
+        'longname' => 'Eastern European Time'),
+    'Africa/Tunis' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Africa/Windhoek' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => 'WAST',
+        'longname' => 'Western African Time',
+        'dstlongname' => 'Western African Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 0),
+    'America/Adak' => array(
+        'offset' => -36000000,
+        'shortname' => 'HAST',
+        'dstshortname' => 'HADT',
+        'longname' => 'Hawaii-Aleutian Standard Time',
+        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 43200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 39600000),
+    'America/Anchorage' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 39600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 36000000),
+    'America/Anguilla' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Antigua' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Araguaina' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => null,
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time'),
+    'America/Argentina/Buenos_Aires' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Catamarca' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/ComodRivadavia' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Cordoba' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Jujuy' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/La_Rioja' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Mendoza' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Rio_Gallegos' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/San_Juan' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Tucuman' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Argentina/Ushuaia' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentina Time',
+        'dstlongname' => 'Argentina Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Aruba' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Asuncion' => array(
+        'offset' => -14400000,
+        'shortname' => 'PYT',
+        'dstshortname' => 'PYST',
+        'longname' => 'Paraguay Time',
+        'dstlongname' => 'Paraguay Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=15',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=8',
+        'summertimeendtime' => 10800000),
+    'America/Atikokan' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Atka' => array(
+        'offset' => -36000000,
+        'shortname' => 'HAST',
+        'dstshortname' => 'HADT',
+        'longname' => 'Hawaii-Aleutian Standard Time',
+        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 43200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 39600000),
+    'America/Bahia' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => null,
+        'longname' => 'Brazil Eastern Time'),
+    'America/Barbados' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Belem' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => null,
+        'longname' => 'Brazil Time'),
+    'America/Belize' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Blanc-Sablon' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Boa_Vista' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => null,
+        'longname' => 'Amazon Standard Time'),
+    'America/Bogota' => array(
+        'offset' => -18000000,
+        'shortname' => 'COT',
+        'dstshortname' => null,
+        'longname' => 'Colombia Time'),
+    'America/Boise' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'America/Buenos_Aires' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentine Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Cambridge_Bay' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'America/Campo_Grande' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => 'AMST',
+        'longname' => 'Amazon Standard Time',
+        'dstlongname' => 'Amazon Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 2,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 10800000),
+    'America/Cancun' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 25200000),
+    'America/Caracas' => array(
+        'offset' => -16200000,
+        'shortname' => 'VET',
+        'dstshortname' => null,
+        'longname' => 'Venezuela Time'),
+    'America/Catamarca' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentine Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Cayenne' => array(
+        'offset' => -10800000,
+        'shortname' => 'GFT',
+        'dstshortname' => null,
+        'longname' => 'French Guiana Time'),
+    'America/Cayman' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Chicago' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Chihuahua' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 28800000),
+    'America/Coral_Harbour' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Cordoba' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentine Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Costa_Rica' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Cuiaba' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => 'AMST',
+        'longname' => 'Amazon Standard Time',
+        'dstlongname' => 'Amazon Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 2,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 10800000),
+    'America/Curacao' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Danmarkshavn' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'America/Dawson' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'America/Dawson_Creek' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => null,
+        'longname' => 'Mountain Standard Time'),
+    'America/Denver' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'America/Detroit' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Dominica' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Edmonton' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'America/Eirunepe' => array(
+        'offset' => -18000000,
+        'shortname' => 'ACT',
+        'dstshortname' => null,
+        'longname' => 'Acre Time'),
+    'America/El_Salvador' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Ensenada' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 32400000),
+    'America/Fort_Wayne' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Fortaleza' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => null,
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time'),
+    'America/Glace_Bay' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 21600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 18000000),
+    'America/Godthab' => array(
+        'offset' => -10800000,
+        'shortname' => 'WGT',
+        'dstshortname' => 'WGST',
+        'longname' => 'Western Greenland Time',
+        'dstlongname' => 'Western Greenland Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'America/Goose_Bay' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 14460000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 10860000),
+    'America/Grand_Turk' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Grenada' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Guadeloupe' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Guatemala' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Guayaquil' => array(
+        'offset' => -18000000,
+        'shortname' => 'ECT',
+        'dstshortname' => null,
+        'longname' => 'Ecuador Time'),
+    'America/Guyana' => array(
+        'offset' => -14400000,
+        'shortname' => 'GYT',
+        'dstshortname' => null,
+        'longname' => 'Guyana Time'),
+    'America/Halifax' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 21600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 18000000),
+    'America/Havana' => array(
+        'offset' => -18000000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 18000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 18000000),
+    'America/Hermosillo' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => null,
+        'longname' => 'Mountain Standard Time'),
+    'America/Indiana/Indianapolis' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Indiana/Knox' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Indiana/Marengo' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Indiana/Petersburg' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Indiana/Tell_City' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Indiana/Vevay' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Indiana/Vincennes' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Indiana/Winamac' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Indianapolis' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Inuvik' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'America/Iqaluit' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Jamaica' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Jujuy' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentine Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Juneau' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 39600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 36000000),
+    'America/Kentucky/Louisville' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Kentucky/Monticello' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Knox_IN' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/La_Paz' => array(
+        'offset' => -14400000,
+        'shortname' => 'BOT',
+        'dstshortname' => null,
+        'longname' => 'Bolivia Time'),
+    'America/Lima' => array(
+        'offset' => -18000000,
+        'shortname' => 'PET',
+        'dstshortname' => null,
+        'longname' => 'Peru Time'),
+    'America/Los_Angeles' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'America/Louisville' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Maceio' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => null,
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time'),
+    'America/Managua' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Manaus' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => null,
+        'longname' => 'Amazon Standard Time'),
+    'America/Marigot' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Martinique' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Mazatlan' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 28800000),
+    'America/Mendoza' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentine Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Menominee' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Merida' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 25200000),
+    'America/Mexico_City' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 25200000),
+    'America/Miquelon' => array(
+        'offset' => -10800000,
+        'shortname' => 'PMST',
+        'dstshortname' => 'PMDT',
+        'longname' => 'Pierre & Miquelon Standard Time',
+        'dstlongname' => 'Pierre & Miquelon Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 18000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 14400000),
+    'America/Moncton' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 21600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 18000000),
+    'America/Monterrey' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 25200000),
+    'America/Montevideo' => array(
+        'offset' => -10800000,
+        'shortname' => 'UYT',
+        'dstshortname' => 'UYST',
+        'longname' => 'Uruguay Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 18000000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=8',
+        'summertimeendtime' => 14400000),
+    'America/Montreal' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Montserrat' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Nassau' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/New_York' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Nipigon' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Nome' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 39600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 36000000),
+    'America/Noronha' => array(
+        'offset' => -7200000,
+        'shortname' => 'FNT',
+        'dstshortname' => null,
+        'longname' => 'Fernando de Noronha Time'),
+    'America/North_Dakota/Center' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/North_Dakota/New_Salem' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Panama' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Pangnirtung' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Paramaribo' => array(
+        'offset' => -10800000,
+        'shortname' => 'SRT',
+        'dstshortname' => null,
+        'longname' => 'Suriname Time'),
+    'America/Phoenix' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => null,
+        'longname' => 'Mountain Standard Time'),
+    'America/Port-au-Prince' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Port_of_Spain' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Porto_Acre' => array(
+        'offset' => -18000000,
+        'shortname' => 'ACT',
+        'dstshortname' => null,
+        'longname' => 'Acre Time'),
+    'America/Porto_Velho' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => null,
+        'longname' => 'Amazon Standard Time'),
+    'America/Puerto_Rico' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Rainy_River' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Rankin_Inlet' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Recife' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => null,
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time'),
+    'America/Regina' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Resolute' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'America/Rio_Branco' => array(
+        'offset' => -18000000,
+        'shortname' => 'ACT',
+        'dstshortname' => null,
+        'longname' => 'Acre Time'),
+    'America/Rosario' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'dstshortname' => 'ARST',
+        'longname' => 'Argentine Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 0),
+    'America/Santiago' => array(
+        'offset' => -14400000,
+        'shortname' => 'CLT',
+        'dstshortname' => 'CLST',
+        'longname' => 'Chile Time',
+        'dstlongname' => 'Chile Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=9',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => '30',
+        'summertimeendtime' => 10800000),
+    'America/Santo_Domingo' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Sao_Paulo' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => 'BRST',
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 10800000,
+        'summertimeendmonth' => 2,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 7200000),
+    'America/Scoresbysund' => array(
+        'offset' => -3600000,
+        'shortname' => 'EGT',
+        'dstshortname' => 'EGST',
+        'longname' => 'Eastern Greenland Time',
+        'dstlongname' => 'Eastern Greenland Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'America/Shiprock' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'America/St_Barthelemy' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/St_Johns' => array(
+        'offset' => -12600000,
+        'shortname' => 'NST',
+        'dstshortname' => 'NDT',
+        'longname' => 'Newfoundland Standard Time',
+        'dstlongname' => 'Newfoundland Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 12660000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 9060000),
+    'America/St_Kitts' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/St_Lucia' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/St_Thomas' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/St_Vincent' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Swift_Current' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Tegucigalpa' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'America/Thule' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 21600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 18000000),
+    'America/Thunder_Bay' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Tijuana' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 32400000),
+    'America/Toronto' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'America/Tortola' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Vancouver' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'America/Virgin' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Atlantic Standard Time'),
+    'America/Whitehorse' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'America/Winnipeg' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'America/Yakutat' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 39600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 36000000),
+    'America/Yellowknife' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'Antarctica/Casey' => array(
+        'offset' => 28800000,
+        'shortname' => 'WST',
+        'dstshortname' => null,
+        'longname' => 'Western Standard Time (Australia)'),
+    'Antarctica/Davis' => array(
+        'offset' => 25200000,
+        'shortname' => 'DAVT',
+        'dstshortname' => null,
+        'longname' => 'Davis Time'),
+    'Antarctica/DumontDUrville' => array(
+        'offset' => 36000000,
+        'shortname' => 'DDUT',
+        'dstshortname' => null,
+        'longname' => 'Dumont-d\'Urville Time'),
+    'Antarctica/Mawson' => array(
+        'offset' => 21600000,
+        'shortname' => 'MAWT',
+        'dstshortname' => null,
+        'longname' => 'Mawson Time'),
+    'Antarctica/McMurdo' => array(
+        'offset' => 43200000,
+        'shortname' => 'NZST',
+        'dstshortname' => 'NZDT',
+        'longname' => 'New Zealand Standard Time',
+        'dstlongname' => 'New Zealand Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -36000000),
+    'Antarctica/Palmer' => array(
+        'offset' => -14400000,
+        'shortname' => 'CLT',
+        'dstshortname' => 'CLST',
+        'longname' => 'Chile Time',
+        'dstlongname' => 'Chile Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=9',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'Sun>=9',
+        'summertimeendtime' => 10800000),
+    'Antarctica/Rothera' => array(
+        'offset' => -10800000,
+        'shortname' => 'ROTT',
+        'dstshortname' => null,
+        'longname' => 'Rothera Time'),
+    'Antarctica/South_Pole' => array(
+        'offset' => 43200000,
+        'shortname' => 'NZST',
+        'dstshortname' => 'NZDT',
+        'longname' => 'New Zealand Standard Time',
+        'dstlongname' => 'New Zealand Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -36000000),
+    'Antarctica/Syowa' => array(
+        'offset' => 10800000,
+        'shortname' => 'SYOT',
+        'dstshortname' => null,
+        'longname' => 'Syowa Time'),
+    'Antarctica/Vostok' => array(
+        'offset' => 21600000,
+        'shortname' => 'VOST',
+        'dstshortname' => null,
+        'longname' => 'Vostok time'),
+    'Arctic/Longyearbyen' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Asia/Aden' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Arabia Standard Time'),
+    'Asia/Almaty' => array(
+        'offset' => 21600000,
+        'shortname' => 'ALMT',
+        'dstshortname' => null,
+        'longname' => 'Alma-Ata Time',
+        'dstlongname' => 'Alma-Ata Summer Time'),
+    'Asia/Amman' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastThu',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastFri',
+        'summertimeendtime' => -7200000),
+    'Asia/Anadyr' => array(
+        'offset' => 43200000,
+        'shortname' => 'ANAT',
+        'dstshortname' => 'ANAST',
+        'longname' => 'Anadyr Time',
+        'dstlongname' => 'Anadyr Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -36000000),
+    'Asia/Aqtau' => array(
+        'offset' => 18000000,
+        'shortname' => 'AQTT',
+        'dstshortname' => null,
+        'longname' => 'Aqtau Time',
+        'dstlongname' => 'Aqtau Summer Time'),
+    'Asia/Aqtobe' => array(
+        'offset' => 18000000,
+        'shortname' => 'AQTT',
+        'dstshortname' => null,
+        'longname' => 'Aqtobe Time',
+        'dstlongname' => 'Aqtobe Summer Time'),
+    'Asia/Ashgabat' => array(
+        'offset' => 18000000,
+        'shortname' => 'TMT',
+        'dstshortname' => null,
+        'longname' => 'Turkmenistan Time'),
+    'Asia/Ashkhabad' => array(
+        'offset' => 18000000,
+        'shortname' => 'TMT',
+        'dstshortname' => null,
+        'longname' => 'Turkmenistan Time'),
+    'Asia/Baghdad' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Arabia Standard Time',
+        'dstlongname' => 'Arabia Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => '1',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => '1',
+        'summertimeendtime' => 0),
+    'Asia/Bahrain' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Arabia Standard Time'),
+    'Asia/Baku' => array(
+        'offset' => 14400000,
+        'shortname' => 'AZT',
+        'dstshortname' => 'AZST',
+        'longname' => 'Azerbaijan Time',
+        'dstlongname' => 'Azerbaijan Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 0),
+    'Asia/Bangkok' => array(
+        'offset' => 25200000,
+        'shortname' => 'ICT',
+        'dstshortname' => null,
+        'longname' => 'Indochina Time'),
+    'Asia/Beirut' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -10800000),
+    'Asia/Bishkek' => array(
+        'offset' => 21600000,
+        'shortname' => 'KGT',
+        'dstshortname' => null,
+        'longname' => 'Kirgizstan Time',
+        'dstlongname' => 'Kirgizstan Summer Time'),
+    'Asia/Brunei' => array(
+        'offset' => 28800000,
+        'shortname' => 'BNT',
+        'dstshortname' => null,
+        'longname' => 'Brunei Time'),
+    'Asia/Calcutta' => array(
+        'offset' => 19800000,
+        'shortname' => 'IST',
+        'dstshortname' => null,
+        'longname' => 'India Standard Time'),
+    'Asia/Choibalsan' => array(
+        'offset' => 32400000,
+        'shortname' => 'CHOT',
+        'dstshortname' => null,
+        'longname' => 'Choibalsan Time'),
+    'Asia/Chongqing' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Chungking' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Colombo' => array(
+        'offset' => 19800000,
+        'shortname' => 'IST',
+        'dstshortname' => null,
+        'longname' => 'India Standard Time'),
+    'Asia/Dacca' => array(
+        'offset' => 21600000,
+        'shortname' => 'BDT',
+        'dstshortname' => null,
+        'longname' => 'Bangladesh Time'),
+    'Asia/Damascus' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastFri',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Fri>=1',
+        'summertimeendtime' => -10800000),
+    'Asia/Dhaka' => array(
+        'offset' => 21600000,
+        'shortname' => 'BDT',
+        'dstshortname' => null,
+        'longname' => 'Bangladesh Time'),
+    'Asia/Dili' => array(
+        'offset' => 32400000,
+        'shortname' => 'TLT',
+        'dstshortname' => null,
+        'longname' => 'East Timor Time'),
+    'Asia/Dubai' => array(
+        'offset' => 14400000,
+        'shortname' => 'GST',
+        'dstshortname' => null,
+        'longname' => 'Gulf Standard Time'),
+    'Asia/Dushanbe' => array(
+        'offset' => 18000000,
+        'shortname' => 'TJT',
+        'dstshortname' => null,
+        'longname' => 'Tajikistan Time'),
+    'Asia/Gaza' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => '1',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 9,
+        'summertimeendday' => 'Thu>=8',
+        'summertimeendtime' => -3600000),
+    'Asia/Harbin' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Hong_Kong' => array(
+        'offset' => 28800000,
+        'shortname' => 'HKT',
+        'dstshortname' => null,
+        'longname' => 'Hong Kong Time'),
+    'Asia/Hovd' => array(
+        'offset' => 25200000,
+        'shortname' => 'HOVT',
+        'dstshortname' => null,
+        'longname' => 'Hovd Time'),
+    'Asia/Irkutsk' => array(
+        'offset' => 28800000,
+        'shortname' => 'IRKT',
+        'dstshortname' => 'IRKST',
+        'longname' => 'Irkutsk Time',
+        'dstlongname' => 'Irkutsk Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -21600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -21600000),
+    'Asia/Istanbul' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Asia/Jakarta' => array(
+        'offset' => 25200000,
+        'shortname' => 'WIT',
+        'dstshortname' => null,
+        'longname' => 'West Indonesia Time'),
+    'Asia/Jayapura' => array(
+        'offset' => 32400000,
+        'shortname' => 'EIT',
+        'dstshortname' => null,
+        'longname' => 'East Indonesia Time'),
+    'Asia/Jerusalem' => array(
+        'offset' => 7200000,
+        'shortname' => 'IST',
+        'dstshortname' => 'IDT',
+        'longname' => 'Israel Standard Time',
+        'dstlongname' => 'Israel Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Fri>=26',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => '5',
+        'summertimeendtime' => -3600000),
+    'Asia/Kabul' => array(
+        'offset' => 16200000,
+        'shortname' => 'AFT',
+        'dstshortname' => null,
+        'longname' => 'Afghanistan Time'),
+    'Asia/Kamchatka' => array(
+        'offset' => 43200000,
+        'shortname' => 'PETT',
+        'dstshortname' => 'PETST',
+        'longname' => 'Petropavlovsk-Kamchatski Time',
+        'dstlongname' => 'Petropavlovsk-Kamchatski Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -36000000),
+    'Asia/Karachi' => array(
+        'offset' => 18000000,
+        'shortname' => 'PKT',
+        'dstshortname' => null,
+        'longname' => 'Pakistan Time'),
+    'Asia/Kashgar' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Katmandu' => array(
+        'offset' => 20700000,
+        'shortname' => 'NPT',
+        'dstshortname' => null,
+        'longname' => 'Nepal Time'),
+    'Asia/Krasnoyarsk' => array(
+        'offset' => 25200000,
+        'shortname' => 'KRAT',
+        'dstshortname' => 'KRAST',
+        'longname' => 'Krasnoyarsk Time',
+        'dstlongname' => 'Krasnoyarsk Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -18000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -18000000),
+    'Asia/Kuala_Lumpur' => array(
+        'offset' => 28800000,
+        'shortname' => 'MYT',
+        'dstshortname' => null,
+        'longname' => 'Malaysia Time'),
+    'Asia/Kuching' => array(
+        'offset' => 28800000,
+        'shortname' => 'MYT',
+        'dstshortname' => null,
+        'longname' => 'Malaysia Time'),
+    'Asia/Kuwait' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Arabia Standard Time'),
+    'Asia/Macao' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Macau' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Magadan' => array(
+        'offset' => 39600000,
+        'shortname' => 'MAGT',
+        'dstshortname' => 'MAGST',
+        'longname' => 'Magadan Time',
+        'dstlongname' => 'Magadan Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -32400000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -32400000),
+    'Asia/Makassar' => array(
+        'offset' => 28800000,
+        'shortname' => 'CIT',
+        'dstshortname' => null,
+        'longname' => 'Central Indonesia Time'),
+    'Asia/Manila' => array(
+        'offset' => 28800000,
+        'shortname' => 'PHT',
+        'dstshortname' => null,
+        'longname' => 'Philippines Time'),
+    'Asia/Muscat' => array(
+        'offset' => 14400000,
+        'shortname' => 'GST',
+        'dstshortname' => null,
+        'longname' => 'Gulf Standard Time'),
+    'Asia/Nicosia' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Asia/Novosibirsk' => array(
+        'offset' => 21600000,
+        'shortname' => 'NOVT',
+        'dstshortname' => 'NOVST',
+        'longname' => 'Novosibirsk Time',
+        'dstlongname' => 'Novosibirsk Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -14400000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -14400000),
+    'Asia/Omsk' => array(
+        'offset' => 21600000,
+        'shortname' => 'OMST',
+        'dstshortname' => 'OMSST',
+        'longname' => 'Omsk Time',
+        'dstlongname' => 'Omsk Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -14400000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -14400000),
+    'Asia/Oral' => array(
+        'offset' => 18000000,
+        'shortname' => 'ORAT',
+        'dstshortname' => null,
+        'longname' => 'Oral Time'),
+    'Asia/Phnom_Penh' => array(
+        'offset' => 25200000,
+        'shortname' => 'ICT',
+        'dstshortname' => null,
+        'longname' => 'Indochina Time'),
+    'Asia/Pontianak' => array(
+        'offset' => 25200000,
+        'shortname' => 'WIT',
+        'dstshortname' => null,
+        'longname' => 'West Indonesia Time'),
+    'Asia/Pyongyang' => array(
+        'offset' => 32400000,
+        'shortname' => 'KST',
+        'dstshortname' => null,
+        'longname' => 'Korea Standard Time'),
+    'Asia/Qatar' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Arabia Standard Time'),
+    'Asia/Qyzylorda' => array(
+        'offset' => 21600000,
+        'shortname' => 'QYZT',
+        'dstshortname' => null,
+        'longname' => 'Qyzylorda Time'),
+    'Asia/Rangoon' => array(
+        'offset' => 23400000,
+        'shortname' => 'MMT',
+        'dstshortname' => null,
+        'longname' => 'Myanmar Time'),
+    'Asia/Riyadh' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'dstshortname' => null,
+        'longname' => 'Arabia Standard Time'),
+    'Asia/Riyadh87' => array(
+        'offset' => 11224000,
+        'shortname' => '',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:07'),
+    'Asia/Riyadh88' => array(
+        'offset' => 11224000,
+        'shortname' => '',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:07'),
+    'Asia/Riyadh89' => array(
+        'offset' => 11224000,
+        'shortname' => '',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:07'),
+    'Asia/Saigon' => array(
+        'offset' => 25200000,
+        'shortname' => 'ICT',
+        'dstshortname' => null,
+        'longname' => 'Indochina Time'),
+    'Asia/Sakhalin' => array(
+        'offset' => 36000000,
+        'shortname' => 'SAKT',
+        'dstshortname' => 'SAKST',
+        'longname' => 'Sakhalin Time',
+        'dstlongname' => 'Sakhalin Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -28800000),
+    'Asia/Samarkand' => array(
+        'offset' => 18000000,
+        'shortname' => 'UZT',
+        'dstshortname' => null,
+        'longname' => 'Turkmenistan Time'),
+    'Asia/Seoul' => array(
+        'offset' => 32400000,
+        'shortname' => 'KST',
+        'dstshortname' => null,
+        'longname' => 'Korea Standard Time'),
+    'Asia/Shanghai' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Singapore' => array(
+        'offset' => 28800000,
+        'shortname' => 'SGT',
+        'dstshortname' => null,
+        'longname' => 'Singapore Time'),
+    'Asia/Taipei' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Tashkent' => array(
+        'offset' => 18000000,
+        'shortname' => 'UZT',
+        'dstshortname' => null,
+        'longname' => 'Uzbekistan Time'),
+    'Asia/Tbilisi' => array(
+        'offset' => 14400000,
+        'shortname' => 'GET',
+        'dstshortname' => null,
+        'longname' => 'Georgia Time',
+        'dstlongname' => 'Georgia Summer Time'),
+    'Asia/Tehran' => array(
+        'offset' => 12600000,
+        'shortname' => 'IRST',
+        'dstshortname' => 'IRDT',
+        'longname' => 'Iran Time',
+        'dstlongname' => 'Iran Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => '21',
+        'summertimestarttime' => -12600000,
+        'summertimeendmonth' => 9,
+        'summertimeendday' => '21',
+        'summertimeendtime' => -16200000),
+    'Asia/Tel_Aviv' => array(
+        'offset' => 7200000,
+        'shortname' => 'IST',
+        'dstshortname' => 'IDT',
+        'longname' => 'Israel Standard Time',
+        'dstlongname' => 'Israel Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Fri>=26',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => '5',
+        'summertimeendtime' => -3600000),
+    'Asia/Thimbu' => array(
+        'offset' => 21600000,
+        'shortname' => 'BTT',
+        'dstshortname' => null,
+        'longname' => 'Bhutan Time'),
+    'Asia/Thimphu' => array(
+        'offset' => 21600000,
+        'shortname' => 'BTT',
+        'dstshortname' => null,
+        'longname' => 'Bhutan Time'),
+    'Asia/Tokyo' => array(
+        'offset' => 32400000,
+        'shortname' => 'JST',
+        'dstshortname' => null,
+        'longname' => 'Japan Standard Time'),
+    'Asia/Ujung_Pandang' => array(
+        'offset' => 28800000,
+        'shortname' => 'CIT',
+        'dstshortname' => null,
+        'longname' => 'Central Indonesia Time'),
+    'Asia/Ulaanbaatar' => array(
+        'offset' => 28800000,
+        'shortname' => 'ULAT',
+        'dstshortname' => null,
+        'longname' => 'Ulaanbaatar Time'),
+    'Asia/Ulan_Bator' => array(
+        'offset' => 28800000,
+        'shortname' => 'ULAT',
+        'dstshortname' => null,
+        'longname' => 'Ulaanbaatar Time'),
+    'Asia/Urumqi' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'Asia/Vientiane' => array(
+        'offset' => 25200000,
+        'shortname' => 'ICT',
+        'dstshortname' => null,
+        'longname' => 'Indochina Time'),
+    'Asia/Vladivostok' => array(
+        'offset' => 36000000,
+        'shortname' => 'VLAT',
+        'dstshortname' => 'VLAST',
+        'longname' => 'Vladivostok Time',
+        'dstlongname' => 'Vladivostok Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -28800000),
+    'Asia/Yakutsk' => array(
+        'offset' => 32400000,
+        'shortname' => 'YAKT',
+        'dstshortname' => 'YAKST',
+        'longname' => 'Yakutsk Time',
+        'dstlongname' => 'Yaktsk Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -25200000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -25200000),
+    'Asia/Yekaterinburg' => array(
+        'offset' => 18000000,
+        'shortname' => 'YEKT',
+        'dstshortname' => 'YEKST',
+        'longname' => 'Yekaterinburg Time',
+        'dstlongname' => 'Yekaterinburg Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -10800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -10800000),
+    'Asia/Yerevan' => array(
+        'offset' => 14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => 'AMST',
+        'longname' => 'Armenia Time',
+        'dstlongname' => 'Armenia Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -7200000),
+    'Atlantic/Azores' => array(
+        'offset' => -3600000,
+        'shortname' => 'AZOT',
+        'dstshortname' => 'AZOST',
+        'longname' => 'Azores Time',
+        'dstlongname' => 'Azores Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Atlantic/Bermuda' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 21600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 18000000),
+    'Atlantic/Canary' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Atlantic/Cape_Verde' => array(
+        'offset' => -3600000,
+        'shortname' => 'CVT',
+        'dstshortname' => null,
+        'longname' => 'Cape Verde Time'),
+    'Atlantic/Faeroe' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Atlantic/Faroe' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western Europe Time',
+        'dstlongname' => 'Western Europe Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Atlantic/Jan_Mayen' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Eastern Greenland Time',
+        'dstlongname' => 'Eastern Greenland Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Atlantic/Madeira' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Atlantic/Reykjavik' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Atlantic/South_Georgia' => array(
+        'offset' => -7200000,
+        'shortname' => 'GST',
+        'dstshortname' => null,
+        'longname' => 'South Georgia Standard Time'),
+    'Atlantic/St_Helena' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Atlantic/Stanley' => array(
+        'offset' => -14400000,
+        'shortname' => 'FKT',
+        'dstshortname' => 'FKST',
+        'longname' => 'Falkland Is. Time',
+        'dstlongname' => 'Falkland Is. Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 7200000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 7200000),
+    'Australia/ACT' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (New South Wales)',
+        'dstlongname' => 'Eastern Summer Time (New South Wales)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/Adelaide' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CST',
+        'longname' => 'Central Standard Time (South Australia)',
+        'dstlongname' => 'Central Summer Time (South Australia)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -27000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -27000000),
+    'Australia/Brisbane' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time (Queensland)'),
+    'Australia/Broken_Hill' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CST',
+        'longname' => 'Central Standard Time (South Australia/New South Wales)',
+        'dstlongname' => 'Central Summer Time (South Australia/New South Wales)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -27000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -27000000),
+    'Australia/Canberra' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (New South Wales)',
+        'dstlongname' => 'Eastern Summer Time (New South Wales)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/Currie' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/Darwin' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time (Northern Territory)'),
+    'Australia/Eucla' => array(
+        'offset' => 31500000,
+        'shortname' => 'CWST',
+        'dstshortname' => 'CWST',
+        'longname' => 'Central Western Standard Time',
+        'dstlongname' => 'Central Western Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -24300000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -24300000),
+    'Australia/Hobart' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Tasmania)',
+        'dstlongname' => 'Eastern Summer Time (Tasmania)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/LHI' => array(
+        'offset' => 37800000,
+        'shortname' => 'LHST',
+        'dstshortname' => 'LHST',
+        'longname' => 'Load Howe Standard Time',
+        'dstlongname' => 'Load Howe Summer Time',
+        'summertimeoffset' => 1800000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 7200000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 7200000),
+    'Australia/Lindeman' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time (Queensland)'),
+    'Australia/Lord_Howe' => array(
+        'offset' => 37800000,
+        'shortname' => 'LHST',
+        'dstshortname' => 'LHST',
+        'longname' => 'Load Howe Standard Time',
+        'dstlongname' => 'Load Howe Summer Time',
+        'summertimeoffset' => 1800000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 7200000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 7200000),
+    'Australia/Melbourne' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Victoria)',
+        'dstlongname' => 'Eastern Summer Time (Victoria)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/NSW' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (New South Wales)',
+        'dstlongname' => 'Eastern Summer Time (New South Wales)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/North' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time (Northern Territory)'),
+    'Australia/Perth' => array(
+        'offset' => 28800000,
+        'shortname' => 'WST',
+        'dstshortname' => 'WST',
+        'longname' => 'Western Standard Time (Australia)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -21600000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -21600000),
+    'Australia/Queensland' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time (Queensland)'),
+    'Australia/South' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CST',
+        'longname' => 'Central Standard Time (South Australia)',
+        'dstlongname' => 'Central Summer Time (South Australia)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -27000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -27000000),
+    'Australia/Sydney' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (New South Wales)',
+        'dstlongname' => 'Eastern Summer Time (New South Wales)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/Tasmania' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Tasmania)',
+        'dstlongname' => 'Eastern Summer Time (Tasmania)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/Victoria' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Victoria)',
+        'dstlongname' => 'Eastern Summer Time (Victoria)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -28800000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -28800000),
+    'Australia/West' => array(
+        'offset' => 28800000,
+        'shortname' => 'WST',
+        'dstshortname' => 'WST',
+        'longname' => 'Western Standard Time (Australia)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -21600000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -21600000),
+    'Australia/Yancowinna' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CST',
+        'longname' => 'Central Standard Time (South Australia/New South Wales)',
+        'dstlongname' => 'Central Summer Time (South Australia/New South Wales)',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => -27000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -27000000),
+    'Brazil/Acre' => array(
+        'offset' => -18000000,
+        'shortname' => 'ACT',
+        'dstshortname' => null,
+        'longname' => 'Acre Time'),
+    'Brazil/DeNoronha' => array(
+        'offset' => -7200000,
+        'shortname' => 'FNT',
+        'dstshortname' => null,
+        'longname' => 'Fernando de Noronha Time'),
+    'Brazil/East' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => 'BRST',
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 10800000,
+        'summertimeendmonth' => 2,
+        'summertimeendday' => 'Sun>=15',
+        'summertimeendtime' => 7200000),
+    'Brazil/West' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => null,
+        'longname' => 'Amazon Standard Time'),
+    'CET' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'CST6CDT' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'Canada/Atlantic' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 21600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 18000000),
+    'Canada/Central' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'Canada/East-Saskatchewan' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'Canada/Eastern' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'Canada/Mountain' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'Canada/Newfoundland' => array(
+        'offset' => -12600000,
+        'shortname' => 'NST',
+        'dstshortname' => 'NDT',
+        'longname' => 'Newfoundland Standard Time',
+        'dstlongname' => 'Newfoundland Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 12660000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 9060000),
+    'Canada/Pacific' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'Canada/Saskatchewan' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'Central Standard Time'),
+    'Canada/Yukon' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'Chile/Continental' => array(
+        'offset' => -14400000,
+        'shortname' => 'CLT',
+        'dstshortname' => 'CLST',
+        'longname' => 'Chile Time',
+        'dstlongname' => 'Chile Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=9',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => '30',
+        'summertimeendtime' => 10800000),
+    'Chile/EasterIsland' => array(
+        'offset' => -21600000,
+        'shortname' => 'EAST',
+        'dstshortname' => 'EASST',
+        'longname' => 'Easter Is. Time',
+        'dstlongname' => 'Easter Is. Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=9',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => '30',
+        'summertimeendtime' => 10800000),
+    'Cuba' => array(
+        'offset' => -18000000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 18000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 18000000),
+    'EET' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'EST' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time'),
+    'EST5EDT' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'Egypt' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastFri',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 8,
+        'summertimeendday' => 'lastThu',
+        'summertimeendtime' => 75600000),
+    'Eire' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'IST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'Irish Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Etc/GMT' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'GMT+00:00'),
+    'Etc/GMT+0' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'GMT+00:00'),
+    'Etc/GMT+1' => array(
+        'offset' => -3600000,
+        'shortname' => 'GMT+1',
+        'dstshortname' => null,
+        'longname' => 'GMT-01:00'),
+    'Etc/GMT+10' => array(
+        'offset' => -36000000,
+        'shortname' => 'GMT+10',
+        'dstshortname' => null,
+        'longname' => 'GMT-10:00'),
+    'Etc/GMT+11' => array(
+        'offset' => -39600000,
+        'shortname' => 'GMT+11',
+        'dstshortname' => null,
+        'longname' => 'GMT-11:00'),
+    'Etc/GMT+12' => array(
+        'offset' => -43200000,
+        'shortname' => 'GMT+12',
+        'dstshortname' => null,
+        'longname' => 'GMT-12:00'),
+    'Etc/GMT+2' => array(
+        'offset' => -7200000,
+        'shortname' => 'GMT+2',
+        'dstshortname' => null,
+        'longname' => 'GMT-02:00'),
+    'Etc/GMT+3' => array(
+        'offset' => -10800000,
+        'shortname' => 'GMT+3',
+        'dstshortname' => null,
+        'longname' => 'GMT-03:00'),
+    'Etc/GMT+4' => array(
+        'offset' => -14400000,
+        'shortname' => 'GMT+4',
+        'dstshortname' => null,
+        'longname' => 'GMT-04:00'),
+    'Etc/GMT+5' => array(
+        'offset' => -18000000,
+        'shortname' => 'GMT+5',
+        'dstshortname' => null,
+        'longname' => 'GMT-05:00'),
+    'Etc/GMT+6' => array(
+        'offset' => -21600000,
+        'shortname' => 'GMT+6',
+        'dstshortname' => null,
+        'longname' => 'GMT-06:00'),
+    'Etc/GMT+7' => array(
+        'offset' => -25200000,
+        'shortname' => 'GMT+7',
+        'dstshortname' => null,
+        'longname' => 'GMT-07:00'),
+    'Etc/GMT+8' => array(
+        'offset' => -28800000,
+        'shortname' => 'GMT+8',
+        'dstshortname' => null,
+        'longname' => 'GMT-08:00'),
+    'Etc/GMT+9' => array(
+        'offset' => -32400000,
+        'shortname' => 'GMT+9',
+        'dstshortname' => null,
+        'longname' => 'GMT-09:00'),
+    'Etc/GMT-0' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'GMT+00:00'),
+    'Etc/GMT-1' => array(
+        'offset' => 3600000,
+        'shortname' => 'GMT-1',
+        'dstshortname' => null,
+        'longname' => 'GMT+01:00'),
+    'Etc/GMT-10' => array(
+        'offset' => 36000000,
+        'shortname' => 'GMT-10',
+        'dstshortname' => null,
+        'longname' => 'GMT+10:00'),
+    'Etc/GMT-11' => array(
+        'offset' => 39600000,
+        'shortname' => 'GMT-11',
+        'dstshortname' => null,
+        'longname' => 'GMT+11:00'),
+    'Etc/GMT-12' => array(
+        'offset' => 43200000,
+        'shortname' => 'GMT-12',
+        'dstshortname' => null,
+        'longname' => 'GMT+12:00'),
+    'Etc/GMT-13' => array(
+        'offset' => 46800000,
+        'shortname' => 'GMT-13',
+        'dstshortname' => null,
+        'longname' => 'GMT+13:00'),
+    'Etc/GMT-14' => array(
+        'offset' => 50400000,
+        'shortname' => 'GMT-14',
+        'dstshortname' => null,
+        'longname' => 'GMT+14:00'),
+    'Etc/GMT-2' => array(
+        'offset' => 7200000,
+        'shortname' => 'GMT-2',
+        'dstshortname' => null,
+        'longname' => 'GMT+02:00'),
+    'Etc/GMT-3' => array(
+        'offset' => 10800000,
+        'shortname' => 'GMT-3',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:00'),
+    'Etc/GMT-4' => array(
+        'offset' => 14400000,
+        'shortname' => 'GMT-4',
+        'dstshortname' => null,
+        'longname' => 'GMT+04:00'),
+    'Etc/GMT-5' => array(
+        'offset' => 18000000,
+        'shortname' => 'GMT-5',
+        'dstshortname' => null,
+        'longname' => 'GMT+05:00'),
+    'Etc/GMT-6' => array(
+        'offset' => 21600000,
+        'shortname' => 'GMT-6',
+        'dstshortname' => null,
+        'longname' => 'GMT+06:00'),
+    'Etc/GMT-7' => array(
+        'offset' => 25200000,
+        'shortname' => 'GMT-7',
+        'dstshortname' => null,
+        'longname' => 'GMT+07:00'),
+    'Etc/GMT-8' => array(
+        'offset' => 28800000,
+        'shortname' => 'GMT-8',
+        'dstshortname' => null,
+        'longname' => 'GMT+08:00'),
+    'Etc/GMT-9' => array(
+        'offset' => 32400000,
+        'shortname' => 'GMT-9',
+        'dstshortname' => null,
+        'longname' => 'GMT+09:00'),
+    'Etc/GMT0' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'GMT+00:00'),
+    'Etc/Greenwich' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Etc/UCT' => array(
+        'offset' => 0,
+        'shortname' => 'UCT',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'Etc/UTC' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'Etc/Universal' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'Etc/Zulu' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'Europe/Amsterdam' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Andorra' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Athens' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Belfast' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Belgrade' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Berlin' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Bratislava' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Brussels' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Bucharest' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Budapest' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Chisinau' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Copenhagen' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Dublin' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'IST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'Irish Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Gibraltar' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Guernsey' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Helsinki' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Isle_of_Man' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Istanbul' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Jersey' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Kaliningrad' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 0),
+    'Europe/Kiev' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Lisbon' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Ljubljana' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/London' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Luxembourg' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Madrid' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Malta' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Mariehamn' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Minsk' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 0),
+    'Europe/Monaco' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Moscow' => array(
+        'offset' => 10800000,
+        'shortname' => 'MSK',
+        'dstshortname' => 'MSD',
+        'longname' => 'Moscow Standard Time',
+        'dstlongname' => 'Moscow Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -3600000),
+    'Europe/Nicosia' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Oslo' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Paris' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Podgorica' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Prague' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Riga' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Rome' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Samara' => array(
+        'offset' => 14400000,
+        'shortname' => 'SAMT',
+        'dstshortname' => 'SAMST',
+        'longname' => 'Samara Time',
+        'dstlongname' => 'Samara Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -7200000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -7200000),
+    'Europe/San_Marino' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Sarajevo' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Simferopol' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Skopje' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Sofia' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Stockholm' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Tallinn' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Tirane' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Tiraspol' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Uzhgorod' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Vaduz' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Vatican' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Vienna' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Vilnius' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Volgograd' => array(
+        'offset' => 10800000,
+        'shortname' => 'VOLT',
+        'dstshortname' => 'VOLST',
+        'longname' => 'Volograd Time',
+        'longname' => 'Volograd Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -3600000),
+    'Europe/Warsaw' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Zagreb' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Zaporozhye' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Europe/Zurich' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'GB' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'GB-Eire' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => 'BST',
+        'longname' => 'Greenwich Mean Time',
+        'dstlongname' => 'British Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'GMT' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'GMT+0' => array(
+        'offset' => 0,
+        'shortname' => 'GMT+0',
+        'dstshortname' => null),
+    'GMT+00:00' => array(
+        'offset' => 0,
+        'shortname' => 'GMT+00:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+00:00'),
+    'GMT+01:00' => array(
+        'offset' => 3600000,
+        'shortname' => 'GMT+01:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+01:00'),
+    'GMT+02:00' => array(
+        'offset' => 7200000,
+        'shortname' => 'GMT+02:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+02:00'),
+    'GMT+03:00' => array(
+        'offset' => 10800000,
+        'shortname' => 'GMT+03:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:00'),
+    'GMT+04:00' => array(
+        'offset' => 14400000,
+        'shortname' => 'GMT+04:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+04:00'),
+    'GMT+05:00' => array(
+        'offset' => 18000000,
+        'shortname' => 'GMT+05:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+05:00'),
+    'GMT+06:00' => array(
+        'offset' => 21600000,
+        'shortname' => 'GMT+06:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+06:00'),
+    'GMT+07:00' => array(
+        'offset' => 25200000,
+        'shortname' => 'GMT+07:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+07:00'),
+    'GMT+08:00' => array(
+        'offset' => 28800000,
+        'shortname' => 'GMT+08:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+08:00'),
+    'GMT+09:00' => array(
+        'offset' => 32400000,
+        'shortname' => 'GMT+09:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+09:00'),
+    'GMT+1' => array(
+        'offset' => 3600000,
+        'shortname' => 'GMT+1',
+        'dstshortname' => null),
+    'GMT+10' => array(
+        'offset' => 36000000,
+        'shortname' => 'GMT+10',
+        'dstshortname' => null),
+    'GMT+10:00' => array(
+        'offset' => 36000000,
+        'shortname' => 'GMT+10:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+10:00'),
+    'GMT+11' => array(
+        'offset' => 39600000,
+        'shortname' => 'GMT+11',
+        'dstshortname' => null),
+    'GMT+11:00' => array(
+        'offset' => 39600000,
+        'shortname' => 'GMT+11:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+11:00'),
+    'GMT+12' => array(
+        'offset' => 43200000,
+        'shortname' => 'GMT+12',
+        'dstshortname' => null),
+    'GMT+12:00' => array(
+        'offset' => 43200000,
+        'shortname' => 'GMT+12:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+12:00'),
+    'GMT+13' => array(
+        'offset' => 46800000,
+        'shortname' => 'GMT+13',
+        'dstshortname' => null),
+    'GMT+13:00' => array(
+        'offset' => 46800000,
+        'shortname' => 'GMT+13:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+13:00'),
+    'GMT+14' => array(
+        'offset' => 50400000,
+        'shortname' => 'GMT+14',
+        'dstshortname' => null),
+    'GMT+14:00' => array(
+        'offset' => 50400000,
+        'shortname' => 'GMT+14:00',
+        'dstshortname' => null,
+        'longname' => 'GMT+14:00'),
+    'GMT+2' => array(
+        'offset' => 7200000,
+        'shortname' => 'GMT+2',
+        'dstshortname' => null),
+    'GMT+3' => array(
+        'offset' => 10800000,
+        'shortname' => 'GMT+3',
+        'dstshortname' => null),
+    'GMT+4' => array(
+        'offset' => 14400000,
+        'shortname' => 'GMT+4',
+        'dstshortname' => null),
+    'GMT+5' => array(
+        'offset' => 18000000,
+        'shortname' => 'GMT+5',
+        'dstshortname' => null),
+    'GMT+6' => array(
+        'offset' => 21600000,
+        'shortname' => 'GMT+6',
+        'dstshortname' => null),
+    'GMT+7' => array(
+        'offset' => 25200000,
+        'shortname' => 'GMT+7',
+        'dstshortname' => null),
+    'GMT+8' => array(
+        'offset' => 28800000,
+        'shortname' => 'GMT+8',
+        'dstshortname' => null),
+    'GMT+9' => array(
+        'offset' => 32400000,
+        'shortname' => 'GMT+9',
+        'dstshortname' => null),
+    'GMT-0' => array(
+        'offset' => 0,
+        'shortname' => 'GMT-0',
+        'dstshortname' => null),
+    'GMT-00:00' => array(
+        'offset' => 0,
+        'shortname' => 'GMT-00:00',
+        'dstshortname' => null),
+    'GMT-01:00' => array(
+        'offset' => -3600000,
+        'shortname' => 'GMT-01:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-01:00'),
+    'GMT-02:00' => array(
+        'offset' => -7200000,
+        'shortname' => 'GMT-02:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-02:00'),
+    'GMT-03:00' => array(
+        'offset' => -10800000,
+        'shortname' => 'GMT-03:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-03:00'),
+    'GMT-04:00' => array(
+        'offset' => -14400000,
+        'shortname' => 'GMT-04:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-04:00'),
+    'GMT-05:00' => array(
+        'offset' => -18000000,
+        'shortname' => 'GMT-05:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-05:00'),
+    'GMT-06:00' => array(
+        'offset' => -21600000,
+        'shortname' => 'GMT-06:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-06:00'),
+    'GMT-07:00' => array(
+        'offset' => -25200000,
+        'shortname' => 'GMT-07:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-07:00'),
+    'GMT-08:00' => array(
+        'offset' => -28800000,
+        'shortname' => 'GMT-08:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-08:00'),
+    'GMT-09:00' => array(
+        'offset' => -32400000,
+        'shortname' => 'GMT-09:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-09:00'),
+    'GMT-1' => array(
+        'offset' => -3600000,
+        'shortname' => 'GMT-1',
+        'dstshortname' => null),
+    'GMT-10' => array(
+        'offset' => -36000000,
+        'shortname' => 'GMT-10',
+        'dstshortname' => null),
+    'GMT-10:00' => array(
+        'offset' => -36000000,
+        'shortname' => 'GMT-10:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-10:00'),
+    'GMT-11' => array(
+        'offset' => -39600000,
+        'shortname' => 'GMT-11',
+        'dstshortname' => null),
+    'GMT-11:00' => array(
+        'offset' => -39600000,
+        'shortname' => 'GMT-11:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-11:00'),
+    'GMT-12' => array(
+        'offset' => -43200000,
+        'shortname' => 'GMT-12',
+        'dstshortname' => null),
+    'GMT-12:00' => array(
+        'offset' => -43200000,
+        'shortname' => 'GMT-12:00',
+        'dstshortname' => null,
+        'longname' => 'GMT-12:00'),
+    'GMT-2' => array(
+        'offset' => -7200000,
+        'shortname' => 'GMT-2',
+        'dstshortname' => null),
+    'GMT-3' => array(
+        'offset' => -10800000,
+        'shortname' => 'GMT-3',
+        'dstshortname' => null),
+    'GMT-4' => array(
+        'offset' => -14400000,
+        'shortname' => 'GMT-4',
+        'dstshortname' => null),
+    'GMT-5' => array(
+        'offset' => -18000000,
+        'shortname' => 'GMT-5',
+        'dstshortname' => null),
+    'GMT-6' => array(
+        'offset' => -21600000,
+        'shortname' => 'GMT-6',
+        'dstshortname' => null),
+    'GMT-7' => array(
+        'offset' => -25200000,
+        'shortname' => 'GMT-7',
+        'dstshortname' => null),
+    'GMT-8' => array(
+        'offset' => -28800000,
+        'shortname' => 'GMT-8',
+        'dstshortname' => null),
+    'GMT-9' => array(
+        'offset' => -32400000,
+        'shortname' => 'GMT-9',
+        'dstshortname' => null),
+    'GMT0' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'GMT+00:00'),
+    'Greenwich' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'HST' => array(
+        'offset' => -36000000,
+        'shortname' => 'HST',
+        'dstshortname' => null,
+        'longname' => 'Hawaii Standard Time'),
+    'Hongkong' => array(
+        'offset' => 28800000,
+        'shortname' => 'HKT',
+        'dstshortname' => null,
+        'longname' => 'Hong Kong Time'),
+    'Iceland' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'dstshortname' => null,
+        'longname' => 'Greenwich Mean Time'),
+    'Indian/Antananarivo' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Indian/Chagos' => array(
+        'offset' => 21600000,
+        'shortname' => 'IOT',
+        'dstshortname' => null,
+        'longname' => 'Indian Ocean Territory Time'),
+    'Indian/Christmas' => array(
+        'offset' => 25200000,
+        'shortname' => 'CXT',
+        'dstshortname' => null,
+        'longname' => 'Christmas Island Time'),
+    'Indian/Cocos' => array(
+        'offset' => 23400000,
+        'shortname' => 'CCT',
+        'dstshortname' => null,
+        'longname' => 'Cocos Islands Time'),
+    'Indian/Comoro' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Indian/Kerguelen' => array(
+        'offset' => 18000000,
+        'shortname' => 'TFT',
+        'dstshortname' => null,
+        'longname' => 'French Southern & Antarctic Lands Time'),
+    'Indian/Mahe' => array(
+        'offset' => 14400000,
+        'shortname' => 'SCT',
+        'dstshortname' => null,
+        'longname' => 'Seychelles Time'),
+    'Indian/Maldives' => array(
+        'offset' => 18000000,
+        'shortname' => 'MVT',
+        'dstshortname' => null,
+        'longname' => 'Maldives Time'),
+    'Indian/Mauritius' => array(
+        'offset' => 14400000,
+        'shortname' => 'MUT',
+        'dstshortname' => null,
+        'longname' => 'Mauritius Time'),
+    'Indian/Mayotte' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'dstshortname' => null,
+        'longname' => 'Eastern African Time'),
+    'Indian/Reunion' => array(
+        'offset' => 14400000,
+        'shortname' => 'RET',
+        'dstshortname' => null,
+        'longname' => 'Reunion Time'),
+    'Iran' => array(
+        'offset' => 12600000,
+        'shortname' => 'IRST',
+        'dstshortname' => 'IRDT',
+        'longname' => 'Iran Time',
+        'dstlongname' => 'Iran Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => '21',
+        'summertimestarttime' => -12600000,
+        'summertimeendmonth' => 9,
+        'summertimeendday' => '21',
+        'summertimeendtime' => -16200000),
+    'Israel' => array(
+        'offset' => 7200000,
+        'shortname' => 'IST',
+        'dstshortname' => 'IDT',
+        'longname' => 'Israel Standard Time',
+        'dstlongname' => 'Israel Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Fri>=26',
+        'summertimestarttime' => 0,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => '5',
+        'summertimeendtime' => -3600000),
+    'Jamaica' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => null,
+        'longname' => 'Eastern Standard Time'),
+    'Japan' => array(
+        'offset' => 32400000,
+        'shortname' => 'JST',
+        'dstshortname' => null,
+        'longname' => 'Japan Standard Time'),
+    'Kwajalein' => array(
+        'offset' => 43200000,
+        'shortname' => 'MHT',
+        'dstshortname' => null,
+        'longname' => 'Marshall Islands Time'),
+    'Libya' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => null,
+        'longname' => 'Eastern European Time'),
+    'MET' => array(
+        'offset' => 3600000,
+        'shortname' => 'MET',
+        'dstshortname' => 'MEST',
+        'longname' => 'Middle Europe Time',
+        'dstlongname' => 'Middle Europe Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'MST' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => null,
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time'),
+    'MST7MDT' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'Mexico/BajaNorte' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 32400000),
+    'Mexico/BajaSur' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 28800000),
+    'Mexico/General' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'Sun>=1',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 25200000),
+    'Mideast/Riyadh87' => array(
+        'offset' => 11224000,
+        'shortname' => '',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:07'),
+    'Mideast/Riyadh88' => array(
+        'offset' => 11224000,
+        'shortname' => '',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:07'),
+    'Mideast/Riyadh89' => array(
+        'offset' => 11224000,
+        'shortname' => '',
+        'dstshortname' => null,
+        'longname' => 'GMT+03:07'),
+    'NZ' => array(
+        'offset' => 43200000,
+        'shortname' => 'NZST',
+        'dstshortname' => 'NZDT',
+        'longname' => 'New Zealand Standard Time',
+        'dstlongname' => 'New Zealand Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -36000000),
+    'NZ-CHAT' => array(
+        'offset' => 45900000,
+        'shortname' => 'CHAST',
+        'dstshortname' => 'CHADT',
+        'longname' => 'Chatham Standard Time',
+        'dstlongname' => 'Chatham Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -36000000),
+    'Navajo' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'PRC' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null,
+        'longname' => 'China Standard Time'),
+    'PST8PDT' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'Pacific/Apia' => array(
+        'offset' => -39600000,
+        'shortname' => 'WST',
+        'dstshortname' => null,
+        'longname' => 'West Samoa Time'),
+    'Pacific/Auckland' => array(
+        'offset' => 43200000,
+        'shortname' => 'NZST',
+        'dstshortname' => 'NZDT',
+        'longname' => 'New Zealand Standard Time',
+        'dstlongname' => 'New Zealand Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -36000000),
+    'Pacific/Chatham' => array(
+        'offset' => 45900000,
+        'shortname' => 'CHAST',
+        'dstshortname' => 'CHADT',
+        'longname' => 'Chatham Standard Time',
+        'dstlongname' => 'Chatham Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 9,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -36000000,
+        'summertimeendmonth' => 4,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => -36000000),
+    'Pacific/Easter' => array(
+        'offset' => -21600000,
+        'shortname' => 'EAST',
+        'dstshortname' => 'EASST',
+        'longname' => 'Easter Is. Time',
+        'dstlongname' => 'Easter Is. Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 10,
+        'summertimestartday' => 'Sun>=9',
+        'summertimestarttime' => 14400000,
+        'summertimeendmonth' => 3,
+        'summertimeendday' => '30',
+        'summertimeendtime' => 10800000),
+    'Pacific/Efate' => array(
+        'offset' => 39600000,
+        'shortname' => 'VUT',
+        'dstshortname' => null,
+        'longname' => 'Vanuatu Time'),
+    'Pacific/Enderbury' => array(
+        'offset' => 46800000,
+        'shortname' => 'PHOT',
+        'dstshortname' => null,
+        'longname' => 'Phoenix Is. Time'),
+    'Pacific/Fakaofo' => array(
+        'offset' => -36000000,
+        'shortname' => 'TKT',
+        'dstshortname' => null,
+        'longname' => 'Tokelau Time'),
+    'Pacific/Fiji' => array(
+        'offset' => 43200000,
+        'shortname' => 'FJT',
+        'dstshortname' => null,
+        'longname' => 'Fiji Time'),
+    'Pacific/Funafuti' => array(
+        'offset' => 43200000,
+        'shortname' => 'TVT',
+        'dstshortname' => null,
+        'longname' => 'Tuvalu Time'),
+    'Pacific/Galapagos' => array(
+        'offset' => -21600000,
+        'shortname' => 'GALT',
+        'dstshortname' => null,
+        'longname' => 'Galapagos Time'),
+    'Pacific/Gambier' => array(
+        'offset' => -32400000,
+        'shortname' => 'GAMT',
+        'dstshortname' => null,
+        'longname' => 'Gambier Time'),
+    'Pacific/Guadalcanal' => array(
+        'offset' => 39600000,
+        'shortname' => 'SBT',
+        'dstshortname' => null,
+        'longname' => 'Solomon Is. Time'),
+    'Pacific/Guam' => array(
+        'offset' => 36000000,
+        'shortname' => 'ChST',
+        'dstshortname' => null,
+        'longname' => 'Chamorro Standard Time'),
+    'Pacific/Honolulu' => array(
+        'offset' => -36000000,
+        'shortname' => 'HST',
+        'dstshortname' => null,
+        'longname' => 'Hawaii Standard Time'),
+    'Pacific/Johnston' => array(
+        'offset' => -36000000,
+        'shortname' => 'HST',
+        'dstshortname' => null,
+        'longname' => 'Hawaii Standard Time'),
+    'Pacific/Kiritimati' => array(
+        'offset' => 50400000,
+        'shortname' => 'LINT',
+        'dstshortname' => null,
+        'longname' => 'Line Is. Time'),
+    'Pacific/Kosrae' => array(
+        'offset' => 39600000,
+        'shortname' => 'KOST',
+        'dstshortname' => null,
+        'longname' => 'Kosrae Time'),
+    'Pacific/Kwajalein' => array(
+        'offset' => 43200000,
+        'shortname' => 'MHT',
+        'dstshortname' => null,
+        'longname' => 'Marshall Islands Time'),
+    'Pacific/Majuro' => array(
+        'offset' => 43200000,
+        'shortname' => 'MHT',
+        'dstshortname' => null,
+        'longname' => 'Marshall Islands Time'),
+    'Pacific/Marquesas' => array(
+        'offset' => -34200000,
+        'shortname' => 'MART',
+        'dstshortname' => null,
+        'longname' => 'Marquesas Time'),
+    'Pacific/Midway' => array(
+        'offset' => -39600000,
+        'shortname' => 'SST',
+        'dstshortname' => null,
+        'longname' => 'Samoa Standard Time'),
+    'Pacific/Nauru' => array(
+        'offset' => 43200000,
+        'shortname' => 'NRT',
+        'dstshortname' => null,
+        'longname' => 'Nauru Time'),
+    'Pacific/Niue' => array(
+        'offset' => -39600000,
+        'shortname' => 'NUT',
+        'dstshortname' => null,
+        'longname' => 'Niue Time'),
+    'Pacific/Norfolk' => array(
+        'offset' => 41400000,
+        'shortname' => 'NFT',
+        'dstshortname' => null,
+        'longname' => 'Norfolk Time'),
+    'Pacific/Noumea' => array(
+        'offset' => 39600000,
+        'shortname' => 'NCT',
+        'dstshortname' => null,
+        'longname' => 'New Caledonia Time'),
+    'Pacific/Pago_Pago' => array(
+        'offset' => -39600000,
+        'shortname' => 'SST',
+        'dstshortname' => null,
+        'longname' => 'Samoa Standard Time'),
+    'Pacific/Palau' => array(
+        'offset' => 32400000,
+        'shortname' => 'PWT',
+        'dstshortname' => null,
+        'longname' => 'Palau Time'),
+    'Pacific/Pitcairn' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => null,
+        'longname' => 'Pitcairn Standard Time'),
+    'Pacific/Ponape' => array(
+        'offset' => 39600000,
+        'shortname' => 'PONT',
+        'dstshortname' => null,
+        'longname' => 'Ponape Time'),
+    'Pacific/Port_Moresby' => array(
+        'offset' => 36000000,
+        'shortname' => 'PGT',
+        'dstshortname' => null,
+        'longname' => 'Papua New Guinea Time'),
+    'Pacific/Rarotonga' => array(
+        'offset' => -36000000,
+        'shortname' => 'CKT',
+        'dstshortname' => null,
+        'longname' => 'Cook Is. Time'),
+    'Pacific/Saipan' => array(
+        'offset' => 36000000,
+        'shortname' => 'ChST',
+        'dstshortname' => null,
+        'longname' => 'Chamorro Standard Time'),
+    'Pacific/Samoa' => array(
+        'offset' => -39600000,
+        'shortname' => 'SST',
+        'dstshortname' => null,
+        'longname' => 'Samoa Standard Time'),
+    'Pacific/Tahiti' => array(
+        'offset' => -36000000,
+        'shortname' => 'TAHT',
+        'dstshortname' => null,
+        'longname' => 'Tahiti Time'),
+    'Pacific/Tarawa' => array(
+        'offset' => 43200000,
+        'shortname' => 'GILT',
+        'dstshortname' => null,
+        'longname' => 'Gilbert Is. Time'),
+    'Pacific/Tongatapu' => array(
+        'offset' => 46800000,
+        'shortname' => 'TOT',
+        'dstshortname' => null,
+        'longname' => 'Tonga Time'),
+    'Pacific/Truk' => array(
+        'offset' => 36000000,
+        'shortname' => 'TRUT',
+        'dstshortname' => null,
+        'longname' => 'Truk Time'),
+    'Pacific/Wake' => array(
+        'offset' => 43200000,
+        'shortname' => 'WAKT',
+        'dstshortname' => null,
+        'longname' => 'Wake Time'),
+    'Pacific/Wallis' => array(
+        'offset' => 43200000,
+        'shortname' => 'WFT',
+        'dstshortname' => null,
+        'longname' => 'Wallis & Futuna Time'),
+    'Pacific/Yap' => array(
+        'offset' => 36000000,
+        'shortname' => 'TRUT',
+        'dstshortname' => null,
+        'longname' => 'Yap Time'),
+    'Poland' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Portugal' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'ROC' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'dstshortname' => null),
+    'ROK' => array(
+        'offset' => 32400000,
+        'shortname' => 'KST',
+        'dstshortname' => null,
+        'longname' => 'Korea Standard Time'),
+    'Singapore' => array(
+        'offset' => 28800000,
+        'shortname' => 'SGT',
+        'dstshortname' => null,
+        'longname' => 'Singapore Time'),
+    'Turkey' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'UCT' => array(
+        'offset' => 0,
+        'shortname' => 'UCT',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'US/Alaska' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 39600000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 36000000),
+    'US/Aleutian' => array(
+        'offset' => -36000000,
+        'shortname' => 'HAST',
+        'dstshortname' => 'HADT',
+        'longname' => 'Hawaii-Aleutian Standard Time',
+        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 43200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 39600000),
+    'US/Arizona' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => null,
+        'longname' => 'Mountain Standard Time'),
+    'US/Central' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'US/East-Indiana' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'US/Eastern' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'US/Hawaii' => array(
+        'offset' => -36000000,
+        'shortname' => 'HST',
+        'dstshortname' => null,
+        'longname' => 'Hawaii Standard Time'),
+    'US/Indiana-Starke' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 28800000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 25200000),
+    'US/Michigan' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 25200000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 21600000),
+    'US/Mountain' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 32400000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 28800000),
+    'US/Pacific' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'US/Pacific-New' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'Sun>=8',
+        'summertimestarttime' => 36000000,
+        'summertimeendmonth' => 11,
+        'summertimeendday' => 'Sun>=1',
+        'summertimeendtime' => 32400000),
+    'US/Samoa' => array(
+        'offset' => -39600000,
+        'shortname' => 'SST',
+        'dstshortname' => null,
+        'longname' => 'Samoa Standard Time'),
+    'UTC' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'Universal' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    'W-SU' => array(
+        'offset' => 10800000,
+        'shortname' => 'MSK',
+        'dstshortname' => 'MSD',
+        'longname' => 'Moscow Standard Time',
+        'dstlongname' => 'Moscow Daylight Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => -3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => -3600000),
+    'WET' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time',
+        'summertimeoffset' => 3600000,
+        'summertimestartmonth' => 3,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 3600000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 3600000),
+    'Zulu' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'dstshortname' => null,
+        'longname' => 'Coordinated Universal Time'),
+    //
+    // Following time-zones are the long names for the time-zones above, thus N.B.
+    // that the Summer-Time for each zone cannot really be reliable, because two
+    // zones may share the same zone name, but differ in Summer-Time arrangements;
+    // and also that the data cannot be maintained as easily and thus may also
+    // be inaccurate or out-of-date
+    //
+    'ACT' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'longname' => 'Central Standard Time (Northern Territory)'),
+    'AET' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (New South Wales)',
+        'dstlongname' => 'Eastern Summer Time (New South Wales)'),
+    'AGT' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'longname' => 'Argentine Time'),
+    'ART' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time'),
+    'AST' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time'),
+    'Acre Time' => array(
+        'offset' => -18000000,
+        'shortname' => 'ACT',
+        'longname' => 'Acre Time'),
+    'Afghanistan Time' => array(
+        'offset' => 16200000,
+        'shortname' => 'AFT',
+        'longname' => 'Afghanistan Time'),
+    'Alaska Standard Time' => array(
+        'offset' => -32400000,
+        'shortname' => 'AKST',
+        'dstshortname' => 'AKDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time'),
+    'Alma-Ata Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'ALMT',
+        'dstshortname' => 'ALMST',
+        'longname' => 'Alma-Ata Time',
+        'dstlongname' => 'Alma-Ata Summer Time'),
+    'Amazon Standard Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'AMT',
+        'longname' => 'Amazon Standard Time'),
+    'Anadyr Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'ANAT',
+        'dstshortname' => 'ANAST',
+        'longname' => 'Anadyr Time',
+        'dstlongname' => 'Anadyr Summer Time'),
+    'Aqtau Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'AQTT',
+        'dstshortname' => 'AQTST',
+        'longname' => 'Aqtau Time',
+        'dstlongname' => 'Aqtau Summer Time'),
+    'Aqtobe Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'AQTT',
+        'dstshortname' => 'AQTST',
+        'longname' => 'Aqtobe Time',
+        'dstlongname' => 'Aqtobe Summer Time'),
+    'Arabia Standard Time' => array(
+        'offset' => 10800000,
+        'shortname' => 'AST',
+        'longname' => 'Arabia Standard Time'),
+    'Argentine Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'ART',
+        'longname' => 'Argentine Time'),
+    'Armenia Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => 'AMST',
+        'longname' => 'Armenia Time',
+        'dstlongname' => 'Armenia Summer Time'),
+    'Atlantic Standard Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time'),
+    'Azerbaijan Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'AZT',
+        'dstshortname' => 'AZST',
+        'longname' => 'Azerbaijan Time',
+        'dstlongname' => 'Azerbaijan Summer Time'),
+    'Azores Time' => array(
+        'offset' => -3600000,
+        'shortname' => 'AZOT',
+        'dstshortname' => 'AZOST',
+        'longname' => 'Azores Time',
+        'dstlongname' => 'Azores Summer Time'),
+    'BDT' => array(
+        'offset' => 21600000,
+        'shortname' => 'BDT',
+        'longname' => 'Bangladesh Time'),
+    'BET' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => 'BRST',
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time'),
+    'Bangladesh Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'BDT',
+        'longname' => 'Bangladesh Time'),
+    'Bhutan Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'BTT',
+        'longname' => 'Bhutan Time'),
+    'Bolivia Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'BOT',
+        'longname' => 'Bolivia Time'),
+    'Brazil Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'BRT',
+        'dstshortname' => 'BRST',
+        'longname' => 'Brazil Time',
+        'dstlongname' => 'Brazil Summer Time'),
+    'Brunei Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'BNT',
+        'longname' => 'Brunei Time'),
+    'CAT' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'longname' => 'Central African Time'),
+    'CEST' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time'),
+    'CNT' => array(
+        'offset' => -12600000,
+        'shortname' => 'NST',
+        'dstshortname' => 'NDT',
+        'longname' => 'Newfoundland Standard Time',
+        'dstlongname' => 'Newfoundland Daylight Time'),
+    'CST' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time'),
+    'CTT' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'longname' => 'China Standard Time'),
+    'Cape Verde Time' => array(
+        'offset' => -3600000,
+        'shortname' => 'CVT',
+        'longname' => 'Cape Verde Time'),
+    'Central African Time' => array(
+        'offset' => 7200000,
+        'shortname' => 'CAT',
+        'longname' => 'Central African Time'),
+    'Central European Time' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time'),
+    'Central Indonesia Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'CIT',
+        'longname' => 'Central Indonesia Time'),
+    'Central Standard Time' => array(
+        'offset' => -18000000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time'),
+    'Central Standard Time (Northern Territory)' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'longname' => 'Central Standard Time (Northern Territory)'),
+    'Central Standard Time (South Australia)' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CST',
+        'longname' => 'Central Standard Time (South Australia)',
+        'dstlongname' => 'Central Summer Time (South Australia)'),
+    'Central Standard Time (South Australia/New South Wales)' => array(
+        'offset' => 34200000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CST',
+        'longname' => 'Central Standard Time (South Australia/New South Wales)',
+        'dstlongname' => 'Central Summer Time (South Australia/New South Wales)'),
+    'Chamorro Standard Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'ChST',
+        'longname' => 'Chamorro Standard Time'),
+    'Chatham Standard Time' => array(
+        'offset' => 45900000,
+        'shortname' => 'CHAST',
+        'dstshortname' => 'CHADT',
+        'longname' => 'Chatham Standard Time',
+        'dstlongname' => 'Chatham Daylight Time'),
+    'Chile Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'CLT',
+        'dstshortname' => 'CLST',
+        'longname' => 'Chile Time',
+        'dstlongname' => 'Chile Summer Time'),
+    'China Standard Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'CST',
+        'longname' => 'China Standard Time'),
+    'Choibalsan Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'CHOT',
+        'longname' => 'Choibalsan Time'),
+    'Christmas Island Time' => array(
+        'offset' => 25200000,
+        'shortname' => 'CXT',
+        'longname' => 'Christmas Island Time'),
+    'Cocos Islands Time' => array(
+        'offset' => 23400000,
+        'shortname' => 'CCT',
+        'longname' => 'Cocos Islands Time'),
+    'Colombia Time' => array(
+        'offset' => -18000000,
+        'shortname' => 'COT',
+        'longname' => 'Colombia Time'),
+    'Cook Is. Time' => array(
+        'offset' => -36000000,
+        'shortname' => 'CKT',
+        'longname' => 'Cook Is. Time'),
+    'Coordinated Universal Time' => array(
+        'offset' => 0,
+        'shortname' => 'UTC',
+        'longname' => 'Coordinated Universal Time'),
+    'Davis Time' => array(
+        'offset' => 25200000,
+        'shortname' => 'DAVT',
+        'longname' => 'Davis Time'),
+    'Dumont-d\'Urville Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'DDUT',
+        'longname' => 'Dumont-d\'Urville Time'),
+    'EAT' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'longname' => 'Eastern African Time'),
+    'ECT' => array(
+        'offset' => 3600000,
+        'shortname' => 'CET',
+        'dstshortname' => 'CEST',
+        'longname' => 'Central European Time',
+        'dstlongname' => 'Central European Summer Time'),
+    'East Indonesia Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'EIT',
+        'longname' => 'East Indonesia Time'),
+    'East Timor Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'TPT',
+        'longname' => 'East Timor Time'),
+    'Easter Is. Time' => array(
+        'offset' => -21600000,
+        'shortname' => 'EAST',
+        'dstshortname' => 'EASST',
+        'longname' => 'Easter Is. Time',
+        'dstlongname' => 'Easter Is. Summer Time'),
+    'Eastern African Time' => array(
+        'offset' => 10800000,
+        'shortname' => 'EAT',
+        'longname' => 'Eastern African Time'),
+    'Eastern European Time' => array(
+        'offset' => 7200000,
+        'shortname' => 'EET',
+        'dstshortname' => 'EEST',
+        'longname' => 'Eastern European Time',
+        'dstlongname' => 'Eastern European Summer Time'),
+    'Eastern Greenland Time' => array(
+        'offset' => 3600000,
+        'shortname' => 'EGT',
+        'dstshortname' => 'EGST',
+        'longname' => 'Eastern Greenland Time',
+        'dstlongname' => 'Eastern Greenland Summer Time'),
+    'Eastern Standard Time' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time'),
+    'Eastern Standard Time (New South Wales)' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (New South Wales)',
+        'dstlongname' => 'Eastern Summer Time (New South Wales)'),
+    'Eastern Standard Time (Queensland)' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Queensland)'),
+    'Eastern Standard Time (Tasmania)' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Tasmania)',
+        'dstlongname' => 'Eastern Summer Time (Tasmania)'),
+    'Eastern Standard Time (Victoria)' => array(
+        'offset' => 36000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EST',
+        'longname' => 'Eastern Standard Time (Victoria)',
+        'dstlongname' => 'Eastern Summer Time (Victoria)'),
+    'Ecuador Time' => array(
+        'offset' => -18000000,
+        'shortname' => 'ECT',
+        'longname' => 'Ecuador Time'),
+    'Falkland Is. Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'FKT',
+        'dstshortname' => 'FKST',
+        'longname' => 'Falkland Is. Time',
+        'dstlongname' => 'Falkland Is. Summer Time'),
+    'Fernando de Noronha Time' => array(
+        'offset' => -7200000,
+        'shortname' => 'FNT',
+        'longname' => 'Fernando de Noronha Time'),
+    'Fiji Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'FJT',
+        'longname' => 'Fiji Time'),
+    'French Guiana Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'GFT',
+        'longname' => 'French Guiana Time'),
+    'French Southern & Antarctic Lands Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'TFT',
+        'longname' => 'French Southern & Antarctic Lands Time'),
+    'GMT+03:07' => array(
+        'offset' => 11224000,
+        'shortname' => 'GMT+03:07',
+        'longname' => 'GMT+03:07'),
+    'Galapagos Time' => array(
+        'offset' => -21600000,
+        'shortname' => 'GALT',
+        'longname' => 'Galapagos Time'),
+    'Gambier Time' => array(
+        'offset' => -32400000,
+        'shortname' => 'GAMT',
+        'longname' => 'Gambier Time'),
+    'Georgia Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'GET',
+        'dstshortname' => 'GEST',
+        'longname' => 'Georgia Time',
+        'dstlongname' => 'Georgia Summer Time'),
+    'Gilbert Is. Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'GILT',
+        'longname' => 'Gilbert Is. Time'),
+    'Greenwich Mean Time' => array(
+        'offset' => 0,
+        'shortname' => 'GMT',
+        'longname' => 'Greenwich Mean Time'),
+    'Gulf Standard Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'GST',
+        'longname' => 'Gulf Standard Time'),
+    'Guyana Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'GYT',
+        'longname' => 'Guyana Time'),
+    'Hawaii Standard Time' => array(
+        'offset' => -36000000,
+        'shortname' => 'HST',
+        'longname' => 'Hawaii Standard Time'),
+    'Hawaii-Aleutian Standard Time' => array(
+        'offset' => -36000000,
+        'shortname' => 'HAST',
+        'dstshortname' => 'HADT',
+        'longname' => 'Hawaii-Aleutian Standard Time',
+        'dstlongname' => 'Hawaii-Aleutian Daylight Time'),
+    'Hong Kong Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'HKT',
+        'longname' => 'Hong Kong Time'),
+    'Hovd Time' => array(
+        'offset' => 25200000,
+        'shortname' => 'HOVT',
+        'longname' => 'Hovd Time'),
+    'IET' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'longname' => 'Eastern Standard Time'),
+    'IST' => array(
+        'offset' => 19800000,
+        'shortname' => 'IST',
+        'longname' => 'India Standard Time'),
+    'India Standard Time' => array(
+        'offset' => 19800000,
+        'shortname' => 'IST',
+        'longname' => 'India Standard Time'),
+    'Indian Ocean Territory Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'IOT',
+        'longname' => 'Indian Ocean Territory Time'),
+    'Indochina Time' => array(
+        'offset' => 25200000,
+        'shortname' => 'ICT',
+        'longname' => 'Indochina Time'),
+    'Iran Time' => array(
+        'offset' => 12600000,
+        'shortname' => 'IRT',
+        'dstshortname' => 'IRST',
+        'longname' => 'Iran Time',
+        'dstlongname' => 'Iran Summer Time'),
+    'Irkutsk Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'IRKT',
+        'dstshortname' => 'IRKST',
+        'longname' => 'Irkutsk Time',
+        'dstlongname' => 'Irkutsk Summer Time'),
+    'Israel Standard Time' => array(
+        'offset' => 7200000,
+        'shortname' => 'IST',
+        'dstshortname' => 'IDT',
+        'longname' => 'Israel Standard Time',
+        'dstlongname' => 'Israel Daylight Time'),
+    'JST' => array(
+        'offset' => 32400000,
+        'shortname' => 'JST',
+        'longname' => 'Japan Standard Time'),
+    'Japan Standard Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'JST',
+        'longname' => 'Japan Standard Time'),
+    'Kirgizstan Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'KGT',
+        'dstshortname' => 'KGST',
+        'longname' => 'Kirgizstan Time',
+        'dstlongname' => 'Kirgizstan Summer Time'),
+    'Korea Standard Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'KST',
+        'longname' => 'Korea Standard Time'),
+    'Kosrae Time' => array(
+        'offset' => 39600000,
+        'shortname' => 'KOST',
+        'longname' => 'Kosrae Time'),
+    'Krasnoyarsk Time' => array(
+        'offset' => 25200000,
+        'shortname' => 'KRAT',
+        'dstshortname' => 'KRAST',
+        'longname' => 'Krasnoyarsk Time',
+        'dstlongname' => 'Krasnoyarsk Summer Time'),
+    'Line Is. Time' => array(
+        'offset' => 50400000,
+        'shortname' => 'LINT',
+        'longname' => 'Line Is. Time'),
+    'Load Howe Standard Time' => array(
+        'offset' => 37800000,
+        'shortname' => 'LHST',
+        'dstshortname' => 'LHST',
+        'longname' => 'Load Howe Standard Time',
+        'dstlongname' => 'Load Howe Summer Time'),
+    'MIT' => array(
+        'offset' => -39600000,
+        'shortname' => 'WST',
+        'longname' => 'West Samoa Time'),
+    'Magadan Time' => array(
+        'offset' => 39600000,
+        'shortname' => 'MAGT',
+        'dstshortname' => 'MAGST',
+        'longname' => 'Magadan Time',
+        'dstlongname' => 'Magadan Summer Time'),
+    'Malaysia Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'MYT',
+        'longname' => 'Malaysia Time'),
+    'Maldives Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'MVT',
+        'longname' => 'Maldives Time'),
+    'Marquesas Time' => array(
+        'offset' => -34200000,
+        'shortname' => 'MART',
+        'longname' => 'Marquesas Time'),
+    'Marshall Islands Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'MHT',
+        'longname' => 'Marshall Islands Time'),
+    'Mauritius Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'MUT',
+        'longname' => 'Mauritius Time'),
+    'Mawson Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'MAWT',
+        'longname' => 'Mawson Time'),
+    'Middle Europe Time' => array(
+        'offset' => 3600000,
+        'shortname' => 'MET',
+        'dstshortname' => 'MEST',
+        'longname' => 'Middle Europe Time',
+        'dstlongname' => 'Middle Europe Summer Time'),
+    'Moscow Standard Time' => array(
+        'offset' => 10800000,
+        'shortname' => 'MSK',
+        'dstshortname' => 'MSD',
+        'longname' => 'Moscow Standard Time',
+        'dstlongname' => 'Moscow Daylight Time'),
+    'Mountain Standard Time' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time'),
+    'Myanmar Time' => array(
+        'offset' => 23400000,
+        'shortname' => 'MMT',
+        'longname' => 'Myanmar Time'),
+    'NET' => array(
+        'offset' => 14400000,
+        'shortname' => 'AMT',
+        'dstshortname' => 'AMST',
+        'longname' => 'Armenia Time',
+        'dstlongname' => 'Armenia Summer Time'),
+    'NST' => array(
+        'offset' => 43200000,
+        'shortname' => 'NZST',
+        'dstshortname' => 'NZDT',
+        'longname' => 'New Zealand Standard Time',
+        'dstlongname' => 'New Zealand Daylight Time'),
+    'Nauru Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'NRT',
+        'longname' => 'Nauru Time'),
+    'Nepal Time' => array(
+        'offset' => 20700000,
+        'shortname' => 'NPT',
+        'longname' => 'Nepal Time'),
+    'New Caledonia Time' => array(
+        'offset' => 39600000,
+        'shortname' => 'NCT',
+        'longname' => 'New Caledonia Time'),
+    'New Zealand Standard Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'NZST',
+        'dstshortname' => 'NZDT',
+        'longname' => 'New Zealand Standard Time',
+        'dstlongname' => 'New Zealand Daylight Time'),
+    'Newfoundland Standard Time' => array(
+        'offset' => -12600000,
+        'shortname' => 'NST',
+        'dstshortname' => 'NDT',
+        'longname' => 'Newfoundland Standard Time',
+        'dstlongname' => 'Newfoundland Daylight Time'),
+    'Niue Time' => array(
+        'offset' => -39600000,
+        'shortname' => 'NUT',
+        'longname' => 'Niue Time'),
+    'Norfolk Time' => array(
+        'offset' => 41400000,
+        'shortname' => 'NFT',
+        'longname' => 'Norfolk Time'),
+    'Novosibirsk Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'NOVT',
+        'dstshortname' => 'NOVST',
+        'longname' => 'Novosibirsk Time',
+        'dstlongname' => 'Novosibirsk Summer Time'),
+    'Omsk Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'OMST',
+        'dstshortname' => 'OMSST',
+        'longname' => 'Omsk Time',
+        'dstlongname' => 'Omsk Summer Time'),
+    'PLT' => array(
+        'offset' => 18000000,
+        'shortname' => 'PKT',
+        'longname' => 'Pakistan Time'),
+    'PNT' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'longname' => 'Mountain Standard Time'),
+    'PRT' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'longname' => 'Atlantic Standard Time'),
+    'PST' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time'),
+    'Pacific Standard Time' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time'),
+    'Pakistan Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'PKT',
+        'longname' => 'Pakistan Time'),
+    'Palau Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'PWT',
+        'longname' => 'Palau Time'),
+    'Papua New Guinea Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'PGT',
+        'longname' => 'Papua New Guinea Time'),
+    'Paraguay Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'PYT',
+        'dstshortname' => 'PYST',
+        'longname' => 'Paraguay Time',
+        'dstlongname' => 'Paraguay Summer Time'),
+    'Peru Time' => array(
+        'offset' => -18000000,
+        'shortname' => 'PET',
+        'longname' => 'Peru Time'),
+    'Petropavlovsk-Kamchatski Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'PETT',
+        'dstshortname' => 'PETST',
+        'longname' => 'Petropavlovsk-Kamchatski Time',
+        'dstlongname' => 'Petropavlovsk-Kamchatski Summer Time'),
+    'Philippines Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'PHT',
+        'longname' => 'Philippines Time'),
+    'Phoenix Is. Time' => array(
+        'offset' => 46800000,
+        'shortname' => 'PHOT',
+        'longname' => 'Phoenix Is. Time'),
+    'Pierre & Miquelon Standard Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'PMST',
+        'dstshortname' => 'PMDT',
+        'longname' => 'Pierre & Miquelon Standard Time',
+        'dstlongname' => 'Pierre & Miquelon Daylight Time'),
+    'Pitcairn Standard Time' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'longname' => 'Pitcairn Standard Time'),
+    'Ponape Time' => array(
+        'offset' => 39600000,
+        'shortname' => 'PONT',
+        'longname' => 'Ponape Time'),
+    'Reunion Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'RET',
+        'longname' => 'Reunion Time'),
+    'SST' => array(
+        'offset' => 39600000,
+        'shortname' => 'SBT',
+        'longname' => 'Solomon Is. Time'),
+    'Sakhalin Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'SAKT',
+        'dstshortname' => 'SAKST',
+        'longname' => 'Sakhalin Time',
+        'dstlongname' => 'Sakhalin Summer Time'),
+    'Samara Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'SAMT',
+        'dstshortname' => 'SAMST',
+        'longname' => 'Samara Time',
+        'dstlongname' => 'Samara Summer Time'),
+    'Samoa Standard Time' => array(
+        'offset' => -39600000,
+        'shortname' => 'SST',
+        'longname' => 'Samoa Standard Time'),
+    'Seychelles Time' => array(
+        'offset' => 14400000,
+        'shortname' => 'SCT',
+        'longname' => 'Seychelles Time'),
+    'Singapore Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'SGT',
+        'longname' => 'Singapore Time'),
+    'Solomon Is. Time' => array(
+        'offset' => 39600000,
+        'shortname' => 'SBT',
+        'longname' => 'Solomon Is. Time'),
+    'South Africa Standard Time' => array(
+        'offset' => 7200000,
+        'shortname' => 'SAST',
+        'longname' => 'South Africa Standard Time'),
+    'South Georgia Standard Time' => array(
+        'offset' => -7200000,
+        'shortname' => 'GST',
+        'longname' => 'South Georgia Standard Time'),
+    'Sri Lanka Time' => array(
+        'offset' => 21600000,
+        'shortname' => 'LKT',
+        'longname' => 'Sri Lanka Time'),
+    'Suriname Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'SRT',
+        'longname' => 'Suriname Time'),
+    'Syowa Time' => array(
+        'offset' => 10800000,
+        'shortname' => 'SYOT',
+        'longname' => 'Syowa Time'),
+    'SystemV/AST4' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => '',
+        'longname' => 'Atlantic Standard Time'),
+    'SystemV/AST4ADT' => array(
+        'offset' => -14400000,
+        'shortname' => 'AST',
+        'dstshortname' => 'ADT',
+        'longname' => 'Atlantic Standard Time',
+        'dstlongname' => 'Atlantic Daylight Time',
+        'summertimeoffset' => 3600000000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 21600000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 18000000000),
+    'SystemV/CST6' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => '',
+        'longname' => 'Central Standard Time'),
+    'SystemV/CST6CDT' => array(
+        'offset' => -21600000,
+        'shortname' => 'CST',
+        'dstshortname' => 'CDT',
+        'longname' => 'Central Standard Time',
+        'dstlongname' => 'Central Daylight Time',
+        'summertimeoffset' => 3600000000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 28800000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 25200000000),
+    'SystemV/EST5' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => '',
+        'longname' => 'Eastern Standard Time'),
+    'SystemV/EST5EDT' => array(
+        'offset' => -18000000,
+        'shortname' => 'EST',
+        'dstshortname' => 'EDT',
+        'longname' => 'Eastern Standard Time',
+        'dstlongname' => 'Eastern Daylight Time',
+        'summertimeoffset' => 3600000000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 25200000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 21600000000),
+    'SystemV/HST10' => array(
+        'offset' => -36000000,
+        'shortname' => 'HST',
+        'dstshortname' => '',
+        'longname' => 'Hawaii Standard Time'),
+    'SystemV/MST7' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => '',
+        'longname' => 'Mountain Standard Time'),
+    'SystemV/MST7MDT' => array(
+        'offset' => -25200000,
+        'shortname' => 'MST',
+        'dstshortname' => 'MDT',
+        'longname' => 'Mountain Standard Time',
+        'dstlongname' => 'Mountain Daylight Time',
+        'summertimeoffset' => 3600000000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 32400000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 28800000000),
+    'SystemV/PST8' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => '',
+        'longname' => 'Pitcairn Standard Time'),
+    'SystemV/PST8PDT' => array(
+        'offset' => -28800000,
+        'shortname' => 'PST',
+        'dstshortname' => 'PDT',
+        'longname' => 'Pacific Standard Time',
+        'dstlongname' => 'Pacific Daylight Time',
+        'summertimeoffset' => 3600000000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 36000000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 32400000000),
+    'SystemV/YST9' => array(
+        'offset' => -32400000,
+        'shortname' => 'YST',
+        'dstshortname' => '',
+        'longname' => 'Gambier Time'),
+    'SystemV/YST9YDT' => array(
+        'offset' => -32400000,
+        'shortname' => 'YST',
+        'dstshortname' => 'YDT',
+        'longname' => 'Alaska Standard Time',
+        'dstlongname' => 'Alaska Daylight Time',
+        'summertimeoffset' => 3600000000,
+        'summertimestartmonth' => 4,
+        'summertimestartday' => 'lastSun',
+        'summertimestarttime' => 39600000000,
+        'summertimeendmonth' => 10,
+        'summertimeendday' => 'lastSun',
+        'summertimeendtime' => 36000000000),
+    'Tahiti Time' => array(
+        'offset' => -36000000,
+        'shortname' => 'TAHT',
+        'longname' => 'Tahiti Time'),
+    'Tajikistan Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'TJT',
+        'longname' => 'Tajikistan Time'),
+    'Tokelau Time' => array(
+        'offset' => -36000000,
+        'shortname' => 'TKT',
+        'longname' => 'Tokelau Time'),
+    'Tonga Time' => array(
+        'offset' => 46800000,
+        'shortname' => 'TOT',
+        'longname' => 'Tonga Time'),
+    'Truk Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'TRUT',
+        'longname' => 'Truk Time'),
+    'Turkmenistan Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'TMT',
+        'longname' => 'Turkmenistan Time'),
+    'Tuvalu Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'TVT',
+        'longname' => 'Tuvalu Time'),
+    'Ulaanbaatar Time' => array(
+        'offset' => 28800000,
+        'shortname' => 'ULAT',
+        'longname' => 'Ulaanbaatar Time'),
+    'Uruguay Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'UYT',
+        'longname' => 'Uruguay Time'),
+    'Uzbekistan Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'UZT',
+        'longname' => 'Uzbekistan Time'),
+    'VST' => array(
+        'offset' => 25200000,
+        'shortname' => 'ICT',
+        'longname' => 'Indochina Time'),
+    'Vanuatu Time' => array(
+        'offset' => 39600000,
+        'shortname' => 'VUT',
+        'longname' => 'Vanuatu Time'),
+    'Venezuela Time' => array(
+        'offset' => -14400000,
+        'shortname' => 'VET',
+        'longname' => 'Venezuela Time'),
+    'Vladivostok Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'VLAT',
+        'dstshortname' => 'VLAST',
+        'longname' => 'Vladivostok Time',
+        'dstlongname' => 'Vladivostok Summer Time'),
+    'Vostok time' => array(
+        'offset' => 21600000,
+        'shortname' => 'VOST',
+        'longname' => 'Vostok time'),
+    'Wake Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'WAKT',
+        'longname' => 'Wake Time'),
+    'Wallis & Futuna Time' => array(
+        'offset' => 43200000,
+        'shortname' => 'WFT',
+        'longname' => 'Wallis & Futuna Time'),
+    'West Indonesia Time' => array(
+        'offset' => 25200000,
+        'shortname' => 'WIT',
+        'longname' => 'West Indonesia Time'),
+    'West Samoa Time' => array(
+        'offset' => -39600000,
+        'shortname' => 'WST',
+        'longname' => 'West Samoa Time'),
+    'Western African Time' => array(
+        'offset' => 3600000,
+        'shortname' => 'WAT',
+        'dstshortname' => 'WAST',
+        'longname' => 'Western African Time',
+        'dstlongname' => 'Western African Summer Time'),
+    'Western European Time' => array(
+        'offset' => 0,
+        'shortname' => 'WET',
+        'dstshortname' => 'WEST',
+        'longname' => 'Western European Time',
+        'dstlongname' => 'Western European Summer Time'),
+    'Western Greenland Time' => array(
+        'offset' => -10800000,
+        'shortname' => 'WGT',
+        'dstshortname' => 'WGST',
+        'longname' => 'Western Greenland Time',
+        'dstlongname' => 'Western Greenland Summer Time'),
+    'Western Standard Time (Australia)' => array(
+        'offset' => 28800000,
+        'shortname' => 'WST',
+        'longname' => 'Western Standard Time (Australia)'),
+    'Yakutsk Time' => array(
+        'offset' => 32400000,
+        'shortname' => 'YAKT',
+        'dstshortname' => 'YAKST',
+        'longname' => 'Yakutsk Time',
+        'dstlongname' => 'Yaktsk Summer Time'),
+    'Yap Time' => array(
+        'offset' => 36000000,
+        'shortname' => 'YAPT',
+        'longname' => 'Yap Time'),
+    'Yekaterinburg Time' => array(
+        'offset' => 18000000,
+        'shortname' => 'YEKT',
+        'dstshortname' => 'YEKST',
+        'longname' => 'Yekaterinburg Time',
+        'dstlongname' => 'Yekaterinburg Summer Time'),
+);
+
+/**
+ * Initialize default timezone
+ *
+ * First try php.ini directive, then the value returned by date("e"), then
+ * _DATE_TIMEZONE_DEFAULT global, then PHP_TZ environment variable, then TZ
+ * environment variable.
+ */
+if (isset($GLOBALS['_DATE_TIMEZONE_DEFAULT'])
+    && Date_TimeZone::isValidID($GLOBALS['_DATE_TIMEZONE_DEFAULT'])) {
+    Date_TimeZone::setDefault($GLOBALS['_DATE_TIMEZONE_DEFAULT']);
+} elseif (function_exists('version_compare') &&
+    version_compare(phpversion(), "5.1.0", ">=") &&
+    (
+        Date_TimeZone::isValidID($ps_id = date_default_timezone_get()) ||
+        Date_TimeZone::isValidID($ps_id = date("e"))
+    )
+) {
+    Date_TimeZone::setDefault($ps_id);
+} 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:
+ */
diff --git a/extlib/Date/docs/LICENSE b/extlib/Date/docs/LICENSE
new file mode 100644 (file)
index 0000000..8aea43f
--- /dev/null
@@ -0,0 +1,30 @@
+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.
diff --git a/extlib/Date/docs/TODO b/extlib/Date/docs/TODO
new file mode 100644 (file)
index 0000000..3d26779
--- /dev/null
@@ -0,0 +1,12 @@
+$Id$
+
+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
diff --git a/extlib/Date/docs/examples/example.php b/extlib/Date/docs/examples/example.php
new file mode 100644 (file)
index 0000000..401a43b
--- /dev/null
@@ -0,0 +1,137 @@
+<html>
+<head>
+    <title>Date Example</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <style>
+        span.code {
+            font-family: Monospace;
+        }
+    </style>
+</head>
+<body>
+<?php
+
+require_once "Date.php";
+
+function echo_code($ps_date)
+{
+    echo '<span class="code">' . $ps_date . "</span><br />\n";
+}
+
+
+$date = new Date();
+
+
+?>
+<h4>Object is set to currrent time and local time zone by default:</h4>
+<?php
+
+echo_code($date->format('%d/%m/%Y %H.%M.%S%O (%Z)'));
+echo_code($date->format2('DD/MM/YYYY HH.MI.SSTZO (TZC - TZN)'));
+echo_code($date->getDate(DATE_FORMAT_ISO));
+
+
+?>
+<h4>Set date to 1st February, 1991:</h4>
+<?php
+
+$date->setDate("1991-02-01 01:02:03");
+
+echo_code($date->format('%d/%m/%Y %H.%M.%S'));
+echo_code($date->format2('DD/MM/YYYY HH.MI.SS'));
+
+// Display day, month spelled out:
+//
+echo_code($date->format('%A, %e %B %Y, %H.%M.%S'));
+echo_code($date->format2('NPDay, NPDDth Month YYYY, HH.MI.SS'));
+
+
+?>
+<h4>Time without padding (i.e. leading noughts), and with short year:</h4>
+<?php
+
+echo_code($date->format('%e/%m/%y %h.%M.%S'));
+echo_code($date->format2('NPDD/NPMM/YY NPHH.MI.SS'));
+
+
+?>
+<h4>Conversion to another time zone:</h4>
+<?php
+
+$date->convertTZbyID("Asia/Calcutta");
+
+echo_code($date->format2('"Time zone ID:" TZR'));
+echo_code($date->format2('"Time zone name:" TZN'));
+echo_code($date->format2('"Time zone code:" TZC'));
+echo_code($date->format2('"Time zone offset:" TZO'));
+echo "<br />\n";
+echo_code($date->format2('DD/MM/YYYY HH.MI.SSTZO (TZC)'));
+
+
+?>
+<h4>Addition/Subtraction:</h4>
+<?php
+
+$date->addDays(-1);
+echo_code($date->format2('DD/MM/YYYY HH.MI.SS'));
+
+$date->addHours(13);
+echo_code($date->format2('DD/MM/YYYY HH.MI.SS'));
+
+
+?>
+<h4>12-hour time:</h4>
+<?php
+
+echo_code($date->format('%d/%m/%Y %I.%M.%S %p'));
+echo_code($date->format2('DD/MM/YYYY HH12.MI.SS am'));
+
+
+?>
+<h4>Display micro-time:</h4>
+<?php
+
+$date->setSecond(3.201282);
+
+echo_code($date->format('%d/%m/%Y %I.%M.%s'));
+echo_code($date->format2('DD/MM/YYYY HH12.MI.SS.FFFFFF'));
+
+
+?>
+<h4>Convert to Unix time:</h4>
+<?php
+
+echo_code($hn_unixtime = $date->format2('U'));
+
+
+?>
+<h4>Convert Unix time back to Date object:</h4>
+<?php
+
+$date2 = new Date($hn_unixtime);
+
+echo_code($date2->format2("DD/MM/YYYY HH.MI.SSTZO"));
+
+
+?>
+<h4>Compare two times for equality:</h4>
+<?php
+
+if ($date2->before($date)) {
+    echo "second date is earlier (because Unix time ignores the part-second)<br />\n";
+}
+
+$date->trunc(DATE_PRECISION_SECOND);
+
+if ($date2->equals($date)) {
+    echo "dates are now the same<br />\n";
+}
+
+
+?>
+<br/>
+<br/>
+<br/>
+<br/>
+</body>
+</html>
\ No newline at end of file
diff --git a/extlib/Date/tests/DateSpanTest.php b/extlib/Date/tests/DateSpanTest.php
new file mode 100644 (file)
index 0000000..561f52f
--- /dev/null
@@ -0,0 +1,225 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 Leandro Lucarella                            |
+// +----------------------------------------------------------------------+
+// | 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: Leandro Lucarella <llucax@php.net>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+
+require_once 'Date.php';
+require_once 'Date/Span.php';
+require_once 'PHPUnit/Autoload.php';
+
+/**
+ * Test case for Date_Span
+ *
+ * @package Date
+ * @author Leandro Lucarella <llucax@php.net>
+ */
+class Date_SpanTest extends PHPUnit_Framework_TestCase
+{
+    public $time;
+
+    public function setUp()
+    {
+        $this->time = new Date_Span(97531);
+    }
+
+    public function tearDown()
+    {
+        unset($this->time);
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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")
+            );
+        }
+    }
+
+    public function testAdd()
+    {
+        $this->time->add(new Date_Span(6000));
+        $result = $this->time->toSeconds();
+        $expected = 103531;
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testSubtract()
+    {
+        $this->time->subtract(new Date_Span(6000));
+        $result = $this->time->toSeconds();
+        $expected = 91531;
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/extlib/Date/tests/DateTest.php b/extlib/Date/tests/DateTest.php
new file mode 100644 (file)
index 0000000..b9f52c4
--- /dev/null
@@ -0,0 +1,453 @@
+<?php
+// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 Marshall Roch                                |
+// +----------------------------------------------------------------------+
+// | 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: Marshall Roch <mroch@php.net>                                |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+
+require_once 'Date.php';
+require_once 'PHPUnit/Autoload.php';
+
+class myDate extends Date
+{
+    public function myDate($date)
+    {
+        $this->Date($date);
+    }
+}
+
+/**
+ * Test case for Date
+ *
+ * @package Date
+ * @author Marshall Roch <mroch@php.net>
+ */
+class Date_Test extends PHPUnit_Framework_TestCase
+{
+    public $time;
+
+    public function setUp()
+    {
+        $this->time = new Date("2003-10-04 14:03:24Z");
+    }
+
+    public function tearDown()
+    {
+        unset($this->time);
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public function testAbstraction()
+    {
+        $d = new Date();
+        $my = new myDate($d);
+        $this->assertEquals($d->getDate(), $my->getDate());
+    }
+
+    public function testDateCopy()
+    {
+        $temp = new Date($this->time);
+        $this->assertEquals($temp, $this->time);
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public function testDateUnixtime()
+    {
+        $temp = new Date();
+        $temp->setTZbyID("UTC");
+        $temp->setDate(strtotime("2003-10-04 14:03:24Z"));
+        $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
+            )
+        );
+    }
+
+    public function testDateUnixtime2()
+    {
+        $temp = new Date();
+        $temp->setTZbyID("UTC-05:30");
+        $temp->setDate(strtotime("2003-10-04 14:03:24Z"));
+        $temp->convertTZbyID("UTC");
+        $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
+            )
+        );
+    }
+
+    public function testDateUnixtime3()
+    {
+        $temp = new Date();
+        $temp->setTZbyID("America/Chicago");
+        $temp->setDate(strtotime("2003-10-04 14:03:24Z"));
+        $temp->convertTZbyID("UTC");
+        $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
+            )
+        );
+    }
+
+    public function testDateUnixtime4()
+    {
+        $temp = new Date();
+        $temp->setTZbyID("Europe/London");
+        $temp->setDate(strtotime("2003-10-04 14:03:24Z")); // Summer time in London
+        $temp->setTZbyID("UTC");
+        $this->assertEquals(
+            '2003-10-04 15:03:24', // Preserves London local time (15.03)
+            sprintf(
+                '%04d-%02d-%02d %02d:%02d:%02d',
+                $temp->year,
+                $temp->month,
+                $temp->day,
+                $temp->hour,
+                $temp->minute,
+                $temp->second
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public 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
+            )
+        );
+    }
+
+    public function testSetDateUnixtime()
+    {
+        $this->time->setDate(strtotime("2003-10-04 14:03:24Z"));
+        $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
+            )
+        );
+    }
+
+    public function testSetDateUnixtime2()
+    {
+        $hs_oldtz = $this->time->getTZID();
+        $this->time->setTZbyID("UTC-05:30");
+        $this->time->setDate(strtotime("2003-10-04 14:03:24Z"));
+        $this->time->convertTZbyID($hs_oldtz);
+        $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
+            )
+        );
+    }
+
+    public function testSetDateUnixtime3()
+    {
+        $hs_oldtz = $this->time->getTZID();
+        $this->time->setTZbyID("America/Chicago");
+        $this->time->setDate(strtotime("2003-10-04 14:03:24Z"));
+        $this->time->convertTZbyID($hs_oldtz);
+        $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
+            )
+        );
+    }
+
+    public function testGetDateISO()
+    {
+        $date = $this->time->getDate(DATE_FORMAT_ISO);
+        $this->assertEquals('2003-10-04 14:03:24', $date);
+    }
+
+    public function testGetDateISOBasic()
+    {
+        $date = $this->time->getDate(DATE_FORMAT_ISO_BASIC);
+        $this->assertEquals('20031004T140324Z', $date);
+    }
+
+    public function testGetDateISOExtended()
+    {
+        $date = $this->time->getDate(DATE_FORMAT_ISO_EXTENDED);
+        $this->assertEquals('2003-10-04T14:03:24Z', $date);
+    }
+
+    public function testGetDateTimestamp()
+    {
+        $date = $this->time->getDate(DATE_FORMAT_TIMESTAMP);
+        $this->assertEquals('20031004140324', $date);
+    }
+
+    public function testGetDateUnixtime()
+    {
+        $date = $this->time->getDate(DATE_FORMAT_UNIXTIME);
+        $this->assertEquals(strtotime('2003-10-04 14:03:24Z'), $date);
+    }
+
+    public function testGetDateUnixtime2()
+    {
+        $hs_oldtz = $this->time->getTZID();
+        $this->time->convertTZbyID("UTC-05:30");
+        $date = $this->time->getDate(DATE_FORMAT_UNIXTIME);
+        $this->assertEquals(strtotime('2003-10-04 14:03:24Z'), $date);
+        $this->time->convertTZbyID($hs_oldtz);
+    }
+
+    public function testGetDateUnixtime3()
+    {
+        $hs_oldtz = $this->time->getTZID();
+        $this->time->convertTZbyID("America/Chicago");
+        $date = $this->time->getDate(DATE_FORMAT_UNIXTIME);
+        $this->assertEquals(strtotime('2003-10-04 14:03:24Z'), $date);
+        $this->time->convertTZbyID($hs_oldtz);
+    }
+
+    public function testFormatLikeStrftime()
+    {
+        $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' => '39',
+            'y' => '03',
+            'Y' => '2003',
+            '%' => '%'
+        );
+
+        foreach ($codes as $code => $expected) {
+            $this->assertEquals(
+                "$code: $expected",
+                $this->time->formatLikeStrftime("$code: %$code")
+            );
+        }
+    }
+
+    public 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);
+    }
+}
diff --git a/extlib/Date/tests/bugs/bug-11313.phpt b/extlib/Date/tests/bugs/bug-11313.phpt
new file mode 100644 (file)
index 0000000..c7612ac
--- /dev/null
@@ -0,0 +1,65 @@
+--TEST--
+Bug #11313 DST time change not handled correctly
+--FILE--
+<?php
+
+date_default_timezone_set('Europe/Moscow');
+//include_once('debug.php');
+require_once 'Date.php';
+
+$date = new Date('2007-03-25 03:00:04');
+$tmp = new Date($date);
+
+$PRINT_FORMAT = "%Y-%m-%d %H:%M:%S %Z%O";
+
+//var_dump($date->tz, 'TimeZone');
+printf("% 50s: %s\n", "Actual date", $date->format($PRINT_FORMAT));
+
+$tmp->copy($date);
+$tmp->subtractSpan(new Date_Span('0:00:00:05'));
+printf(
+    "% 50s: %s\n",
+    'Subtracting 5 seconds',
+    $tmp->format($PRINT_FORMAT)
+);
+
+$tmp->copy($date);
+$tmp->subtractSpan(new Date_Span('0:00:20:00'));
+printf(
+    "% 50s: %s\n",
+    "Subtracting 20 minutes",
+    $tmp->format($PRINT_FORMAT)
+);
+
+$tmp->copy($date);
+$tmp->subtractSpan(new Date_Span('0:02:30:00'));
+printf(
+    "% 50s: %s\n",
+    "Subtracting 2 hours 30 minutes",
+    $tmp->format($PRINT_FORMAT)
+);
+
+$tmp->copy($date);
+$tmp->subtractSpan(new Date_Span('0:10:00:00'));
+printf(
+    "% 50s: %s\n",
+    "Subtracting 10 hours",
+    $tmp->format($PRINT_FORMAT)
+);
+
+$tmp->copy($date);
+$tmp->subtractSpan(new Date_Span('3:00:00:00'));
+printf(
+    "% 50s: %s\n",
+    "Subtracting 3 days",
+    $tmp->format($PRINT_FORMAT)
+);
+
+?>
+--EXPECT--
+                                       Actual date: 2007-03-25 03:00:04 MSD+04:00
+                             Subtracting 5 seconds: 2007-03-25 01:59:59 MSK+03:00
+                            Subtracting 20 minutes: 2007-03-25 01:40:04 MSK+03:00
+                    Subtracting 2 hours 30 minutes: 2007-03-24 23:30:04 MSK+03:00
+                              Subtracting 10 hours: 2007-03-24 16:00:04 MSK+03:00
+                                Subtracting 3 days: 2007-03-22 02:00:04 MSK+03:00
diff --git a/extlib/Date/tests/bugs/bug-13376.phpt b/extlib/Date/tests/bugs/bug-13376.phpt
new file mode 100644 (file)
index 0000000..19d35f5
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+Bug #13376 setFromDateDiff change the source of Date objects
+--FILE--
+<?php
+/*
+ * Test for: Date_Span
+ * Part tested: Date_Span::setFromDateDiff()
+ *
+ * This test should be tested on both PHP4 and PHP5 to see the different.
+ *
+ * $Id$
+ */
+
+require_once 'Date.php';
+
+$startDate = new Date('2008-02-29 00:00:00');
+$endDate = new Date('2008-03-01 23:30:10');
+print 'Days: ' . $startDate->format('%Y-%m-%d') . ' to ' . $endDate->format('%Y-%m-%d') . "\n";
+
+$diff = new Date_Span();
+$diff->setFromDateDiff($startDate, $endDate);
+
+// still same instances?
+print 'Days: ' . $startDate->format('%Y-%m-%d') . ' to ' . $endDate->format('%Y-%m-%d') . "\n";
+
+// what about diff?
+print 'Diff: ' . $diff->format('%D day %H hours %M minutes %S seconds') . "\n";
+?>
+--EXPECT--
+Days: 2008-02-29 to 2008-03-01
+Days: 2008-02-29 to 2008-03-01
+Diff: 1 day 23 hours 30 minutes 10 seconds
diff --git a/extlib/Date/tests/bugs/bug-13545.phpt b/extlib/Date/tests/bugs/bug-13545.phpt
new file mode 100644 (file)
index 0000000..4e4dc8a
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #13545 Date_Span::set() doesn't work when passed an int and format
+--FILE--
+<?php
+
+require_once 'Date.php';
+
+$span = new Date_Span(1, '%D');
+echo $span->format('%D-%S');
+
+?> 
+--EXPECT--
+1-00
diff --git a/extlib/Date/tests/bugs/bug-19568.phpt b/extlib/Date/tests/bugs/bug-19568.phpt
new file mode 100644 (file)
index 0000000..f02642a
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Bug #19568 setDate() handles ISO week dates incorrectly
+--FILE--
+<?php
+require_once 'Date.php';
+
+$x = new Date('2012-W49-1');
+print $x->year . "\n";
+print $x->month . "\n";
+print $x->day . "\n";
+
+$y = new Date('2012-W50-1');
+print $y->year . "\n";
+print $y->month . "\n";
+print $y->day . "\n";
+--EXPECT--
+2012
+12
+3
+2012
+12
+10
diff --git a/extlib/Date/tests/bugs/bug-2378-1.phpt b/extlib/Date/tests/bugs/bug-2378-1.phpt
new file mode 100644 (file)
index 0000000..3d079f9
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #2378: Date::getDate(DATE_FORMAT_UNIXTIME) doesn't convert to GMT
+--FILE--
+<?php
+
+require_once "Date.php";
+
+
+$date =& new Date(1095935549);
+echo $date->getTime()."\n";
+$date->convertTZbyID('America/Los_Angeles');
+echo $date->getTime()."\n";
+
+?>
+--EXPECT--
+1095935549
+1095935549
diff --git a/extlib/Date/tests/bugs/bug-2378.phpt b/extlib/Date/tests/bugs/bug-2378.phpt
new file mode 100644 (file)
index 0000000..9509f5b
--- /dev/null
@@ -0,0 +1,104 @@
+--TEST--
+Bug #2378: Date::getDate(DATE_FORMAT_UNIXTIME) doesn't convert to GMT
+--FILE--
+<?php
+/**
+ * Test for: Date
+ * Parts tested: Date::getTime(), Date::getDate(DATE_FORMAT_UNIXTIME)
+ */
+
+require_once 'Date.php';
+
+$dates = array(
+  '1969-12-31T18:30:00-05:30',    // 0
+  '1970-01-01T07:00:00+07:00',    // 0
+  '1970-01-01T00:00:00Z',         // 0
+  '1998-12-31T23:59:59Z',         // 915148799
+//  '1998-12-31T23:59:60Z',         // 915148800
+  '1999-01-01T00:00:00Z',         // 915148800  (no leap second)
+  '2001-09-09T01:46:40Z',         // 1000000000
+  '2004-01-10T13:37:04Z',         // 2^30
+  '2005-03-18T01:58:31Z',         // 1111111111
+  '2006-12-08T01:00:00Z',         // 1165539600
+  '2009-02-13T23:31:30Z',         // 1234567890
+  '2033-05-18T03:33:20Z',         // 2000000000
+  );
+
+$date = new Date();
+foreach ($dates as $hs_date) {
+    $date->setDate($hs_date);
+
+    if (PEAR::isError($res = $date->convertTZbyID('UTC'))) {
+        print_r($res);
+        exit();
+    }
+    $ts = $date->getTime();
+    echo 'Greenwich       = ' . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+
+    if (PEAR::isError($res = $date->convertTZbyID('Europe/London'))) {
+        print_r($res);
+        exit();
+    }
+    $ts = $date->getTime();
+    echo 'London  ' . $date->formatLikeSQL('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+
+    if (PEAR::isError($res = $date->convertTZbyID('Europe/Paris'))) {
+        print_r($res);
+        exit();
+    }
+    $ts = $date->getTime();
+    echo 'Paris   ' . $date->formatLikeSQL('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+
+    if (PEAR::isError($res = $date->convertTZbyID('Asia/Jakarta'))) {
+        print_r($res);
+        exit();
+    }
+    $ts = $date->getTime();
+    echo 'Jakarta ' . $date->formatLikeSQL('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+}
+?>
+--EXPECT--
+Greenwich       = 0          - 1970-01-01 00:00:00+00:00
+London  (UTC+0) = 0          - 1970-01-01 00:00:00+00:00
+Paris   (UTC+1) = 0          - 1970-01-01 01:00:00+01:00
+Jakarta (UTC+7) = 0          - 1970-01-01 07:00:00+07:00
+Greenwich       = 0          - 1970-01-01 00:00:00+00:00
+London  (UTC+0) = 0          - 1970-01-01 00:00:00+00:00
+Paris   (UTC+1) = 0          - 1970-01-01 01:00:00+01:00
+Jakarta (UTC+7) = 0          - 1970-01-01 07:00:00+07:00
+Greenwich       = 0          - 1970-01-01 00:00:00+00:00
+London  (UTC+0) = 0          - 1970-01-01 00:00:00+00:00
+Paris   (UTC+1) = 0          - 1970-01-01 01:00:00+01:00
+Jakarta (UTC+7) = 0          - 1970-01-01 07:00:00+07:00
+Greenwich       = 915148799  - 1998-12-31 23:59:59+00:00
+London  (UTC+0) = 915148799  - 1998-12-31 23:59:59+00:00
+Paris   (UTC+1) = 915148799  - 1999-01-01 00:59:59+01:00
+Jakarta (UTC+7) = 915148799  - 1999-01-01 06:59:59+07:00
+Greenwich       = 915148800  - 1999-01-01 00:00:00+00:00
+London  (UTC+0) = 915148800  - 1999-01-01 00:00:00+00:00
+Paris   (UTC+1) = 915148800  - 1999-01-01 01:00:00+01:00
+Jakarta (UTC+7) = 915148800  - 1999-01-01 07:00:00+07:00
+Greenwich       = 1000000000 - 2001-09-09 01:46:40+00:00
+London  (UTC+1) = 1000000000 - 2001-09-09 02:46:40+01:00
+Paris   (UTC+2) = 1000000000 - 2001-09-09 03:46:40+02:00
+Jakarta (UTC+7) = 1000000000 - 2001-09-09 08:46:40+07:00
+Greenwich       = 1073741824 - 2004-01-10 13:37:04+00:00
+London  (UTC+0) = 1073741824 - 2004-01-10 13:37:04+00:00
+Paris   (UTC+1) = 1073741824 - 2004-01-10 14:37:04+01:00
+Jakarta (UTC+7) = 1073741824 - 2004-01-10 20:37:04+07:00
+Greenwich       = 1111111111 - 2005-03-18 01:58:31+00:00
+London  (UTC+0) = 1111111111 - 2005-03-18 01:58:31+00:00
+Paris   (UTC+1) = 1111111111 - 2005-03-18 02:58:31+01:00
+Jakarta (UTC+7) = 1111111111 - 2005-03-18 08:58:31+07:00
+Greenwich       = 1165539600 - 2006-12-08 01:00:00+00:00
+London  (UTC+0) = 1165539600 - 2006-12-08 01:00:00+00:00
+Paris   (UTC+1) = 1165539600 - 2006-12-08 02:00:00+01:00
+Jakarta (UTC+7) = 1165539600 - 2006-12-08 08:00:00+07:00
+Greenwich       = 1234567890 - 2009-02-13 23:31:30+00:00
+London  (UTC+0) = 1234567890 - 2009-02-13 23:31:30+00:00
+Paris   (UTC+1) = 1234567890 - 2009-02-14 00:31:30+01:00
+Jakarta (UTC+7) = 1234567890 - 2009-02-14 06:31:30+07:00
+Greenwich       = 2000000000 - 2033-05-18 03:33:20+00:00
+London  (UTC+1) = 2000000000 - 2033-05-18 04:33:20+01:00
+Paris   (UTC+2) = 2000000000 - 2033-05-18 05:33:20+02:00
+Jakarta (UTC+7) = 2000000000 - 2033-05-18 10:33:20+07:00
diff --git a/extlib/Date/tests/bugs/bug-445.phpt b/extlib/Date/tests/bugs/bug-445.phpt
new file mode 100644 (file)
index 0000000..86b2d76
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Bug #445: Date does not handle DATE_FORMAT_ISO_EXTENDED correctly
+--FILE--
+<?php
+/**
+ * Test for: Date
+ * Parts tested: DATE_FORMAT_ISO_EXTENDED constant
+ */
+
+require_once 'Date.php';
+
+$input = '2003-12-17T10:27:03Z';
+$date = new Date('2003-12-17T10:27:03Z');
+echo 'Date::getMonth() (via Constructor) = ' . $date->getMonth() . "\n";
+
+$date = new Date();
+$date->setDate($input, DATE_FORMAT_ISO_EXTENDED);
+echo 'Date::getMonth() (via Date::setDate()) = ' . $date->getMonth() . "\n";
+?>
+--EXPECT--
+Date::getMonth() (via Constructor) = 12
+Date::getMonth() (via Date::setDate()) = 12
diff --git a/extlib/Date/tests/bugs/bug-6246.phpt b/extlib/Date/tests/bugs/bug-6246.phpt
new file mode 100644 (file)
index 0000000..a9176db
--- /dev/null
@@ -0,0 +1,104 @@
+--TEST--
+Bug #6246: Date::inDaylightTime() crashes Apache 2.0.55 with status 3221225477
+--FILE--
+<?php
+/**
+ * Test for: Date::inDaylightTime()
+ * Parts tested: Date_TimeZone::inDaylightTime()
+ */
+
+require_once 'Date.php';
+
+/**
+ * In 2007, daylight saving time (DST) was extended in the United States.
+ * DST started on March 11, 2007, which was three weeks earlier than in
+ * the past, and it ended on November 4, 2007, one week later than in years
+ * past.  This results in a new DST period that is four weeks longer than in
+ * previous years.
+ *
+ * N.B. the time at which US Summer time starts is 2.00 'Wall-Clock' Time,
+ * that is, it goes forward at 2.00 in standard time, and goes back at
+ * 2.00 in Summer time.  This is unlike Europe which all switches together
+ * at 1.00 GMT in both directions, so that in London, for example, the
+ * clocks go back at 2.00 BST (although at that exact instant, the time
+ * actually becomes 1.00 GMT).
+ *
+ * All countries in Europe except Iceland observe DST and change on the same
+ * date and time, starting on the last Sunday in March and ending on the last
+ * Sunday in October. Before 1996, DST ended on the last Sunday in September
+ * in most European countries; on the British Isles though, DST then ended on
+ * the fourth (which some years isn't the last) Sunday in October. In the
+ * West European (UTC), Central European (CET, UTC+1), and East European
+ * (UTC+2) time zones the change is simultaneous: on both dates the clocks
+ * are changed everywhere at 01:00 UTC, i.e. from local times of
+ * 01:00/02:00/03:00 to 02:00/03:00/04:00 in March, and vice versa in October.
+ */
+
+$dates_us = array(
+    '2007-03-11T01:59:59',         // standard time
+    '2007-03-11T01:59:59.999999',  // standard time
+    '2007-03-11T03:00:00',         // Summer time
+    '2007-11-04T00:59:59',         // Summer time
+    '2007-11-04T01:00:00',         // ambiguous - could be either (standard time assumed)
+    '2007-11-04T01:59:59',         // ambiguous - could be either (standard time assumed)
+    '2007-11-04T02:00:00',         // standard time
+);
+
+$dates_eu = array(
+    '2007-03-25T00:59:59',         // standard time
+    '2007-03-25T00:59:59.999999',  // standard time
+    '2007-03-25T02:00:00',         // Summer time
+    '2007-10-28T00:59:59',         // Summer time
+    '2007-10-28T01:00:00',         // ambiguous - could be either (standard time assumed)
+    '2007-10-28T01:59:59',         // ambiguous - could be either (standard time assumed)
+    '2007-11-28T02:00:00',         // standard time
+);
+
+// Date_TimeZone does not yet have historical data, and so 2006
+// is treated as in the 2007 rules, and these dates will not
+// behave correctly (historically).
+//
+//$dates_us = array(
+//    '2006-04-02T02:00:00',  // begin of in daylight saving time.
+//    '2006-10-29T01:59:59',  // end of in daylight saving time.
+//    '2006-10-30T02:00:00',  // not in daylight saving time.
+//);
+
+$date = new Date;
+$date->setTZ($hs_tz = 'America/Chicago');    // N.B. the old name was 'US/Central' (this still works)
+foreach ($dates_us as $d) {
+    $date->setDate($d);
+    printf(
+        '%s is in %s daylight saving time? %s' . "\n",
+        $date->getDate(),
+        $hs_tz,
+        ($date->inDaylightTime() ? 'true' : 'false')
+    );
+}
+$date = new Date;
+$date->setTZ($hs_tz = 'Europe/London');    // N.B. the old name was 'US/Central' (this still works)
+foreach ($dates_eu as $d) {
+    $date->setDate($d);
+    printf(
+        '%s is in %s Summer time? %s' . "\n",
+        $date->getDate(),
+        $hs_tz,
+        ($date->inDaylightTime() ? 'true' : 'false')
+    );
+}
+?>
+--EXPECT--
+2007-03-11 01:59:59 is in America/Chicago daylight saving time? false
+2007-03-11 01:59:59 is in America/Chicago daylight saving time? false
+2007-03-11 03:00:00 is in America/Chicago daylight saving time? true
+2007-11-04 00:59:59 is in America/Chicago daylight saving time? true
+2007-11-04 01:00:00 is in America/Chicago daylight saving time? false
+2007-11-04 01:59:59 is in America/Chicago daylight saving time? false
+2007-11-04 02:00:00 is in America/Chicago daylight saving time? false
+2007-03-25 00:59:59 is in Europe/London Summer time? false
+2007-03-25 00:59:59 is in Europe/London Summer time? false
+2007-03-25 02:00:00 is in Europe/London Summer time? true
+2007-10-28 00:59:59 is in Europe/London Summer time? true
+2007-10-28 01:00:00 is in Europe/London Summer time? false
+2007-10-28 01:59:59 is in Europe/London Summer time? false
+2007-11-28 02:00:00 is in Europe/London Summer time? false
diff --git a/extlib/Date/tests/bugs/bug-674.phpt b/extlib/Date/tests/bugs/bug-674.phpt
new file mode 100644 (file)
index 0000000..5548a15
--- /dev/null
@@ -0,0 +1,34 @@
+--TEST--
+Bug #674: strange (wrong?) result of Date_Calc::endOfWeek
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: Date_Calc::endOfWeek(), Date_Calc::beginOfWeek(),
+ *               Date_Calc::beginOfNextWeek() and Date_Calc::beginOfPrevWeek().
+ */
+
+require_once 'Date.php';
+
+$dates = array(array(2003,3,17), array(2003,3,20), array(2003,3,23));
+foreach ($dates as $date) {
+    echo 'Parameters: ' . implode('-', array_reverse($date)) . "\n";
+    $bow = Date_Calc::endOfWeek($date[2], $date[1], $date[0]);
+    $eow = Date_Calc::beginOfWeek($date[2], $date[1], $date[0]);
+    $bonw = Date_Calc::beginOfNextWeek($date[2], $date[1], $date[0]);
+    $bopw = Date_Calc::beginOfPrevWeek($date[2], $date[1], $date[0]);
+    echo 'Begin of week = ' . $bow . ', End of week = ' . $eow . ', ' .
+         'Begin of next week = ' . $bonw . ', Begin of previous week = ' . $bopw .
+         "\n\n";
+}
+?>
+--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
+
diff --git a/extlib/Date/tests/bugs/bug-727-1.phpt b/extlib/Date/tests/bugs/bug-727-1.phpt
new file mode 100644 (file)
index 0000000..883c05c
--- /dev/null
@@ -0,0 +1,52 @@
+--TEST--
+Bug #727: Date_Calc::weeksInMonth() wrong result
+Tests for weeksInMonth, february with 4 weeks
+Monday as 1st day of week
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: Date_Calc::weeksInMonth()
+ */
+
+/**
+ * Monday as 1st day of week
+ */
+define('DATE_CALC_BEGIN_WEEKDAY', 1);
+
+require_once "Date/Calc.php";
+
+$tests = array(
+    array(1999, 2), array(2010, 2), array(2021, 2), array(2027, 2),
+    array(1937, 2), array(1943, 2), array(1802, 2), array(1813, 2),
+    array(1819, 2), array(1830, 2), array(1841, 2), array(1847, 2),
+    array(1858, 2), array(1869, 2), array(1875, 2), array(1886, 2),
+    array(1897, 2), array(1909, 2), array(1915, 2), array(1926, 2)
+);
+
+foreach ($tests as $date) {
+    list($year, $month) = $date;
+    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
+}
+?>
+--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
diff --git a/extlib/Date/tests/bugs/bug-727-2.phpt b/extlib/Date/tests/bugs/bug-727-2.phpt
new file mode 100644 (file)
index 0000000..dc7d33d
--- /dev/null
@@ -0,0 +1,52 @@
+--TEST--
+Bug #727: Date_Calc::weeksInMonth() wrong result
+Tests for weeksInMonth, february with 4 weeks
+Sunday as 1st day of week
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: Date_Calc::weeksInMonth()
+ */
+
+/**
+ * Sunday as 1st day of week
+ */
+define('DATE_CALC_BEGIN_WEEKDAY', 0);
+
+require_once "Date/Calc.php";
+
+$tests = array(
+    array(2009, 2), array(2015, 2), array(2026, 2), array(2037, 2),
+    array(1931, 2), array(1942, 2), array(1801, 2), array(1807, 2),
+    array(1818, 2), array(1829, 2), array(1835, 2), array(1846, 2),
+    array(1857, 2), array(1863, 2), array(1874, 2), array(1885, 2),
+    array(1891, 2), array(1903, 2), array(1914, 2), array(1925, 2)
+);
+
+foreach ($tests as $date) {
+    list($year, $month) = $date;
+    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
+}
+?>
+--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
diff --git a/extlib/Date/tests/bugs/bug-727-3.phpt b/extlib/Date/tests/bugs/bug-727-3.phpt
new file mode 100644 (file)
index 0000000..b0589a2
--- /dev/null
@@ -0,0 +1,500 @@
+--TEST--
+Bug #727: Date_Calc::weeksInMonth() wrong result
+Tests for weeksInMonth "random"
+Sunday as 1st day of week
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: Date_Calc::weeksInMonth()
+ */
+
+/**
+ * Sunday as 1st day of week
+ */
+define('DATE_CALC_BEGIN_WEEKDAY', 0);
+
+require_once "Date/Calc.php";
+
+$tests = array(
+    array(1999, 12), array(2000, 11), array(2001, 11), array(2002, 12),
+    array(2003, 12), array(2004, 12), array(2005, 12), array(2006, 11),
+    array(2007, 11), array(2008, 12), array(2009, 12), array(2010, 12),
+    array(2011, 12), array(2012, 11), array(2013, 12), array(2014, 12),
+    array(2015, 12), array(2016, 12), array(2017, 11), array(2018, 11),
+    array(2019, 12), array(2020, 12), array(2021, 12), array(2022, 12),
+    array(2023, 11), array(2024, 12), array(2025, 12), array(2026, 12),
+    array(2027, 12), array(2028, 11), array(2029, 11), array(2030, 12),
+    array(2031, 12), array(2032, 12), array(2033, 12), array(2034, 11),
+    array(2035, 11), array(2036, 12), array(2037, 12), array(1930, 12),
+    array(1931, 12), array(1932, 12), array(1933, 11), array(1934, 11),
+    array(1935, 12), array(1936, 12), array(1937, 12), array(1938, 12),
+    array(1939, 11), array(1940, 12), array(1941, 12), array(1942, 12),
+    array(1943, 12), array(1944, 11), array(1945, 11), array(1946, 12),
+    array(1947, 12), array(1948, 12), array(1949, 12), array(1800, 12),
+    array(1801, 12), array(1802, 12), array(1803, 12), array(1804, 11),
+    array(1805, 12), array(1806, 12), array(1807, 12), array(1808, 12),
+    array(1809, 11), array(1810, 11), array(1811, 12), array(1812, 12),
+    array(1813, 12), array(1814, 12), array(1815, 11), array(1816, 12),
+    array(1817, 12), array(1818, 12), array(1819, 12), array(1820, 11),
+    array(1821, 11), array(1822, 12), array(1823, 12), array(1824, 12),
+    array(1825, 12), array(1826, 11), array(1827, 11), array(1828, 12),
+    array(1829, 12), array(1830, 12), array(1831, 12), array(1832, 11),
+    array(1833, 12), array(1834, 12), array(1835, 12), array(1836, 12),
+    array(1837, 11), array(1838, 11), array(1839, 12), array(1840, 12),
+    array(1841, 12), array(1842, 12), array(1843, 11), array(1844, 12),
+    array(1845, 12), array(1846, 12), array(1847, 12), array(1848, 11),
+    array(1849, 11), array(1850, 12), array(1851, 12), array(1852, 12),
+    array(1853, 12), array(1854, 11), array(1855, 11), array(1856, 12),
+    array(1857, 12), array(1858, 12), array(1859, 12), array(1860, 11),
+    array(1861, 12), array(1862, 12), array(1863, 12), array(1864, 12),
+    array(1865, 11), array(1866, 11), array(1867, 12), array(1868, 12),
+    array(1869, 12), array(1870, 12), array(1871, 11), array(1872, 12),
+    array(1873, 12), array(1874, 12), array(1875, 12), array(1876, 11),
+    array(1877, 11), array(1878, 12), array(1879, 12), array(1880, 12),
+    array(1881, 12), array(1882, 11), array(1883, 11), array(1884, 12),
+    array(1885, 12), array(1886, 12), array(1887, 12), array(1888, 11),
+    array(1889, 12), array(1890, 12), array(1891, 12), array(1892, 12),
+    array(1893, 11), array(1894, 11), array(1895, 12), array(1896, 12),
+    array(1897, 12), array(1898, 12), array(1899, 11), array(1900, 11),
+    array(1901, 12), array(1902, 12), array(1903, 12), array(1904, 12),
+    array(1905, 11), array(1906, 11), array(1907, 12), array(1908, 12),
+    array(1909, 12), array(1910, 12), array(1911, 11), array(1912, 12),
+    array(1913, 12), array(1914, 12), array(1915, 12), array(1916, 11),
+    array(1917, 11), array(1918, 12), array(1919, 12), array(1920, 12),
+    array(1921, 12), array(1922, 11), array(1923, 11), array(1924, 12),
+    array(1925, 12), array(1926, 12), array(1927, 12), array(1928, 11),
+    array(1929, 12), array(1999, 10), array(2000, 12), array(2001, 12),
+    array(2002, 6),  array(2003, 11), array(2004, 10), array(2005, 10),
+    array(2006, 12), array(2007, 12), array(2008, 11), array(2009, 8),
+    array(2010, 10), array(2011, 10), array(2012, 12), array(2013, 6),
+    array(2014, 11), array(2015, 8),  array(2016, 10), array(2017, 12),
+    array(2018, 12), array(2019, 6),  array(2020, 8),  array(2021, 10),
+    array(2022, 10), array(2023, 12), array(2024, 6),  array(2025, 11),
+    array(2026, 8),  array(2027, 10), array(2028, 12), array(2029, 12),
+    array(2030, 6),  array(2031, 11), array(2032, 10), array(2033, 10),
+    array(2034, 12), array(2035, 12), array(2036, 11), array(2037, 8),
+    array(1930, 11), array(1931, 8),  array(1932, 10), array(1933, 12),
+    array(1934, 12), array(1935, 6),  array(1936, 8),  array(1937, 10),
+    array(1938, 10), array(1939, 12), array(1940, 6),  array(1941, 11),
+    array(1942, 8),  array(1943, 10), array(1944, 12), array(1945, 12),
+    array(1946, 6),  array(1947, 11), array(1948, 10), array(1949, 10),
+    array(1800, 11), array(1801, 8),  array(1802, 10), array(1803, 10),
+    array(1804, 12), array(1805, 6),  array(1806, 11), array(1807, 8),
+    array(1808, 10), array(1809, 12), array(1810, 12), array(1811, 6),
+    array(1812, 8),  array(1813, 10), array(1814, 10), array(1815, 12),
+    array(1816, 6),  array(1817, 11), array(1818, 8),  array(1819, 10),
+    array(1820, 12), array(1821, 12), array(1822, 6),  array(1823, 11),
+    array(1824, 10), array(1825, 10), array(1826, 12), array(1827, 12),
+    array(1828, 11), array(1829, 8),  array(1830, 10), array(1831, 10),
+    array(1832, 12), array(1833, 6),  array(1834, 11), array(1835, 8),
+    array(1836, 10), array(1837, 12), array(1838, 12), array(1839, 6),
+    array(1840, 8),  array(1841, 10), array(1842, 10), array(1843, 12),
+    array(1844, 6),  array(1845, 11), array(1846, 8),  array(1847, 10),
+    array(1848, 12), array(1849, 12), array(1850, 6),  array(1851, 11),
+    array(1852, 10), array(1853, 10), array(1854, 12), array(1855, 12),
+    array(1856, 11), array(1857, 8),  array(1858, 10), array(1859, 10),
+    array(1860, 12), array(1861, 6),  array(1862, 11), array(1863, 8),
+    array(1864, 10), array(1865, 12), array(1866, 12), array(1867, 6),
+    array(1868, 8),  array(1869, 10), array(1870, 10), array(1871, 12),
+    array(1872, 6),  array(1873, 11), array(1874, 8),  array(1875, 10),
+    array(1876, 12), array(1877, 12), array(1878, 6),  array(1879, 11),
+    array(1880, 10), array(1881, 10), array(1882, 12), array(1883, 12),
+    array(1884, 11), array(1885, 8),  array(1886, 10), array(1887, 10),
+    array(1888, 12), array(1889, 6),  array(1890, 11), array(1891, 8),
+    array(1892, 10), array(1893, 12), array(1894, 12), array(1895, 6),
+    array(1896, 8),  array(1897, 10), array(1898, 10), array(1899, 12),
+    array(1900, 12), array(1901, 6),  array(1902, 11), array(1903, 8),
+    array(1904, 10), array(1905, 12), array(1906, 12), array(1907, 6),
+    array(1908, 8),  array(1909, 10), array(1910, 10), array(1911, 12),
+    array(1912, 6),  array(1913, 11), array(1914, 8),  array(1915, 10),
+    array(1916, 12), array(1917, 12), array(1918, 6),  array(1919, 11),
+    array(1920, 10), array(1921, 10), array(1922, 12), array(1923, 12),
+    array(1924, 11), array(1925, 8),  array(1926, 10), array(1927, 10),
+    array(1928, 12), array(1929, 6)
+);
+
+foreach ($tests as $date) {
+    list($year, $month) = $date;
+    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
+}
+?>
+--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
diff --git a/extlib/Date/tests/bugs/bug-727-4.phpt b/extlib/Date/tests/bugs/bug-727-4.phpt
new file mode 100644 (file)
index 0000000..b7b3f10
--- /dev/null
@@ -0,0 +1,500 @@
+--TEST--
+Bug #727: Date_Calc::weeksInMonth() wrong result
+Tests for weeksInMonth "random"
+Monday as 1st day of week
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: Date_Calc::weeksInMonth()
+ */
+
+/**
+ * Monday as 1st day of week
+ */
+define('DATE_CALC_BEGIN_WEEKDAY', 1);
+
+require_once "Date/Calc.php";
+
+$tests = array(
+    array(1999, 8),  array(2000, 10), array(2001, 12), array(2002, 12),
+    array(2003, 6),  array(2004, 8),  array(2005, 10), array(2006, 10),
+    array(2007, 12), array(2008, 6),  array(2009, 11), array(2010, 8),
+    array(2011, 10), array(2012, 12), array(2013, 12), array(2014, 6),
+    array(2015, 11), array(2016, 10), array(2017, 10), array(2018, 12),
+    array(2019, 12), array(2020, 11), array(2021, 8),  array(2022, 10),
+    array(2023, 10), array(2024, 12), array(2025, 6),  array(2026, 11),
+    array(2027, 8),  array(2028, 10), array(2029, 12), array(2030, 12),
+    array(2031, 6),  array(2032, 8),  array(2033, 10), array(2034, 10),
+    array(2035, 12), array(2036, 6),  array(2037, 11), array(1930, 6),
+    array(1931, 11), array(1932, 10), array(1933, 10), array(1934, 12),
+    array(1935, 12), array(1936, 11), array(1937, 8),  array(1938, 10),
+    array(1939, 10), array(1940, 12), array(1941, 6),  array(1942, 11),
+    array(1943, 8),  array(1944, 10), array(1945, 12), array(1946, 12),
+    array(1947, 6),  array(1948, 8),  array(1949, 10), array(1800, 6),
+    array(1801, 11), array(1802, 8),  array(1803, 10), array(1804, 12),
+    array(1805, 12), array(1806, 6),  array(1807, 11), array(1808, 10),
+    array(1809, 10), array(1810, 12), array(1811, 12), array(1812, 11),
+    array(1813, 8),  array(1814, 10), array(1815, 10), array(1816, 12),
+    array(1817, 6),  array(1818, 11), array(1819, 8),  array(1820, 10),
+    array(1821, 12), array(1822, 12), array(1823, 6),  array(1824, 8),
+    array(1825, 10), array(1826, 10), array(1827, 12), array(1828, 6),
+    array(1829, 11), array(1830, 8),  array(1831, 10), array(1832, 12),
+    array(1833, 12), array(1834, 6),  array(1835, 11), array(1836, 10),
+    array(1837, 10), array(1838, 12), array(1839, 12), array(1840, 11),
+    array(1841, 8),  array(1842, 10), array(1843, 10), array(1844, 12),
+    array(1845, 6),  array(1846, 11), array(1847, 8),  array(1848, 10),
+    array(1849, 12), array(1850, 12), array(1851, 6),  array(1852, 8),
+    array(1853, 10), array(1854, 10), array(1855, 12), array(1856, 6),
+    array(1857, 11), array(1858, 8),  array(1859, 10), array(1860, 12),
+    array(1861, 12), array(1862, 6),  array(1863, 11), array(1864, 10),
+    array(1865, 10), array(1866, 12), array(1867, 12), array(1868, 11),
+    array(1869, 8),  array(1870, 10), array(1871, 10), array(1872, 12),
+    array(1873, 6),  array(1874, 11), array(1875, 8),  array(1876, 10),
+    array(1877, 12), array(1878, 12), array(1879, 6),  array(1880, 8),
+    array(1881, 10), array(1882, 10), array(1883, 12), array(1884, 6),
+    array(1885, 11), array(1886, 8),  array(1887, 10), array(1888, 12),
+    array(1889, 12), array(1890, 6),  array(1891, 11), array(1892, 10),
+    array(1893, 10), array(1894, 12), array(1895, 12), array(1896, 11),
+    array(1897, 8),  array(1898, 10), array(1899, 10), array(1900, 12),
+    array(1901, 12), array(1902, 6),  array(1903, 11), array(1904, 10),
+    array(1905, 10), array(1906, 12), array(1907, 12), array(1908, 11),
+    array(1909, 8),  array(1910, 10), array(1911, 10), array(1912, 12),
+    array(1913, 6),  array(1914, 11), array(1915, 8),  array(1916, 10),
+    array(1917, 12), array(1918, 12), array(1919, 6),  array(1920, 8),
+    array(1921, 10), array(1922, 10), array(1923, 12), array(1924, 6),
+    array(1925, 11), array(1926, 8),  array(1927, 10), array(1928, 12),
+    array(1929, 12), array(1999, 12), array(2000, 12), array(2001, 11),
+    array(2002, 11), array(2003, 12), array(2004, 12), array(2005, 12),
+    array(2006, 12), array(2007, 11), array(2008, 12), array(2009, 12),
+    array(2010, 12), array(2011, 12), array(2012, 11), array(2013, 11),
+    array(2014, 12), array(2015, 12), array(2016, 12), array(2017, 12),
+    array(2018, 11), array(2019, 11), array(2020, 12), array(2021, 12),
+    array(2022, 12), array(2023, 12), array(2024, 11), array(2025, 12),
+    array(2026, 12), array(2027, 12), array(2028, 12), array(2029, 11),
+    array(2030, 11), array(2031, 12), array(2032, 12), array(2033, 12),
+    array(2034, 12), array(2035, 11), array(2036, 12), array(2037, 12),
+    array(1930, 12), array(1931, 12), array(1932, 12), array(1933, 12),
+    array(1934, 11), array(1935, 11), array(1936, 12), array(1937, 12),
+    array(1938, 12), array(1939, 12), array(1940, 11), array(1941, 12),
+    array(1942, 12), array(1943, 12), array(1944, 12), array(1945, 11),
+    array(1946, 11), array(1947, 12), array(1948, 12), array(1949, 12),
+    array(1800, 12), array(1801, 12), array(1802, 12), array(1803, 12),
+    array(1804, 11), array(1805, 11), array(1806, 12), array(1807, 12),
+    array(1808, 12), array(1809, 12), array(1810, 11), array(1811, 11),
+    array(1812, 12), array(1813, 12), array(1814, 12), array(1815, 12),
+    array(1816, 11), array(1817, 12), array(1818, 12), array(1819, 12),
+    array(1820, 12), array(1821, 11), array(1822, 11), array(1823, 12),
+    array(1824, 12), array(1825, 12), array(1826, 12), array(1827, 11),
+    array(1828, 12), array(1829, 12), array(1830, 12), array(1831, 12),
+    array(1832, 11), array(1833, 11), array(1834, 12), array(1835, 12),
+    array(1836, 12), array(1837, 12), array(1838, 11), array(1839, 11),
+    array(1840, 12), array(1841, 12), array(1842, 12), array(1843, 12),
+    array(1844, 11), array(1845, 12), array(1846, 12), array(1847, 12),
+    array(1848, 12), array(1849, 11), array(1850, 11), array(1851, 12),
+    array(1852, 12), array(1853, 12), array(1854, 12), array(1855, 11),
+    array(1856, 12), array(1857, 12), array(1858, 12), array(1859, 12),
+    array(1860, 11), array(1861, 11), array(1862, 12), array(1863, 12),
+    array(1864, 12), array(1865, 12), array(1866, 11), array(1867, 11),
+    array(1868, 12), array(1869, 12), array(1870, 12), array(1871, 12),
+    array(1872, 11), array(1873, 12), array(1874, 12), array(1875, 12),
+    array(1876, 12), array(1877, 11), array(1878, 11), array(1879, 12),
+    array(1880, 12), array(1881, 12), array(1882, 12), array(1883, 11),
+    array(1884, 12), array(1885, 12), array(1886, 12), array(1887, 12),
+    array(1888, 11), array(1889, 11), array(1890, 12), array(1891, 12),
+    array(1892, 12), array(1893, 12), array(1894, 11), array(1895, 11),
+    array(1896, 12), array(1897, 12), array(1898, 12), array(1899, 12),
+    array(1900, 11), array(1901, 11), array(1902, 12), array(1903, 12),
+    array(1904, 12), array(1905, 12), array(1906, 11), array(1907, 11),
+    array(1908, 12), array(1909, 12), array(1910, 12), array(1911, 12),
+    array(1912, 11), array(1913, 12), array(1914, 12), array(1915, 12),
+    array(1916, 12), array(1917, 11), array(1918, 11), array(1919, 12),
+    array(1920, 12), array(1921, 12), array(1922, 12), array(1923, 11),
+    array(1924, 12), array(1925, 12), array(1926, 12), array(1927, 12),
+    array(1928, 11), array(1929, 11)
+);
+
+foreach ($tests as $date) {
+    list($year, $month) = $date;
+    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
+}
+?>
+--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
diff --git a/extlib/Date/tests/bugs/bug-8518.phpt b/extlib/Date/tests/bugs/bug-8518.phpt
new file mode 100644 (file)
index 0000000..3264aed
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Bug #8518: Date::copy() doest not copy the parts of a second.
+--FILE--
+<?php
+/**
+ * Test for: Date
+ * Parts tested: Date::copy()
+ * $Id$
+ */
+
+require_once 'Date.php';
+
+$date = new Date('2006-11-08 10:19:25.9942');
+$date->setTZbyID("UTC");
+
+$tmp = new Date;
+$tmp->copy($date);
+echo $tmp->format('%Y-%m-%d %H:%M:%s%O'."\n");
+?>
+--EXPECT--
+2006-11-08 10:19:25.994200+00:00
diff --git a/extlib/Date/tests/bugs/bug-8912.phpt b/extlib/Date/tests/bugs/bug-8912.phpt
new file mode 100644 (file)
index 0000000..b7b60e1
--- /dev/null
@@ -0,0 +1,88 @@
+--TEST--
+Bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows
+--FILE--
+<?php
+/**
+ * Test for: Date_TimeZone
+ * Parts tested: Date_TimeZone::inDaylightTime()
+ */
+
+require_once 'Date.php';
+
+$states = array(
+    'Australia/Adelaide',
+    'Australia/Canberra',
+    'Australia/Darwin',
+    'Australia/Brisbane',
+    'Australia/Hobart',
+    'Australia/Melbourne',
+    'Australia/Perth',
+    'Australia/Sydney'
+);
+
+$originalTimezone = new Date_TimeZone('Australia/Adelaide');
+
+$d = new Date("2007-08-31 11:59:59Z");
+$hn_time = $d->getTime();
+foreach ($states as $state) {
+    $new_date = new Date($hn_time);
+    print 'Original Time (Australia/Adelaide): ' . $new_date->formatLikeSQL("TZH:TZM") . " " . $new_date->getTime() . "\n";
+    $timezone = new Date_TimeZone($state);
+    $new_date->convertTZ($timezone);
+    print $state . ': ' . ($hn_localtime = $new_date->getTime()) . "\n";
+    print 'Difference: ' . ($hn_localtime - $hn_time) . "\n";
+    $new_date->setTZ($originalTimezone);
+    print $state . ': ' . ($hn_localtime = $new_date->getTime()) . "\n";
+    print 'Difference: ' . ($hn_localtime - $hn_time) . "\n";
+    print "\n";
+}
+?>
+--EXPECT--
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Adelaide: 1188561599
+Difference: 0
+Australia/Adelaide: 1188561599
+Difference: 0
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Canberra: 1188561599
+Difference: 0
+Australia/Canberra: 1188563399
+Difference: 1800
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Darwin: 1188561599
+Difference: 0
+Australia/Darwin: 1188561599
+Difference: 0
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Brisbane: 1188561599
+Difference: 0
+Australia/Brisbane: 1188563399
+Difference: 1800
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Hobart: 1188561599
+Difference: 0
+Australia/Hobart: 1188563399
+Difference: 1800
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Melbourne: 1188561599
+Difference: 0
+Australia/Melbourne: 1188563399
+Difference: 1800
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Perth: 1188561599
+Difference: 0
+Australia/Perth: 1188556199
+Difference: -5400
+
+Original Time (Australia/Adelaide): 01:00 1188561599
+Australia/Sydney: 1188561599
+Difference: 0
+Australia/Sydney: 1188563399
+Difference: 1800
+
diff --git a/extlib/Date/tests/bugs/bug-9213.phpt b/extlib/Date/tests/bugs/bug-9213.phpt
new file mode 100644 (file)
index 0000000..c608305
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Bug #9213: Date_Calc doesn't like including Date.php
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: DATE_CALC_FORMAT constant
+ * $Id$
+ */
+
+require_once 'Date.php'; //Uh oh! I break things
+require_once 'Date/Calc.php';
+
+$calc = new Date_Calc();
+print $calc->beginOfWeek(1, 6, 2006) . "\n";
+print $calc->beginOfWeek(1, 6, 2006) . "\n";
+print $calc->beginOfNextWeek(1, 6, 2006) . "\n";
+?>
+--EXPECT--
+20060529
+20060529
+20060605
diff --git a/extlib/Date/tests/bugs/bug-9414.phpt b/extlib/Date/tests/bugs/bug-9414.phpt
new file mode 100644 (file)
index 0000000..fcc7521
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+Bug #9414: Date::addSeconds() fails to work properly with negative numbers
+--FILE--
+<?php
+/**
+ * Test for: Date
+ * Parts tested: Date::addSeconds()
+ */
+
+require_once 'Date.php';
+
+$date = new Date('2006-11-21');
+
+print "Date is now: " . $date->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
diff --git a/extlib/Date/tests/bugs/bug-9568.phpt b/extlib/Date/tests/bugs/bug-9568.phpt
new file mode 100644 (file)
index 0000000..8bbdbc3
--- /dev/null
@@ -0,0 +1,99 @@
+--TEST--
+Bug #9568:
+Date_Calc::beginOfMonthBySpan() and Date_Calc::endOfMonthBySpan() -
+December was always shifted up one year
+--FILE--
+<?php
+/**
+ * Test for: Date_Calc
+ * Parts tested: Date_Calc::beginOfMonthBySpan()
+ */
+
+require_once 'Date/Calc.php';
+
+$DateCalc = new Date_Calc();
+
+$month = 1;     // January
+$year = 2006;   // Year
+$sequence = 25; // Number of sequence
+
+$out = '';
+for ($months = 1; $months <= $sequence; $months++) {
+    $date = $DateCalc->beginOfMonthBySpan(-$months, $month, $year, '%d.%m.%Y');
+    $date_ex = explode('.', $date);
+    $out = sprintf('%d - %s.%s.%s', $months, $date_ex[0], $date_ex[1], $date_ex[2]);
+
+    if ($date_ex[1] == 12) {
+        $out .= ' **';
+    }
+
+    echo $out . "\n";
+}
+
+echo "\n";
+
+$out = '';
+for ($months = 1; $months <= $sequence; $months++) {
+    $date = $DateCalc->endOfMonthBySpan(-$months, $month, $year, '%d.%m.%Y');
+    $date_ex = explode('.', $date);
+    $out = sprintf('%d - %s.%s.%s', $months, $date_ex[0], $date_ex[1], $date_ex[2]);
+
+    if ($date_ex[1] == 12) {
+        $out .= ' **';
+    }
+
+    echo $out . "\n";
+}
+?>
+--EXPECT--
+1 - 01.12.2005 **
+2 - 01.11.2005
+3 - 01.10.2005
+4 - 01.09.2005
+5 - 01.08.2005
+6 - 01.07.2005
+7 - 01.06.2005
+8 - 01.05.2005
+9 - 01.04.2005
+10 - 01.03.2005
+11 - 01.02.2005
+12 - 01.01.2005
+13 - 01.12.2004 **
+14 - 01.11.2004
+15 - 01.10.2004
+16 - 01.09.2004
+17 - 01.08.2004
+18 - 01.07.2004
+19 - 01.06.2004
+20 - 01.05.2004
+21 - 01.04.2004
+22 - 01.03.2004
+23 - 01.02.2004
+24 - 01.01.2004
+25 - 01.12.2003 **
+
+1 - 31.12.2005 **
+2 - 30.11.2005
+3 - 31.10.2005
+4 - 30.09.2005
+5 - 31.08.2005
+6 - 31.07.2005
+7 - 30.06.2005
+8 - 31.05.2005
+9 - 30.04.2005
+10 - 31.03.2005
+11 - 28.02.2005
+12 - 31.01.2005
+13 - 31.12.2004 **
+14 - 30.11.2004
+15 - 31.10.2004
+16 - 30.09.2004
+17 - 31.08.2004
+18 - 31.07.2004
+19 - 30.06.2004
+20 - 31.05.2004
+21 - 30.04.2004
+22 - 31.03.2004
+23 - 29.02.2004
+24 - 31.01.2004
+25 - 31.12.2003 **
diff --git a/extlib/Date/tests/bugs/bug-967.phpt b/extlib/Date/tests/bugs/bug-967.phpt
new file mode 100644 (file)
index 0000000..a54d747
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Bug #967: Date_TimeZone uses a bad global variable
+--FILE--
+<?php
+/**
+ * Test for: Date_TimeZone
+ * Parts tested: Date_TimeZone::setDefault() and Date_TimeZone::getDefault()
+ */
+
+require_once 'Date/TimeZone.php';
+
+// Sets default timezone via a global variable.
+$_DATE_TIMEZONE_DEFAULT = 'Pacific/Chatham';
+$tz = Date_TimeZone::getDefault();
+echo 'Date_TimeZone::$id = ' . $tz->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
diff --git a/extlib/Date/tests/bugs/bug-9801.phpt b/extlib/Date/tests/bugs/bug-9801.phpt
new file mode 100644 (file)
index 0000000..553a3c9
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Bug #9801: Date::compare() modify params on PHP5
+--FILE--
+<?php
+/**
+ * Test for: Date class
+ * Parts tested: Date::compare()
+ */
+
+require_once 'Date.php';
+
+// $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = 'Canada/Eastern';
+
+$d1 = new Date();
+$d2 = new Date();
+$d1->setTZbyID('Canada/Eastern');
+$d2->setTZbyID('Canada/Eastern');
+
+echo 'Timezone (before): ' . $d1->tz->getId() . "\n";
+
+Date::compare($d1, $d2);
+
+echo 'Timezone (after): ' . $d1->tz->getId() . "\n";
+?>
+--EXPECT--
+Timezone (before): Canada/Eastern
+Timezone (after): Canada/Eastern
diff --git a/extlib/Date/tests/calc.php b/extlib/Date/tests/calc.php
new file mode 100755 (executable)
index 0000000..ae1df20
--- /dev/null
@@ -0,0 +1,408 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * 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.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 1997-2005 Daniel Convissor <danielc@php.net>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  Copyright (c) 1997-2005 Daniel Convissor <danielc@php.net>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @version    CVS: $Id$
+ * @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 "<pre>\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::dayOfYear(22, 11, 2000), 'dayOfYear');
+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::dayOfYear('22', '11', '2000'), 'dayOfYear 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');
diff --git a/extlib/Date/tests/test_addseconds.php b/extlib/Date/tests/test_addseconds.php
new file mode 100644 (file)
index 0000000..6d7439a
--- /dev/null
@@ -0,0 +1,447 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc::addSeconds() function
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+
+$date = new Date(
+    "1972-07-01 00:59:58.987654",
+    true
+); // count leap seconds
+$date->setTZbyID("Europe/London");
+
+$datetest = new Date($date);
+$datetest->addSeconds(1, true);
+compare("01/07/1972 00.59.59.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1");
+$datetest = new Date($date);
+$datetest->addSeconds(2, true);
+compare("01/07/1972 00.59.60.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "2"); // leap second
+$datetest = new Date($date);
+$datetest->addSeconds(3, true);
+compare("01/07/1972 01.00.00.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3");
+$datetest = new Date($date);
+$datetest->addSeconds(4, true);
+compare("01/07/1972 01.00.01.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "4");
+$datetest = new Date($date);
+$datetest->addSeconds(5, true);
+compare("01/07/1972 01.00.02.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "5");
+$datetest = new Date($date);
+$datetest->addSeconds(6, true);
+compare("01/07/1972 01.00.03.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "6");
+$datetest = new Date($date);
+$datetest->addSeconds(7, true);
+compare("01/07/1972 01.00.04.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7");
+$datetest = new Date($date);
+$datetest->addSeconds(8, true);
+compare("01/07/1972 01.00.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "8");
+$datetest = new Date($date);
+$datetest->addSeconds(9, true);
+compare("01/07/1972 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "9");
+$datetest = new Date($date);
+$datetest->addSeconds(10, true);
+compare("01/07/1972 01.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "10");
+$datetest = new Date($date);
+$datetest->addSeconds(60, true);
+compare("01/07/1972 01.00.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "60");
+$datetest = new Date($date);
+$datetest->addSeconds(3599, true);
+compare("01/07/1972 01.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3599");
+$datetest = new Date($date);
+$datetest->addSeconds(3600, true);
+compare("01/07/1972 01.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3600");
+$datetest = new Date($date);
+$datetest->addSeconds(3601, true);
+compare("01/07/1972 01.59.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3601");
+$datetest = new Date($date);
+$datetest->addSeconds(7199, true);
+compare("01/07/1972 02.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7199");
+$datetest = new Date($date);
+$datetest->addSeconds(7200, true);
+compare("01/07/1972 02.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7200");
+$datetest = new Date($date);
+$datetest->addSeconds(7201, true);
+compare("01/07/1972 02.59.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7201");
+$datetest = new Date($date);
+$datetest->addSeconds(86400, true);
+compare("02/07/1972 00.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "86400");
+$datetest = new Date($date);
+$datetest->addSeconds(864000, true);
+compare("11/07/1972 00.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "864000");
+$datetest = new Date($date);
+$datetest->addSeconds(8640000, true);
+compare("09/10/1972 00.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "8640000");
+$datetest = new Date($date);
+$datetest->addSeconds(31622400, true);
+compare("02/07/1973 00.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "31622400"); // 2 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(63244800, true);
+compare("03/07/1974 00.59.55.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "63244800"); // 3 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(94867200, true);
+compare("04/07/1975 00.59.54.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "94867200"); // 4 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(126489600, true);
+compare("04/07/1976 00.59.53.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "126489600"); // etc.
+$datetest = new Date($date);
+$datetest->addSeconds(158112000, true);
+compare("05/07/1977 00.59.52.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "158112000");
+$datetest = new Date($date);
+$datetest->addSeconds(189734400, true);
+compare("06/07/1978 00.59.51.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "189734400");
+$datetest = new Date($date);
+$datetest->addSeconds(221356800, true);
+compare("07/07/1979 00.59.50.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "221356800");
+$datetest = new Date($date);
+$datetest->addSeconds(252979200, true);
+compare("07/07/1980 00.59.49.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "252979200");
+$datetest = new Date($date);
+$datetest->addSeconds(284601600, true);
+compare("08/07/1981 00.59.48.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "284601600"); // leap second in June 1981
+$datetest = new Date($date);
+$datetest->addSeconds(316224000, true);
+compare("09/07/1982 00.59.47.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "316224000");
+$datetest = new Date($date);
+$datetest->addSeconds(347846400, true);
+compare("10/07/1983 00.59.46.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "347846400");
+$datetest = new Date($date);
+$datetest->addSeconds(379468800, true);
+compare("10/07/1984 00.59.46.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "379468800"); // no leap second in 1984
+$datetest = new Date($date);
+$datetest->addSeconds(411091200, true);
+compare("11/07/1985 00.59.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "411091200"); // leap second in June 1985
+$datetest = new Date($date);
+$datetest->addSeconds(442713600, true);
+compare("12/07/1986 00.59.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "442713600"); // no leap second in 1986
+$datetest = new Date($date);
+$datetest->addSeconds(474336000, true);
+compare("13/07/1987 00.59.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "474336000");
+$datetest = new Date($date);
+$datetest->addSeconds(505958400, true);
+compare("13/07/1988 00.59.44.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "505958400"); // leap second in Dec 1987
+$datetest = new Date($date);
+$datetest->addSeconds(537580800, true);
+compare("14/07/1989 00.59.44.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "537580800");
+$datetest = new Date($date);
+$datetest->addSeconds(569203200, true);
+compare("15/07/1990 00.59.43.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "569203200");
+$datetest = new Date($date);
+$datetest->addSeconds(600825600, true);
+compare("16/07/1991 00.59.42.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "600825600");
+$datetest = new Date($date);
+$datetest->addSeconds(632448000, true);
+compare("16/07/1992 00.59.41.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "632448000");
+$datetest = new Date($date);
+$datetest->addSeconds(664070400, true);
+compare("17/07/1993 00.59.40.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "664070400");
+$datetest = new Date($date);
+$datetest->addSeconds(695692800, true);
+compare("18/07/1994 00.59.39.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "695692800");
+$datetest = new Date($date);
+$datetest->addSeconds(727315200, true);
+compare("19/07/1995 00.59.39.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "727315200");
+$datetest = new Date($date);
+$datetest->addSeconds(758937600, true);
+compare("19/07/1996 00.59.38.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "758937600");
+$datetest = new Date($date);
+$datetest->addSeconds(790560000, true);
+compare("20/07/1997 00.59.37.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "790560000");
+$datetest = new Date($date);
+$datetest->addSeconds(822182400, true);
+compare("21/07/1998 00.59.37.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "822182400");
+$datetest = new Date($date);
+$datetest->addSeconds(853804800, true);
+compare("22/07/1999 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "853804800");
+$datetest = new Date($date);
+$datetest->addSeconds(885427200, true);
+compare("22/07/2000 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "885427200");
+$datetest = new Date($date);
+$datetest->addSeconds(917049600, true);
+compare("23/07/2001 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "917049600");
+$datetest = new Date($date);
+$datetest->addSeconds(948672000, true);
+compare("24/07/2002 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "948672000");
+$datetest = new Date($date);
+$datetest->addSeconds(980294400, true);
+compare("25/07/2003 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "980294400");
+$datetest = new Date($date);
+$datetest->addSeconds(1011916800, true);
+compare("25/07/2004 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1011916800");
+$datetest = new Date($date);
+$datetest->addSeconds(1043539200, true);
+compare("26/07/2005 00.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1043539200");
+$datetest = new Date($date);
+$datetest->addSeconds(1075161600, true);
+compare("27/07/2006 00.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1075161600"); // 23rd leap second in Dec 2005
+$datetest = new Date($date);
+$datetest->addSeconds(1106784000, true);
+compare("28/07/2007 00.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1106784000");
+$datetest = new Date($date);
+$datetest->addSeconds(1138406400, true);
+compare("28/07/2008 00.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1138406400");
+$datetest = new Date($date);
+$datetest->addSeconds(1170028800, true);
+compare("29/07/2009 00.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1170028800");
+
+
+$date->setDate("2006-01-01 00:00:05.987654");
+
+$datetest = new Date($date);
+$datetest->addSeconds(-1, true);
+compare("01/01/2006 00.00.04.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1");
+$datetest = new Date($date);
+$datetest->addSeconds(-2, true);
+compare("01/01/2006 00.00.03.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-2");
+$datetest = new Date($date);
+$datetest->addSeconds(-3, true);
+compare("01/01/2006 00.00.02.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3");
+$datetest = new Date($date);
+$datetest->addSeconds(-4, true);
+compare("01/01/2006 00.00.01.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-4");
+$datetest = new Date($date);
+$datetest->addSeconds(-5, true);
+compare("01/01/2006 00.00.00.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-5");
+$datetest = new Date($date);
+$datetest->addSeconds(-6, true);
+compare("31/12/2005 23.59.60.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-6"); // leap second
+$datetest = new Date($date);
+$datetest->addSeconds(-7, true);
+compare("31/12/2005 23.59.59.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7");
+$datetest = new Date($date);
+$datetest->addSeconds(-8, true);
+compare("31/12/2005 23.59.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-8");
+$datetest = new Date($date);
+$datetest->addSeconds(-9, true);
+compare("31/12/2005 23.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-9");
+$datetest = new Date($date);
+$datetest->addSeconds(-10, true);
+compare("31/12/2005 23.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-10");
+$datetest = new Date($date);
+$datetest->addSeconds(-60, true);
+compare("31/12/2005 23.59.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-60");
+$datetest = new Date($date);
+$datetest->addSeconds(-3599, true);
+compare("31/12/2005 23.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3599");
+$datetest = new Date($date);
+$datetest->addSeconds(-3600, true);
+compare("31/12/2005 23.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3600");
+$datetest = new Date($date);
+$datetest->addSeconds(-3601, true);
+compare("31/12/2005 23.00.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3601");
+$datetest = new Date($date);
+$datetest->addSeconds(-7199, true);
+compare("31/12/2005 22.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7199");
+$datetest = new Date($date);
+$datetest->addSeconds(-7200, true);
+compare("31/12/2005 22.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7200");
+$datetest = new Date($date);
+$datetest->addSeconds(-7201, true);
+compare("31/12/2005 22.00.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7201");
+$datetest = new Date($date);
+$datetest->addSeconds(-86400, true);
+compare("31/12/2005 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-86400");
+$datetest = new Date($date);
+$datetest->addSeconds(-864000, true);
+compare("22/12/2005 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-864000");
+$datetest = new Date($date);
+$datetest->addSeconds(-8640000, true);
+compare("23/09/2005 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-8640000");
+$datetest = new Date($date);
+$datetest->addSeconds(-31622400, true);
+compare("31/12/2004 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-31622400");
+$datetest = new Date($date);
+$datetest->addSeconds(-63244800, true);
+compare("31/12/2003 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-63244800");
+$datetest = new Date($date);
+$datetest->addSeconds(-94867200, true);
+compare("30/12/2002 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-94867200");
+$datetest = new Date($date);
+$datetest->addSeconds(-126489600, true);
+compare("29/12/2001 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-126489600");
+$datetest = new Date($date);
+$datetest->addSeconds(-158112000, true);
+compare("28/12/2000 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-158112000");
+$datetest = new Date($date);
+$datetest->addSeconds(-189734400, true);
+compare("28/12/1999 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-189734400");
+$datetest = new Date($date);
+$datetest->addSeconds(-221356800, true);
+compare("27/12/1998 00.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-221356800"); // 2 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(-252979200, true);
+compare("26/12/1997 00.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-252979200");
+$datetest = new Date($date);
+$datetest->addSeconds(-284601600, true);
+compare("25/12/1996 00.00.08.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-284601600"); // leap second in June 1997
+$datetest = new Date($date);
+$datetest->addSeconds(-316224000, true);
+compare("25/12/1995 00.00.09.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-316224000"); // leap second in Dec 1995
+$datetest = new Date($date);
+$datetest->addSeconds(-347846400, true);
+compare("24/12/1994 00.00.09.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-347846400");
+$datetest = new Date($date);
+$datetest->addSeconds(-379468800, true);
+compare("23/12/1993 00.00.10.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-379468800"); // leap second in June 1994
+$datetest = new Date($date);
+$datetest->addSeconds(-411091200, true);
+compare("22/12/1992 00.00.11.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-411091200"); // leap second in June 1993
+$datetest = new Date($date);
+$datetest->addSeconds(-442713600, true);
+compare("22/12/1991 00.00.12.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-442713600"); // leap second in June 1992
+$datetest = new Date($date);
+$datetest->addSeconds(-474336000, true);
+compare("21/12/1990 00.00.13.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-474336000"); // leap second in Dec 1990
+$datetest = new Date($date);
+$datetest->addSeconds(-505958400, true);
+compare("20/12/1989 00.00.14.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-505958400"); // leap second in Dec 1989
+$datetest = new Date($date);
+$datetest->addSeconds(-537580800, true);
+compare("19/12/1988 00.00.14.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-537580800");
+$datetest = new Date($date);
+$datetest->addSeconds(-569203200, true);
+compare("19/12/1987 00.00.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-569203200"); // leap second in Dec 1987
+$datetest = new Date($date);
+$datetest->addSeconds(-600825600, true);
+compare("18/12/1986 00.00.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-600825600");
+$datetest = new Date($date);
+$datetest->addSeconds(-632448000, true);
+compare("17/12/1985 00.00.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-632448000");
+$datetest = new Date($date);
+$datetest->addSeconds(-664070400, true);
+compare("16/12/1984 00.00.16.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-664070400"); // leap second in June 1985
+$datetest = new Date($date);
+$datetest->addSeconds(-695692800, true);
+compare("16/12/1983 00.00.16.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-695692800");
+$datetest = new Date($date);
+$datetest->addSeconds(-727315200, true);
+compare("15/12/1982 00.00.17.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-727315200");
+$datetest = new Date($date);
+$datetest->addSeconds(-758937600, true);
+compare("14/12/1981 00.00.18.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-758937600");
+$datetest = new Date($date);
+$datetest->addSeconds(-790560000, true);
+compare("13/12/1980 00.00.19.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-790560000");
+$datetest = new Date($date);
+$datetest->addSeconds(-822182400, true);
+compare("13/12/1979 00.00.20.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-822182400");
+$datetest = new Date($date);
+$datetest->addSeconds(-853804800, true);
+compare("12/12/1978 00.00.21.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-853804800");
+$datetest = new Date($date);
+$datetest->addSeconds(-885427200, true);
+compare("11/12/1977 00.00.22.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-885427200");
+$datetest = new Date($date);
+$datetest->addSeconds(-917049600, true);
+compare("10/12/1976 00.00.23.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-917049600");
+$datetest = new Date($date);
+$datetest->addSeconds(-948672000, true);
+compare("10/12/1975 00.00.24.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-948672000");
+$datetest = new Date($date);
+$datetest->addSeconds(-980294400, true);
+compare("09/12/1974 00.00.25.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-980294400");
+$datetest = new Date($date);
+$datetest->addSeconds(-1011916800, true);
+compare("08/12/1973 00.00.26.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1011916800");
+$datetest = new Date($date);
+$datetest->addSeconds(-1043539200, true);
+compare("07/12/1972 00.00.27.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1043539200");
+$datetest = new Date($date);
+$datetest->addSeconds(-1075161600, true);
+compare("07/12/1971 00.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1075161600"); // 23 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(-1106784000, true);
+compare("06/12/1970 00.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1106784000");
+$datetest = new Date($date);
+$datetest->addSeconds(-1138406400, true);
+compare("05/12/1969 00.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1138406400");
+$datetest = new Date($date);
+$datetest->addSeconds(-1170028800, true);
+compare("04/12/1968 00.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1170028800");
diff --git a/extlib/Date/tests/test_addseconds_Calcutta.php b/extlib/Date/tests/test_addseconds_Calcutta.php
new file mode 100644 (file)
index 0000000..b04462e
--- /dev/null
@@ -0,0 +1,447 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc::addSeconds() function
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+
+$date = new Date(
+    "1972-07-01 05:29:58.987654",
+    true
+); // count leap seconds
+$date->setTZbyID("Asia/Calcutta");
+
+$datetest = new Date($date);
+$datetest->addSeconds(1, true);
+compare("01/07/1972 05.29.59.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1");
+$datetest = new Date($date);
+$datetest->addSeconds(2, true);
+compare("01/07/1972 05.29.60.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "2"); // leap second
+$datetest = new Date($date);
+$datetest->addSeconds(3, true);
+compare("01/07/1972 05.30.00.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3");
+$datetest = new Date($date);
+$datetest->addSeconds(4, true);
+compare("01/07/1972 05.30.01.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "4");
+$datetest = new Date($date);
+$datetest->addSeconds(5, true);
+compare("01/07/1972 05.30.02.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "5");
+$datetest = new Date($date);
+$datetest->addSeconds(6, true);
+compare("01/07/1972 05.30.03.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "6");
+$datetest = new Date($date);
+$datetest->addSeconds(7, true);
+compare("01/07/1972 05.30.04.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7");
+$datetest = new Date($date);
+$datetest->addSeconds(8, true);
+compare("01/07/1972 05.30.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "8");
+$datetest = new Date($date);
+$datetest->addSeconds(9, true);
+compare("01/07/1972 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "9");
+$datetest = new Date($date);
+$datetest->addSeconds(10, true);
+compare("01/07/1972 05.30.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "10");
+$datetest = new Date($date);
+$datetest->addSeconds(60, true);
+compare("01/07/1972 05.30.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "60");
+$datetest = new Date($date);
+$datetest->addSeconds(3599, true);
+compare("01/07/1972 06.29.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3599");
+$datetest = new Date($date);
+$datetest->addSeconds(3600, true);
+compare("01/07/1972 06.29.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3600");
+$datetest = new Date($date);
+$datetest->addSeconds(3601, true);
+compare("01/07/1972 06.29.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3601");
+$datetest = new Date($date);
+$datetest->addSeconds(7199, true);
+compare("01/07/1972 07.29.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7199");
+$datetest = new Date($date);
+$datetest->addSeconds(7200, true);
+compare("01/07/1972 07.29.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7200");
+$datetest = new Date($date);
+$datetest->addSeconds(7201, true);
+compare("01/07/1972 07.29.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7201");
+$datetest = new Date($date);
+$datetest->addSeconds(86400, true);
+compare("02/07/1972 05.29.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "86400");
+$datetest = new Date($date);
+$datetest->addSeconds(864000, true);
+compare("11/07/1972 05.29.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "864000");
+$datetest = new Date($date);
+$datetest->addSeconds(8640000, true);
+compare("09/10/1972 05.29.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "8640000");
+$datetest = new Date($date);
+$datetest->addSeconds(31622400, true);
+compare("02/07/1973 05.29.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "31622400"); // 2 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(63244800, true);
+compare("03/07/1974 05.29.55.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "63244800"); // 3 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(94867200, true);
+compare("04/07/1975 05.29.54.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "94867200"); // 4 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(126489600, true);
+compare("04/07/1976 05.29.53.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "126489600"); // etc.
+$datetest = new Date($date);
+$datetest->addSeconds(158112000, true);
+compare("05/07/1977 05.29.52.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "158112000");
+$datetest = new Date($date);
+$datetest->addSeconds(189734400, true);
+compare("06/07/1978 05.29.51.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "189734400");
+$datetest = new Date($date);
+$datetest->addSeconds(221356800, true);
+compare("07/07/1979 05.29.50.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "221356800");
+$datetest = new Date($date);
+$datetest->addSeconds(252979200, true);
+compare("07/07/1980 05.29.49.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "252979200");
+$datetest = new Date($date);
+$datetest->addSeconds(284601600, true);
+compare("08/07/1981 05.29.48.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "284601600"); // leap second in June 1981
+$datetest = new Date($date);
+$datetest->addSeconds(316224000, true);
+compare("09/07/1982 05.29.47.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "316224000");
+$datetest = new Date($date);
+$datetest->addSeconds(347846400, true);
+compare("10/07/1983 05.29.46.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "347846400");
+$datetest = new Date($date);
+$datetest->addSeconds(379468800, true);
+compare("10/07/1984 05.29.46.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "379468800"); // no leap second in 1984
+$datetest = new Date($date);
+$datetest->addSeconds(411091200, true);
+compare("11/07/1985 05.29.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "411091200"); // leap second in June 1985
+$datetest = new Date($date);
+$datetest->addSeconds(442713600, true);
+compare("12/07/1986 05.29.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "442713600"); // no leap second in 1986
+$datetest = new Date($date);
+$datetest->addSeconds(474336000, true);
+compare("13/07/1987 05.29.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "474336000");
+$datetest = new Date($date);
+$datetest->addSeconds(505958400, true);
+compare("13/07/1988 05.29.44.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "505958400"); // leap second in Dec 1987
+$datetest = new Date($date);
+$datetest->addSeconds(537580800, true);
+compare("14/07/1989 05.29.44.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "537580800");
+$datetest = new Date($date);
+$datetest->addSeconds(569203200, true);
+compare("15/07/1990 05.29.43.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "569203200");
+$datetest = new Date($date);
+$datetest->addSeconds(600825600, true);
+compare("16/07/1991 05.29.42.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "600825600");
+$datetest = new Date($date);
+$datetest->addSeconds(632448000, true);
+compare("16/07/1992 05.29.41.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "632448000");
+$datetest = new Date($date);
+$datetest->addSeconds(664070400, true);
+compare("17/07/1993 05.29.40.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "664070400");
+$datetest = new Date($date);
+$datetest->addSeconds(695692800, true);
+compare("18/07/1994 05.29.39.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "695692800");
+$datetest = new Date($date);
+$datetest->addSeconds(727315200, true);
+compare("19/07/1995 05.29.39.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "727315200");
+$datetest = new Date($date);
+$datetest->addSeconds(758937600, true);
+compare("19/07/1996 05.29.38.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "758937600");
+$datetest = new Date($date);
+$datetest->addSeconds(790560000, true);
+compare("20/07/1997 05.29.37.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "790560000");
+$datetest = new Date($date);
+$datetest->addSeconds(822182400, true);
+compare("21/07/1998 05.29.37.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "822182400");
+$datetest = new Date($date);
+$datetest->addSeconds(853804800, true);
+compare("22/07/1999 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "853804800");
+$datetest = new Date($date);
+$datetest->addSeconds(885427200, true);
+compare("22/07/2000 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "885427200");
+$datetest = new Date($date);
+$datetest->addSeconds(917049600, true);
+compare("23/07/2001 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "917049600");
+$datetest = new Date($date);
+$datetest->addSeconds(948672000, true);
+compare("24/07/2002 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "948672000");
+$datetest = new Date($date);
+$datetest->addSeconds(980294400, true);
+compare("25/07/2003 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "980294400");
+$datetest = new Date($date);
+$datetest->addSeconds(1011916800, true);
+compare("25/07/2004 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1011916800");
+$datetest = new Date($date);
+$datetest->addSeconds(1043539200, true);
+compare("26/07/2005 05.29.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1043539200");
+$datetest = new Date($date);
+$datetest->addSeconds(1075161600, true);
+compare("27/07/2006 05.29.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1075161600"); // 23rd leap second in Dec 2005
+$datetest = new Date($date);
+$datetest->addSeconds(1106784000, true);
+compare("28/07/2007 05.29.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1106784000");
+$datetest = new Date($date);
+$datetest->addSeconds(1138406400, true);
+compare("28/07/2008 05.29.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1138406400");
+$datetest = new Date($date);
+$datetest->addSeconds(1170028800, true);
+compare("29/07/2009 05.29.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1170028800");
+
+
+$date->setDate("2006-01-01 05:30:05.987654");
+
+$datetest = new Date($date);
+$datetest->addSeconds(-1, true);
+compare("01/01/2006 05.30.04.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1");
+$datetest = new Date($date);
+$datetest->addSeconds(-2, true);
+compare("01/01/2006 05.30.03.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-2");
+$datetest = new Date($date);
+$datetest->addSeconds(-3, true);
+compare("01/01/2006 05.30.02.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3");
+$datetest = new Date($date);
+$datetest->addSeconds(-4, true);
+compare("01/01/2006 05.30.01.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-4");
+$datetest = new Date($date);
+$datetest->addSeconds(-5, true);
+compare("01/01/2006 05.30.00.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-5");
+$datetest = new Date($date);
+$datetest->addSeconds(-6, true);
+compare("01/01/2006 05.29.60.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-6"); // leap second
+$datetest = new Date($date);
+$datetest->addSeconds(-7, true);
+compare("01/01/2006 05.29.59.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7");
+$datetest = new Date($date);
+$datetest->addSeconds(-8, true);
+compare("01/01/2006 05.29.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-8");
+$datetest = new Date($date);
+$datetest->addSeconds(-9, true);
+compare("01/01/2006 05.29.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-9");
+$datetest = new Date($date);
+$datetest->addSeconds(-10, true);
+compare("01/01/2006 05.29.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-10");
+$datetest = new Date($date);
+$datetest->addSeconds(-60, true);
+compare("01/01/2006 05.29.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-60");
+$datetest = new Date($date);
+$datetest->addSeconds(-3599, true);
+compare("01/01/2006 04.30.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3599");
+$datetest = new Date($date);
+$datetest->addSeconds(-3600, true);
+compare("01/01/2006 04.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3600");
+$datetest = new Date($date);
+$datetest->addSeconds(-3601, true);
+compare("01/01/2006 04.30.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3601");
+$datetest = new Date($date);
+$datetest->addSeconds(-7199, true);
+compare("01/01/2006 03.30.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7199");
+$datetest = new Date($date);
+$datetest->addSeconds(-7200, true);
+compare("01/01/2006 03.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7200");
+$datetest = new Date($date);
+$datetest->addSeconds(-7201, true);
+compare("01/01/2006 03.30.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7201");
+$datetest = new Date($date);
+$datetest->addSeconds(-86400, true);
+compare("31/12/2005 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-86400");
+$datetest = new Date($date);
+$datetest->addSeconds(-864000, true);
+compare("22/12/2005 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-864000");
+$datetest = new Date($date);
+$datetest->addSeconds(-8640000, true);
+compare("23/09/2005 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-8640000");
+$datetest = new Date($date);
+$datetest->addSeconds(-31622400, true);
+compare("31/12/2004 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-31622400");
+$datetest = new Date($date);
+$datetest->addSeconds(-63244800, true);
+compare("31/12/2003 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-63244800");
+$datetest = new Date($date);
+$datetest->addSeconds(-94867200, true);
+compare("30/12/2002 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-94867200");
+$datetest = new Date($date);
+$datetest->addSeconds(-126489600, true);
+compare("29/12/2001 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-126489600");
+$datetest = new Date($date);
+$datetest->addSeconds(-158112000, true);
+compare("28/12/2000 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-158112000");
+$datetest = new Date($date);
+$datetest->addSeconds(-189734400, true);
+compare("28/12/1999 05.30.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-189734400");
+$datetest = new Date($date);
+$datetest->addSeconds(-221356800, true);
+compare("27/12/1998 05.30.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-221356800"); // 2 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(-252979200, true);
+compare("26/12/1997 05.30.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-252979200");
+$datetest = new Date($date);
+$datetest->addSeconds(-284601600, true);
+compare("25/12/1996 05.30.08.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-284601600"); // leap second in June 1997
+$datetest = new Date($date);
+$datetest->addSeconds(-316224000, true);
+compare("25/12/1995 05.30.09.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-316224000"); // leap second in Dec 1995
+$datetest = new Date($date);
+$datetest->addSeconds(-347846400, true);
+compare("24/12/1994 05.30.09.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-347846400");
+$datetest = new Date($date);
+$datetest->addSeconds(-379468800, true);
+compare("23/12/1993 05.30.10.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-379468800"); // leap second in June 1994
+$datetest = new Date($date);
+$datetest->addSeconds(-411091200, true);
+compare("22/12/1992 05.30.11.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-411091200"); // leap second in June 1993
+$datetest = new Date($date);
+$datetest->addSeconds(-442713600, true);
+compare("22/12/1991 05.30.12.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-442713600"); // leap second in June 1992
+$datetest = new Date($date);
+$datetest->addSeconds(-474336000, true);
+compare("21/12/1990 05.30.13.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-474336000"); // leap second in Dec 1990
+$datetest = new Date($date);
+$datetest->addSeconds(-505958400, true);
+compare("20/12/1989 05.30.14.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-505958400"); // leap second in Dec 1989
+$datetest = new Date($date);
+$datetest->addSeconds(-537580800, true);
+compare("19/12/1988 05.30.14.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-537580800");
+$datetest = new Date($date);
+$datetest->addSeconds(-569203200, true);
+compare("19/12/1987 05.30.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-569203200"); // leap second in Dec 1987
+$datetest = new Date($date);
+$datetest->addSeconds(-600825600, true);
+compare("18/12/1986 05.30.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-600825600");
+$datetest = new Date($date);
+$datetest->addSeconds(-632448000, true);
+compare("17/12/1985 05.30.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-632448000");
+$datetest = new Date($date);
+$datetest->addSeconds(-664070400, true);
+compare("16/12/1984 05.30.16.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-664070400"); // leap second in June 1985
+$datetest = new Date($date);
+$datetest->addSeconds(-695692800, true);
+compare("16/12/1983 05.30.16.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-695692800");
+$datetest = new Date($date);
+$datetest->addSeconds(-727315200, true);
+compare("15/12/1982 05.30.17.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-727315200");
+$datetest = new Date($date);
+$datetest->addSeconds(-758937600, true);
+compare("14/12/1981 05.30.18.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-758937600");
+$datetest = new Date($date);
+$datetest->addSeconds(-790560000, true);
+compare("13/12/1980 05.30.19.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-790560000");
+$datetest = new Date($date);
+$datetest->addSeconds(-822182400, true);
+compare("13/12/1979 05.30.20.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-822182400");
+$datetest = new Date($date);
+$datetest->addSeconds(-853804800, true);
+compare("12/12/1978 05.30.21.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-853804800");
+$datetest = new Date($date);
+$datetest->addSeconds(-885427200, true);
+compare("11/12/1977 05.30.22.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-885427200");
+$datetest = new Date($date);
+$datetest->addSeconds(-917049600, true);
+compare("10/12/1976 05.30.23.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-917049600");
+$datetest = new Date($date);
+$datetest->addSeconds(-948672000, true);
+compare("10/12/1975 05.30.24.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-948672000");
+$datetest = new Date($date);
+$datetest->addSeconds(-980294400, true);
+compare("09/12/1974 05.30.25.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-980294400");
+$datetest = new Date($date);
+$datetest->addSeconds(-1011916800, true);
+compare("08/12/1973 05.30.26.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1011916800");
+$datetest = new Date($date);
+$datetest->addSeconds(-1043539200, true);
+compare("07/12/1972 05.30.27.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1043539200");
+$datetest = new Date($date);
+$datetest->addSeconds(-1075161600, true);
+compare("07/12/1971 05.30.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1075161600"); // 23 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(-1106784000, true);
+compare("06/12/1970 05.30.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1106784000");
+$datetest = new Date($date);
+$datetest->addSeconds(-1138406400, true);
+compare("05/12/1969 05.30.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1138406400");
+$datetest = new Date($date);
+$datetest->addSeconds(-1170028800, true);
+compare("04/12/1968 05.30.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1170028800");
diff --git a/extlib/Date/tests/test_addseconds_Paris.php b/extlib/Date/tests/test_addseconds_Paris.php
new file mode 100644 (file)
index 0000000..75445f6
--- /dev/null
@@ -0,0 +1,447 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc::addSeconds() function
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+
+$date = new Date(
+    "1972-07-01 01:59:58.987654",
+    true
+); // count leap seconds
+$date->setTZbyID("Europe/Paris");
+
+$datetest = new Date($date);
+$datetest->addSeconds(1, true);
+compare("01/07/1972 01.59.59.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1");
+$datetest = new Date($date);
+$datetest->addSeconds(2, true);
+compare("01/07/1972 01.59.60.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "2"); // leap second
+$datetest = new Date($date);
+$datetest->addSeconds(3, true);
+compare("01/07/1972 02.00.00.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3");
+$datetest = new Date($date);
+$datetest->addSeconds(4, true);
+compare("01/07/1972 02.00.01.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "4");
+$datetest = new Date($date);
+$datetest->addSeconds(5, true);
+compare("01/07/1972 02.00.02.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "5");
+$datetest = new Date($date);
+$datetest->addSeconds(6, true);
+compare("01/07/1972 02.00.03.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "6");
+$datetest = new Date($date);
+$datetest->addSeconds(7, true);
+compare("01/07/1972 02.00.04.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7");
+$datetest = new Date($date);
+$datetest->addSeconds(8, true);
+compare("01/07/1972 02.00.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "8");
+$datetest = new Date($date);
+$datetest->addSeconds(9, true);
+compare("01/07/1972 02.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "9");
+$datetest = new Date($date);
+$datetest->addSeconds(10, true);
+compare("01/07/1972 02.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "10");
+$datetest = new Date($date);
+$datetest->addSeconds(60, true);
+compare("01/07/1972 02.00.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "60");
+$datetest = new Date($date);
+$datetest->addSeconds(3599, true);
+compare("01/07/1972 02.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3599");
+$datetest = new Date($date);
+$datetest->addSeconds(3600, true);
+compare("01/07/1972 02.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3600");
+$datetest = new Date($date);
+$datetest->addSeconds(3601, true);
+compare("01/07/1972 02.59.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "3601");
+$datetest = new Date($date);
+$datetest->addSeconds(7199, true);
+compare("01/07/1972 03.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7199");
+$datetest = new Date($date);
+$datetest->addSeconds(7200, true);
+compare("01/07/1972 03.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7200");
+$datetest = new Date($date);
+$datetest->addSeconds(7201, true);
+compare("01/07/1972 03.59.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "7201");
+$datetest = new Date($date);
+$datetest->addSeconds(86400, true);
+compare("02/07/1972 01.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "86400");
+$datetest = new Date($date);
+$datetest->addSeconds(864000, true);
+compare("11/07/1972 01.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "864000");
+$datetest = new Date($date);
+$datetest->addSeconds(8640000, true);
+compare("09/10/1972 01.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "8640000");
+$datetest = new Date($date);
+$datetest->addSeconds(31622400, true);
+compare("02/07/1973 01.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "31622400"); // 2 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(63244800, true);
+compare("03/07/1974 01.59.55.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "63244800"); // 3 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(94867200, true);
+compare("04/07/1975 01.59.54.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "94867200"); // 4 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(126489600, true);
+compare("04/07/1976 01.59.53.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "126489600"); // etc.
+$datetest = new Date($date);
+$datetest->addSeconds(158112000, true);
+compare("05/07/1977 01.59.52.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "158112000");
+$datetest = new Date($date);
+$datetest->addSeconds(189734400, true);
+compare("06/07/1978 01.59.51.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "189734400");
+$datetest = new Date($date);
+$datetest->addSeconds(221356800, true);
+compare("07/07/1979 01.59.50.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "221356800");
+$datetest = new Date($date);
+$datetest->addSeconds(252979200, true);
+compare("07/07/1980 01.59.49.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "252979200");
+$datetest = new Date($date);
+$datetest->addSeconds(284601600, true);
+compare("08/07/1981 01.59.48.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "284601600"); // leap second in June 1981
+$datetest = new Date($date);
+$datetest->addSeconds(316224000, true);
+compare("09/07/1982 01.59.47.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "316224000");
+$datetest = new Date($date);
+$datetest->addSeconds(347846400, true);
+compare("10/07/1983 01.59.46.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "347846400");
+$datetest = new Date($date);
+$datetest->addSeconds(379468800, true);
+compare("10/07/1984 01.59.46.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "379468800"); // no leap second in 1984
+$datetest = new Date($date);
+$datetest->addSeconds(411091200, true);
+compare("11/07/1985 01.59.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "411091200"); // leap second in June 1985
+$datetest = new Date($date);
+$datetest->addSeconds(442713600, true);
+compare("12/07/1986 01.59.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "442713600"); // no leap second in 1986
+$datetest = new Date($date);
+$datetest->addSeconds(474336000, true);
+compare("13/07/1987 01.59.45.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "474336000");
+$datetest = new Date($date);
+$datetest->addSeconds(505958400, true);
+compare("13/07/1988 01.59.44.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "505958400"); // leap second in Dec 1987
+$datetest = new Date($date);
+$datetest->addSeconds(537580800, true);
+compare("14/07/1989 01.59.44.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "537580800");
+$datetest = new Date($date);
+$datetest->addSeconds(569203200, true);
+compare("15/07/1990 01.59.43.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "569203200");
+$datetest = new Date($date);
+$datetest->addSeconds(600825600, true);
+compare("16/07/1991 01.59.42.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "600825600");
+$datetest = new Date($date);
+$datetest->addSeconds(632448000, true);
+compare("16/07/1992 01.59.41.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "632448000");
+$datetest = new Date($date);
+$datetest->addSeconds(664070400, true);
+compare("17/07/1993 01.59.40.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "664070400");
+$datetest = new Date($date);
+$datetest->addSeconds(695692800, true);
+compare("18/07/1994 01.59.39.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "695692800");
+$datetest = new Date($date);
+$datetest->addSeconds(727315200, true);
+compare("19/07/1995 01.59.39.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "727315200");
+$datetest = new Date($date);
+$datetest->addSeconds(758937600, true);
+compare("19/07/1996 01.59.38.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "758937600");
+$datetest = new Date($date);
+$datetest->addSeconds(790560000, true);
+compare("20/07/1997 01.59.37.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "790560000");
+$datetest = new Date($date);
+$datetest->addSeconds(822182400, true);
+compare("21/07/1998 01.59.37.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "822182400");
+$datetest = new Date($date);
+$datetest->addSeconds(853804800, true);
+compare("22/07/1999 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "853804800");
+$datetest = new Date($date);
+$datetest->addSeconds(885427200, true);
+compare("22/07/2000 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "885427200");
+$datetest = new Date($date);
+$datetest->addSeconds(917049600, true);
+compare("23/07/2001 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "917049600");
+$datetest = new Date($date);
+$datetest->addSeconds(948672000, true);
+compare("24/07/2002 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "948672000");
+$datetest = new Date($date);
+$datetest->addSeconds(980294400, true);
+compare("25/07/2003 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "980294400");
+$datetest = new Date($date);
+$datetest->addSeconds(1011916800, true);
+compare("25/07/2004 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1011916800");
+$datetest = new Date($date);
+$datetest->addSeconds(1043539200, true);
+compare("26/07/2005 01.59.36.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1043539200");
+$datetest = new Date($date);
+$datetest->addSeconds(1075161600, true);
+compare("27/07/2006 01.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1075161600"); // 23rd leap second in Dec 2005
+$datetest = new Date($date);
+$datetest->addSeconds(1106784000, true);
+compare("28/07/2007 01.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1106784000");
+$datetest = new Date($date);
+$datetest->addSeconds(1138406400, true);
+compare("28/07/2008 01.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1138406400");
+$datetest = new Date($date);
+$datetest->addSeconds(1170028800, true);
+compare("29/07/2009 01.59.35.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "1170028800");
+
+
+$date->setDate("2006-01-01 01:00:05.987654");
+
+$datetest = new Date($date);
+$datetest->addSeconds(-1, true);
+compare("01/01/2006 01.00.04.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1");
+$datetest = new Date($date);
+$datetest->addSeconds(-2, true);
+compare("01/01/2006 01.00.03.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-2");
+$datetest = new Date($date);
+$datetest->addSeconds(-3, true);
+compare("01/01/2006 01.00.02.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3");
+$datetest = new Date($date);
+$datetest->addSeconds(-4, true);
+compare("01/01/2006 01.00.01.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-4");
+$datetest = new Date($date);
+$datetest->addSeconds(-5, true);
+compare("01/01/2006 01.00.00.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-5");
+$datetest = new Date($date);
+$datetest->addSeconds(-6, true);
+compare("01/01/2006 00.59.60.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-6"); // leap second
+$datetest = new Date($date);
+$datetest->addSeconds(-7, true);
+compare("01/01/2006 00.59.59.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7");
+$datetest = new Date($date);
+$datetest->addSeconds(-8, true);
+compare("01/01/2006 00.59.58.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-8");
+$datetest = new Date($date);
+$datetest->addSeconds(-9, true);
+compare("01/01/2006 00.59.57.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-9");
+$datetest = new Date($date);
+$datetest->addSeconds(-10, true);
+compare("01/01/2006 00.59.56.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-10");
+$datetest = new Date($date);
+$datetest->addSeconds(-60, true);
+compare("01/01/2006 00.59.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-60");
+$datetest = new Date($date);
+$datetest->addSeconds(-3599, true);
+compare("01/01/2006 00.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3599");
+$datetest = new Date($date);
+$datetest->addSeconds(-3600, true);
+compare("01/01/2006 00.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3600");
+$datetest = new Date($date);
+$datetest->addSeconds(-3601, true);
+compare("01/01/2006 00.00.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-3601");
+$datetest = new Date($date);
+$datetest->addSeconds(-7199, true);
+compare("31/12/2005 23.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7199");
+$datetest = new Date($date);
+$datetest->addSeconds(-7200, true);
+compare("31/12/2005 23.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7200");
+$datetest = new Date($date);
+$datetest->addSeconds(-7201, true);
+compare("31/12/2005 23.00.05.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-7201");
+$datetest = new Date($date);
+$datetest->addSeconds(-86400, true);
+compare("31/12/2005 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-86400");
+$datetest = new Date($date);
+$datetest->addSeconds(-864000, true);
+compare("22/12/2005 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-864000");
+$datetest = new Date($date);
+$datetest->addSeconds(-8640000, true);
+compare("23/09/2005 02.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-8640000");
+$datetest = new Date($date);
+$datetest->addSeconds(-31622400, true);
+compare("31/12/2004 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-31622400");
+$datetest = new Date($date);
+$datetest->addSeconds(-63244800, true);
+compare("31/12/2003 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-63244800");
+$datetest = new Date($date);
+$datetest->addSeconds(-94867200, true);
+compare("30/12/2002 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-94867200");
+$datetest = new Date($date);
+$datetest->addSeconds(-126489600, true);
+compare("29/12/2001 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-126489600");
+$datetest = new Date($date);
+$datetest->addSeconds(-158112000, true);
+compare("28/12/2000 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-158112000");
+$datetest = new Date($date);
+$datetest->addSeconds(-189734400, true);
+compare("28/12/1999 01.00.06.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-189734400");
+$datetest = new Date($date);
+$datetest->addSeconds(-221356800, true);
+compare("27/12/1998 01.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-221356800"); // 2 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(-252979200, true);
+compare("26/12/1997 01.00.07.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-252979200");
+$datetest = new Date($date);
+$datetest->addSeconds(-284601600, true);
+compare("25/12/1996 01.00.08.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-284601600"); // leap second in June 1997
+$datetest = new Date($date);
+$datetest->addSeconds(-316224000, true);
+compare("25/12/1995 01.00.09.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-316224000"); // leap second in Dec 1995
+$datetest = new Date($date);
+$datetest->addSeconds(-347846400, true);
+compare("24/12/1994 01.00.09.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-347846400");
+$datetest = new Date($date);
+$datetest->addSeconds(-379468800, true);
+compare("23/12/1993 01.00.10.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-379468800"); // leap second in June 1994
+$datetest = new Date($date);
+$datetest->addSeconds(-411091200, true);
+compare("22/12/1992 01.00.11.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-411091200"); // leap second in June 1993
+$datetest = new Date($date);
+$datetest->addSeconds(-442713600, true);
+compare("22/12/1991 01.00.12.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-442713600"); // leap second in June 1992
+$datetest = new Date($date);
+$datetest->addSeconds(-474336000, true);
+compare("21/12/1990 01.00.13.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-474336000"); // leap second in Dec 1990
+$datetest = new Date($date);
+$datetest->addSeconds(-505958400, true);
+compare("20/12/1989 01.00.14.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-505958400"); // leap second in Dec 1989
+$datetest = new Date($date);
+$datetest->addSeconds(-537580800, true);
+compare("19/12/1988 01.00.14.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-537580800");
+$datetest = new Date($date);
+$datetest->addSeconds(-569203200, true);
+compare("19/12/1987 01.00.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-569203200"); // leap second in Dec 1987
+$datetest = new Date($date);
+$datetest->addSeconds(-600825600, true);
+compare("18/12/1986 01.00.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-600825600");
+$datetest = new Date($date);
+$datetest->addSeconds(-632448000, true);
+compare("17/12/1985 01.00.15.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-632448000");
+$datetest = new Date($date);
+$datetest->addSeconds(-664070400, true);
+compare("16/12/1984 01.00.16.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-664070400"); // leap second in June 1985
+$datetest = new Date($date);
+$datetest->addSeconds(-695692800, true);
+compare("16/12/1983 01.00.16.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-695692800");
+$datetest = new Date($date);
+$datetest->addSeconds(-727315200, true);
+compare("15/12/1982 01.00.17.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-727315200");
+$datetest = new Date($date);
+$datetest->addSeconds(-758937600, true);
+compare("14/12/1981 01.00.18.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-758937600");
+$datetest = new Date($date);
+$datetest->addSeconds(-790560000, true);
+compare("13/12/1980 01.00.19.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-790560000");
+$datetest = new Date($date);
+$datetest->addSeconds(-822182400, true);
+compare("13/12/1979 01.00.20.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-822182400");
+$datetest = new Date($date);
+$datetest->addSeconds(-853804800, true);
+compare("12/12/1978 01.00.21.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-853804800");
+$datetest = new Date($date);
+$datetest->addSeconds(-885427200, true);
+compare("11/12/1977 01.00.22.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-885427200");
+$datetest = new Date($date);
+$datetest->addSeconds(-917049600, true);
+compare("10/12/1976 01.00.23.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-917049600");
+$datetest = new Date($date);
+$datetest->addSeconds(-948672000, true);
+compare("10/12/1975 01.00.24.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-948672000");
+$datetest = new Date($date);
+$datetest->addSeconds(-980294400, true);
+compare("09/12/1974 01.00.25.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-980294400");
+$datetest = new Date($date);
+$datetest->addSeconds(-1011916800, true);
+compare("08/12/1973 01.00.26.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1011916800");
+$datetest = new Date($date);
+$datetest->addSeconds(-1043539200, true);
+compare("07/12/1972 01.00.27.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1043539200");
+$datetest = new Date($date);
+$datetest->addSeconds(-1075161600, true);
+compare("07/12/1971 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1075161600"); // 23 leap seconds
+$datetest = new Date($date);
+$datetest->addSeconds(-1106784000, true);
+compare("06/12/1970 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1106784000");
+$datetest = new Date($date);
+$datetest->addSeconds(-1138406400, true);
+compare("05/12/1969 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1138406400");
+$datetest = new Date($date);
+$datetest->addSeconds(-1170028800, true);
+compare("04/12/1968 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1170028800");
diff --git a/extlib/Date/tests/test_calc.php b/extlib/Date/tests/test_calc.php
new file mode 100644 (file)
index 0000000..18dc9bf
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+require_once "Date/Calc.php";
+
+/**
+ * Test dates from 1970 to 2029
+ * Data from: http://www.merlyn.demon.co.uk/wknotest.txt
+ *  [N.B. this link is now broken, although the web-site still exists]
+ * Others usefull datas available from:
+ * http://www.merlyn.demon.co.uk/#dat
+ */
+
+// 'wknotest.txt' is missing and no longer available on the web, and so this
+// test is disabled for this reason (it was copyright anyway).
+//
+$failed_test_data = false;
+// $wkno   = file('wknotest.txt');
+// $cnt    = sizeof($wkno);
+// for( $i=0;$i<$cnt;$i++ ){
+//     $parts      = explode(':',$wkno[$i]);
+//     $weeksno[$parts[0]] = str_replace("\n",'',$parts[1]);
+// }
+// unset($wkno);
+// foreach($weeksno as $date=>$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 = array(1998, 2, 1) == Date_Calc::isoWeekDate(5, 1, 1998) ? true : false;
+$pass2 = array(1998, 2, 2) == Date_Calc::isoWeekDate(6, 1, 1998) ? true : false;
+$pass3 = array(2004, 2, 1) == Date_Calc::isoWeekDate(5, 1, 2004) ? true : false;
+$pass4 = array(2004, 2, 2) == Date_Calc::isoWeekDate(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";
+}
diff --git a/extlib/Date/tests/test_date_methods_span.php b/extlib/Date/tests/test_date_methods_span.php
new file mode 100644 (file)
index 0000000..b164384
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+//
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2005  Leandro Lucarella                           |
+// +----------------------------------------------------------------------+
+// | 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: Leandro Lucarella <llucax@php.net>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+
+
+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));
diff --git a/extlib/Date/tests/test_format.php b/extlib/Date/tests/test_format.php
new file mode 100644 (file)
index 0000000..428b299
--- /dev/null
@@ -0,0 +1,526 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date::formatLikeStrftime(), Date::formatLikeSQL(),
+ * and Date::formatLikeDate()
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+$date = new Date("2007-11-29T23:13:46.09002");
+$date->setTZbyID("Europe/Amsterdam");
+
+compare('Thu', $date->formatLikeStrftime('%a'), '%a');
+compare('Thursday', $date->formatLikeStrftime('%A'), '%A');
+compare('Nov', $date->formatLikeStrftime('%b'), '%b');
+compare('November', $date->formatLikeStrftime('%B'), '%B');
+compare('20', $date->formatLikeStrftime('%C'), '%C');
+compare('29', $date->formatLikeStrftime('%d'), '%d');
+compare('11/29/2007', $date->formatLikeStrftime('%D'), '%D');
+compare('29', $date->formatLikeStrftime('%e'), '%e');
+compare('2454434', $date->formatLikeStrftime('%E'), '%E');
+compare('07', $date->formatLikeStrftime('%g'), '%g');
+compare('2007', $date->formatLikeStrftime('%G'), '%G');
+compare('23', $date->formatLikeStrftime('%h'), '%h');
+compare('23', $date->formatLikeStrftime('%H'), '%H');
+compare('11', $date->formatLikeStrftime('%i'), '%i');
+compare('11', $date->formatLikeStrftime('%I'), '%I');
+compare('333', $date->formatLikeStrftime('%j'), '%j');
+compare('11', $date->formatLikeStrftime('%m'), '%m');
+compare('13', $date->formatLikeStrftime('%M'), '%M');
+compare("\n", $date->formatLikeStrftime('%n'), '%n');
+compare('+01:00', $date->formatLikeStrftime('%o'), '%o');
+compare('+01:00', $date->formatLikeStrftime('%O'), '%O');
+compare('pm', $date->formatLikeStrftime('%p'), '%p');
+compare('PM', $date->formatLikeStrftime('%P'), '%P');
+compare('11:13:46 PM', $date->formatLikeStrftime('%r'), '%r');
+compare('23:13', $date->formatLikeStrftime('%R'), '%R');
+compare('46.090020', $date->formatLikeStrftime('%s'), '%s');
+compare('46', $date->formatLikeStrftime('%S'), '%S');
+compare("\t", $date->formatLikeStrftime('%t'), '%t');
+compare('23:13:46', $date->formatLikeStrftime('%T'), '%T');
+compare('4', $date->formatLikeStrftime('%u'), '%u');
+compare('47', $date->formatLikeStrftime('%U'), '%U');
+compare('48', $date->formatLikeStrftime('%V'), '%V');
+compare('4', $date->formatLikeStrftime('%w'), '%w');
+compare('48', $date->formatLikeStrftime('%W'), '%W');
+compare('07', $date->formatLikeStrftime('%y'), '%y');
+compare('2007', $date->formatLikeStrftime('%Y'), '%Y');
+compare('CET', $date->formatLikeStrftime('%Z'), '%Z');
+compare('%', $date->formatLikeStrftime('%%'), '%%');
+
+// Invalid character:
+//
+compare('x', $date->formatLikeStrftime('x'), 'x');
+
+compare(' �!�$%^&*()_+{}:@~<>?[];\'#,./-=`\\|', $date->formatLikeSQL(' �!�$%^&*()_+{}:@~<>?[];\'#,./-=`\\|'), ' �!�$%^&*()_+{}:@~<>?[];\'#,./-=`\\|');
+
+compare('text "   \\', $date->formatLikeSQL('"text \"   \\\\"'), '"text \"   \\\\"');
+
+compare('AD', $date->formatLikeSQL('AD'), 'AD');
+compare('A.D.', $date->formatLikeSQL('A.D.'), 'A.D.');
+compare('ad', $date->formatLikeSQL('ad'), 'ad');
+compare('a.d.', $date->formatLikeSQL('a.d.'), 'a.d.');
+
+compare('PM', $date->formatLikeSQL('AM'), 'AM');
+compare('P.M.', $date->formatLikeSQL('A.M.'), 'A.M.');
+compare('pm', $date->formatLikeSQL('am'), 'am');
+compare('p.m.', $date->formatLikeSQL('a.m.'), 'a.m.');
+
+compare('AD', $date->formatLikeSQL('BC'), 'BC');
+compare('A.D.', $date->formatLikeSQL('B.C.'), 'B.C.');
+compare('ad', $date->formatLikeSQL('bc'), 'bc');
+compare('a.d.', $date->formatLikeSQL('b.c.'), 'b.c.');
+
+compare('0', $date->formatLikeSQL('C'), 'C');
+compare('20', $date->formatLikeSQL('CC'), 'CC');
+compare('020', $date->formatLikeSQL('CCC'), 'CCC');
+compare('0020', $date->formatLikeSQL('CCCC'), 'CCCC');
+compare(' 0', $date->formatLikeSQL('SC'), 'SC');
+compare(' 20', $date->formatLikeSQL('SCC'), 'SCC');
+compare(' 020', $date->formatLikeSQL('SCCC'), 'SCCC');
+compare(' 0020', $date->formatLikeSQL('SCCCC'), 'SCCCC');
+compare('0', $date->formatLikeSQL('NPC'), 'NPC');
+compare('20', $date->formatLikeSQL('NPCC'), 'NPCC');
+compare('20', $date->formatLikeSQL('NPCCC'), 'NPCCC');
+compare('20', $date->formatLikeSQL('NPCCCC'), 'NPCCCC');
+compare('0', $date->formatLikeSQL('NPSC'), 'NPSC');
+compare('20', $date->formatLikeSQL('NPSCC'), 'NPSCC');
+compare('20', $date->formatLikeSQL('NPSCCC'), 'NPSCCC');
+compare('20', $date->formatLikeSQL('NPSCCCC'), 'NPSCCCC');
+
+compare('CE ', $date->formatLikeSQL('BCE'), 'BCE');
+compare('C.E.  ', $date->formatLikeSQL('B.C.E.'), 'B.C.E.');
+compare('ce ', $date->formatLikeSQL('bce'), 'bce');
+compare('c.e.  ', $date->formatLikeSQL('b.c.e.'), 'b.c.e.');
+compare('CE', $date->formatLikeSQL('NPBCE'), 'NPBCE');
+compare('C.E.', $date->formatLikeSQL('NPB.C.E.'), 'NPB.C.E.');
+compare('ce', $date->formatLikeSQL('NPbce'), 'NPbce');
+compare('c.e.', $date->formatLikeSQL('NPb.c.e.'), 'NPb.c.e.');
+
+compare('4', $date->formatLikeSQL('D'), 'D');
+compare('4TH', $date->formatLikeSQL('DTH'), 'DTH');
+compare('4th', $date->formatLikeSQL('Dth'), 'Dth');
+compare('FOUR', $date->formatLikeSQL('DSP'), 'DSP');
+compare('FOURTH', $date->formatLikeSQL('DSPTH'), 'DSPTH');
+compare('FOURTH', $date->formatLikeSQL('DTHSP'), 'DTHSP');
+compare('four', $date->formatLikeSQL('Dsp'), 'Dsp');
+compare('fourth', $date->formatLikeSQL('Dspth'), 'Dspth');
+compare('fourth', $date->formatLikeSQL('Dthsp'), 'Dthsp');
+
+compare('THURSDAY ', $date->formatLikeSQL('DAY'), 'DAY');
+compare('Thursday ', $date->formatLikeSQL('Day'), 'Day');
+compare('thursday ', $date->formatLikeSQL('day'), 'day');
+compare('THURSDAY', $date->formatLikeSQL('NPDAY'), 'NPDAY');
+compare('Thursday', $date->formatLikeSQL('NPDay'), 'NPDay');
+compare('thursday', $date->formatLikeSQL('NPday'), 'NPday');
+
+compare('29', $date->formatLikeSQL('DD'), 'DD');
+compare('29TH', $date->formatLikeSQL('DDTH'), 'DDTH');
+compare('29th', $date->formatLikeSQL('DDth'), 'DDth');
+compare('TWENTY-NINE', $date->formatLikeSQL('DDSP'), 'DDSP');
+compare('TWENTY-NINTH', $date->formatLikeSQL('DDSPTH'), 'DDSPTH');
+compare('TWENTY-NINTH', $date->formatLikeSQL('DDTHSP'), 'DDTHSP');
+compare('twenty-nine', $date->formatLikeSQL('DDsp'), 'DDsp');
+compare('twenty-ninth', $date->formatLikeSQL('DDspth'), 'DDspth');
+compare('twenty-ninth', $date->formatLikeSQL('DDthsp'), 'DDthsp');
+
+compare('333', $date->formatLikeSQL('DDD'), 'DDD');
+compare('333RD', $date->formatLikeSQL('DDDTH'), 'DDDTH');
+compare('333rd', $date->formatLikeSQL('DDDth'), 'DDDth');
+compare('THREE HUNDRED THIRTY-THREE', $date->formatLikeSQL('DDDSP'), 'DDDSP');
+compare('THREE HUNDRED THIRTY-THIRD', $date->formatLikeSQL('DDDSPTH'), 'DDDSPTH');
+compare('THREE HUNDRED THIRTY-THIRD', $date->formatLikeSQL('DDDTHSP'), 'DDDTHSP');
+compare('three hundred thirty-three', $date->formatLikeSQL('DDDsp'), 'DDDsp');
+compare('three hundred thirty-third', $date->formatLikeSQL('DDDspth'), 'DDDspth');
+compare('three hundred thirty-third', $date->formatLikeSQL('DDDthsp'), 'DDDthsp');
+
+compare('THU', $date->formatLikeSQL('DY'), 'DY');
+compare('Thu', $date->formatLikeSQL('Dy'), 'Dy');
+compare('thu', $date->formatLikeSQL('dy'), 'dy');
+
+compare('0', $date->formatLikeSQL('F'), 'F');
+compare('09', $date->formatLikeSQL('FF'), 'FF');
+compare('090', $date->formatLikeSQL('FFF'), 'FFF');
+compare('0900', $date->formatLikeSQL('FFFF'), 'FFFF');
+compare('09002', $date->formatLikeSQL('FFFFF'), 'FFFFF');
+compare('090020', $date->formatLikeSQL('FFFFFF'), 'FFFFFF');
+compare('0900200', $date->formatLikeSQL('FFFFFFF'), 'FFFFFFF');
+compare('09002000', $date->formatLikeSQL('FFFFFFFF'), 'FFFFFFFF');
+compare('090020000', $date->formatLikeSQL('FFFFFFFFF'), 'FFFFFFFFF');
+compare('0900200000', $date->formatLikeSQL('FFFFFFFFFF'), 'FFFFFFFFFF');
+compare('0', $date->formatLikeSQL('F1'), 'F1');
+compare('09', $date->formatLikeSQL('F2'), 'F2');
+compare('090', $date->formatLikeSQL('F3'), 'F3');
+compare('0900', $date->formatLikeSQL('F4'), 'F4');
+compare('09002', $date->formatLikeSQL('F5'), 'F5');
+compare('090020', $date->formatLikeSQL('F6'), 'F6');
+compare('0900200', $date->formatLikeSQL('F7'), 'F7');
+compare('09002000', $date->formatLikeSQL('F8'), 'F8');
+compare('090020000', $date->formatLikeSQL('F9'), 'F9');
+compare('0900200000', $date->formatLikeSQL('F10'), 'F10');
+compare('09002000000', $date->formatLikeSQL('F11'), 'F11');
+compare('090020000000', $date->formatLikeSQL('F12'), 'F12');
+compare('0900200000000', $date->formatLikeSQL('F13'), 'F13');
+compare('09002000000000', $date->formatLikeSQL('F14'), 'F14');
+compare('09002' . str_repeat("0", 39), $date->formatLikeSQL('F44'), 'F44');
+
+compare('23', $date->formatLikeSQL('HH'), 'HH');
+compare('11', $date->formatLikeSQL('HH12'), 'HH12');
+compare('23', $date->formatLikeSQL('HH24'), 'HH24');
+
+compare('4', $date->formatLikeSQL('ID'), 'ID');
+
+compare('48', $date->formatLikeSQL('IW'), 'IW');
+
+compare('7', $date->formatLikeSQL('I'), 'I');
+compare('07', $date->formatLikeSQL('IY'), 'IY');
+compare('007', $date->formatLikeSQL('IYY'), 'IYY');
+compare('2007', $date->formatLikeSQL('IYYY'), 'IYYY');
+compare('02007', $date->formatLikeSQL('IYYYY'), 'IYYYY');
+compare('002007', $date->formatLikeSQL('IYYYYY'), 'IYYYYY');
+compare('7', $date->formatLikeSQL('NPSI'), 'NPSI');
+compare('7', $date->formatLikeSQL('NPSIY'), 'NPSIY');
+compare('7', $date->formatLikeSQL('NPSIYY'), 'NPSIYY');
+compare('2007', $date->formatLikeSQL('NPSIYYY'), 'NPSIYYY');
+compare('2007', $date->formatLikeSQL('NPSIYYYY'), 'NPSIYYYY');
+compare('2007', $date->formatLikeSQL('NPSIYYYYY'), 'NPSIYYYYY');
+compare(' 7', $date->formatLikeSQL('SI'), 'SI');
+compare(' 07', $date->formatLikeSQL('SIY'), 'SIY');
+compare(' 007', $date->formatLikeSQL('SIYY'), 'SIYY');
+compare(' 2007', $date->formatLikeSQL('SIYYY'), 'SIYYY');
+compare(' 02007', $date->formatLikeSQL('SIYYYY'), 'SIYYYY');
+compare(' 002007', $date->formatLikeSQL('SIYYYYY'), 'SIYYYYY');
+compare('7', $date->formatLikeSQL('NPIYY'), 'NPIYY');
+compare('2007', $date->formatLikeSQL('NPIYYYYY'), 'NPIYYYYY');
+compare('TWO THOUSAND SEVEN', $date->formatLikeSQL('NPIYYYYYSP'), 'NPIYYYYYSP');
+compare('two thousand seventh', $date->formatLikeSQL('NPIYYYYYTHsp'), 'NPIYYYYYTHsp');
+
+compare('2454434', $date->formatLikeSQL('J'), 'J');
+compare('Two Million Four Hundred Fifty-four Thousand Four Hundred Thirty-four', $date->formatLikeSQL('JSp'), 'JSp');
+compare('Two Million Four Hundred Fifty-four Thousand Four Hundred Thirty-fourth', $date->formatLikeSQL('JSpth'), 'JSpth');
+
+compare('13', $date->formatLikeSQL('MI'), 'MI');
+compare('thirteen', $date->formatLikeSQL('MIsP'), 'MIsP');
+compare('13th', $date->formatLikeSQL('MItH'), 'MItH');
+compare('13TH', $date->formatLikeSQL('MITh'), 'MITh');
+compare('thirteenth', $date->formatLikeSQL('MIsPTH'), 'MIsPTH');
+compare('Thirteenth', $date->formatLikeSQL('MISpth'), 'MISpth');
+compare('THIRTEENTH', $date->formatLikeSQL('MISPth'), 'MISPth');
+
+compare('11', $date->formatLikeSQL('MM'), 'MM');
+compare('11', $date->formatLikeSQL('MM'), 'MM');
+compare('ELEVEN', $date->formatLikeSQL('MMSP'), 'MMSP');
+compare('ELEVENTH', $date->formatLikeSQL('MMSPTH'), 'MMSPTH');
+compare('ELEVENTH', $date->formatLikeSQL('MMTHSP'), 'MMTHSP');
+compare('Eleven', $date->formatLikeSQL('MMSp'), 'MMSp');
+compare('Eleventh', $date->formatLikeSQL('MMSpTH'), 'MMSpTH');
+compare('Eleventh', $date->formatLikeSQL('MMTHSp'), 'MMTHSp');
+compare('eleven', $date->formatLikeSQL('MMsp'), 'MMsp');
+compare('eleventh', $date->formatLikeSQL('MMspTH'), 'MMspTH');
+compare('eleventh', $date->formatLikeSQL('MMTHsp'), 'MMTHsp');
+
+compare('NOV', $date->formatLikeSQL('MON'), 'MON');
+compare('Nov', $date->formatLikeSQL('Mon'), 'Mon');
+compare('nov', $date->formatLikeSQL('mon'), 'mon');
+
+compare('NOVEMBER ', $date->formatLikeSQL('MONTH'), 'MONTH');
+compare('November ', $date->formatLikeSQL('Month'), 'Month');
+compare('november ', $date->formatLikeSQL('month'), 'month');
+compare('NOVEMBER', $date->formatLikeSQL('NPMONTH'), 'NPMONTH');
+compare('November', $date->formatLikeSQL('NPMonth'), 'NPMonth');
+compare('november', $date->formatLikeSQL('NPmonth'), 'NPmonth');
+
+compare('PM', $date->formatLikeSQL('PM'), 'PM');
+compare('P.M.', $date->formatLikeSQL('P.M.'), 'P.M.');
+compare('pm', $date->formatLikeSQL('pm'), 'pm');
+compare('p.m.', $date->formatLikeSQL('p.m.'), 'p.m.');
+
+compare('4', $date->formatLikeSQL('Q'), 'Q');
+compare('FOUR', $date->formatLikeSQL('QSP'), 'QSP');
+compare('fourth', $date->formatLikeSQL('QTHsp'), 'QTHsp');
+
+compare('  xi', $date->formatLikeSQL('rm'), 'rm');
+compare('  XI', $date->formatLikeSQL('RM'), 'RM');
+compare('xi', $date->formatLikeSQL('NPrm'), 'NPrm');
+compare('XI', $date->formatLikeSQL('NPRM'), 'NPRM');
+
+compare('46', $date->formatLikeSQL('SS'), 'SS');
+
+compare('83626', $date->formatLikeSQL('SSSSS'), 'SSSSS');
+
+compare('CET', $date->formatLikeSQL('TZC'), 'TZC');
+compare('01', $date->formatLikeSQL('TZH'), 'TZH');
+compare('+01', $date->formatLikeSQL('STZH'), 'STZH');
+compare('1', $date->formatLikeSQL('NPTZH'), 'NPTZH');
+compare('+1', $date->formatLikeSQL('NPSTZH'), 'NPSTZH');
+compare('+One', $date->formatLikeSQL('NPSTZHSp'), 'NPSTZHSp');
+compare('+First', $date->formatLikeSQL('NPSTZHSpth'), 'NPSTZHSpth');
+compare('0', $date->formatLikeSQL('TZI'), 'TZI');
+compare('00', $date->formatLikeSQL('TZM'), 'TZM');
+compare('0', $date->formatLikeSQL('NPTZM'), 'NPTZM');
+compare('Central European Time', $date->formatLikeSQL('TZN'), 'TZN');
+compare('+01:00', $date->formatLikeSQL('TZO'), 'TZO');
+compare('+01:00', $date->formatLikeSQL('NPTZO'), 'NPTZO');
+compare('03600', $date->formatLikeSQL('TZS'), 'TZS');
+compare(' 03600', $date->formatLikeSQL('STZS'), 'STZS');
+compare('3600', $date->formatLikeSQL('NPTZS'), 'NPTZS');
+compare('3600', $date->formatLikeSQL('NPSTZS'), 'NPSTZS');
+compare('THREE THOUSAND SIX HUNDRED', $date->formatLikeSQL('TZSSP'), 'TZSSP');
+compare('THREE THOUSAND SIX HUNDRED', $date->formatLikeSQL('NPSTZSSP'), 'NPSTZSSP');
+compare('Europe/Amsterdam', $date->formatLikeSQL('TZR'), 'TZR');
+
+$date2 = new Date($date);
+$date2->setTZbyID("America/Chicago");
+
+compare('CST', $date2->formatLikeSQL('TZC'), 'TZC (2)');
+compare('06', $date2->formatLikeSQL('TZH'), 'TZH (2)');
+compare('-06', $date2->formatLikeSQL('STZH'), 'STZH (2)');
+compare('6', $date2->formatLikeSQL('NPTZH'), 'NPTZH (2)');
+compare('-6', $date2->formatLikeSQL('NPSTZH'), 'NPSTZH (2)');
+compare('-six', $date2->formatLikeSQL('NPSTZHsp'), 'NPSTZHsp (2)');
+compare('-sixth', $date2->formatLikeSQL('NPSTZHspth'), 'NPSTZHspth (2)');
+compare('0', $date2->formatLikeSQL('TZI'), 'TZI (2)');
+compare('00', $date2->formatLikeSQL('TZM'), 'TZM (2)');
+compare('0', $date2->formatLikeSQL('NPTZM'), 'NPTZM (2)');
+compare('Central Standard Time', $date2->formatLikeSQL('TZN'), 'TZN (2)');
+compare('-06:00', $date2->formatLikeSQL('TZO'), 'TZO (2)');
+compare('-06:00', $date2->formatLikeSQL('NPTZO'), 'NPTZO (2)');
+compare('21600', $date2->formatLikeSQL('TZS'), 'TZS (2)');
+compare('-21600', $date2->formatLikeSQL('STZS'), 'STZS (2)');
+compare('21600', $date2->formatLikeSQL('NPTZS'), 'NPTZS (2)');
+compare('-21600', $date2->formatLikeSQL('NPSTZS'), 'NPSTZS (2)');
+compare('TWENTY-ONE THOUSAND SIX HUNDRED', $date2->formatLikeSQL('TZSSP'), 'TZSSP (2)');
+compare('MINUS TWENTY-ONE THOUSAND SIX HUNDRED', $date2->formatLikeSQL('NPSTZSSP'), 'NPSTZSSP (2)');
+compare('America/Chicago', $date2->formatLikeSQL('TZR'), 'TZR (2)');
+
+$date3 = new Date($date);
+$date3->setTZbyID("UTC");
+
+compare('UTC', $date3->formatLikeSQL('TZC'), 'TZC (formatLikeDate)');
+compare('00', $date3->formatLikeSQL('TZH'), 'TZH (formatLikeDate)');
+compare('+00', $date3->formatLikeSQL('STZH'), 'STZH (formatLikeDate)');
+compare('0', $date3->formatLikeSQL('NPTZH'), 'NPTZH (formatLikeDate)');
+compare('+0', $date3->formatLikeSQL('NPSTZH'), 'NPSTZH (formatLikeDate)');
+compare('ZERO', $date3->formatLikeSQL('NPTZHSP'), 'NPTZHSP (formatLikeDate)');
+compare('+ZEROTH', $date3->formatLikeSQL('NPSTZHSPTH'), 'NPSTZHSPTH (formatLikeDate)');
+compare('0', $date3->formatLikeSQL('TZI'), 'TZI (formatLikeDate)');
+compare('00', $date3->formatLikeSQL('TZM'), 'TZM (formatLikeDate)');
+compare('0', $date3->formatLikeSQL('NPTZM'), 'NPTZM (formatLikeDate)');
+compare('Coordinated Universal Time', $date3->formatLikeSQL('TZN'), 'TZN (formatLikeDate)');
+compare('00000', $date3->formatLikeSQL('TZS'), 'TZS (formatLikeDate)');
+compare(' 00000', $date3->formatLikeSQL('STZS'), 'STZS (formatLikeDate)');
+compare('0', $date3->formatLikeSQL('NPTZS'), 'NPTZS (formatLikeDate)');
+compare('0', $date3->formatLikeSQL('NPSTZS'), 'NPSTZS (formatLikeDate)');
+compare('zero', $date3->formatLikeSQL('TZSsp'), 'NPSTZSsp (formatLikeDate)');
+compare('Zero', $date3->formatLikeSQL('NPSTZSSp'), 'NPSTZSSp (formatLikeDate)');
+compare('Z     ', $date3->formatLikeSQL('TZO'), 'TZO (formatLikeDate)');
+compare('Z', $date3->formatLikeSQL('NPTZO'), 'NPTZO (formatLikeDate)');
+compare('UTC', $date3->formatLikeSQL('TZR'), 'TZR (formatLikeDate)');
+
+compare('1196374426', $date->formatLikeSQL('U'), 'U');
+
+compare('5', $date->formatLikeSQL('W'), 'W');
+compare('5', $date->formatLikeSQL('W'), 'W');
+
+// N.B. For 2007 all the week numbers match because the
+// year starts on a Monday:
+//
+compare('48', $date->formatLikeSQL('W1'), 'W1');
+compare('48', $date->formatLikeSQL('NPW1'), 'W1');
+
+compare('48', $date->formatLikeSQL('W4'), 'W4');
+compare('48', $date->formatLikeSQL('NPW4'), 'W4');
+
+compare('48', $date->formatLikeSQL('W7'), 'W7');
+compare('48', $date->formatLikeSQL('NPW7'), 'W7');
+
+compare('48', $date->formatLikeSQL('WW'), 'WW');
+compare('48', $date->formatLikeSQL('NPWW'), 'WW');
+
+compare('TWO THOUSAND SEVEN', $date->formatLikeSQL('YEAR'), 'YEAR');
+compare('Two Thousand Seven', $date->formatLikeSQL('Year'), 'Year');
+compare('two thousand seven', $date->formatLikeSQL('year'), 'year');
+compare('TWO THOUSAND SEVEN', $date->formatLikeSQL('NPSYEAR'), 'NPSYEAR');
+compare('TWO THOUSAND SEVEN', $date->formatLikeSQL('NPSYEAR'), 'NPSYEAR');
+
+compare('7', $date->formatLikeSQL('Y'), 'Y');
+compare('07', $date->formatLikeSQL('YY'), 'YY');
+compare('007', $date->formatLikeSQL('YYY'), 'YYY');
+compare('2007', $date->formatLikeSQL('YYYY'), 'YYYY');
+compare('02007', $date->formatLikeSQL('YYYYY'), 'YYYYY');
+compare('002007', $date->formatLikeSQL('YYYYYY'), 'YYYYYY');
+compare(' 7', $date->formatLikeSQL('SY'), 'SY');
+compare(' 07', $date->formatLikeSQL('SYY'), 'SYY');
+compare(' 007', $date->formatLikeSQL('SYYY'), 'SYYY');
+compare(' 2007', $date->formatLikeSQL('SYYYY'), 'SYYYY');
+compare(' 02007', $date->formatLikeSQL('SYYYYY'), 'SYYYYY');
+compare(' 002007', $date->formatLikeSQL('SYYYYYY'), 'SYYYYYY');
+compare('7', $date->formatLikeSQL('NPSY'), 'NPSY');
+compare('7', $date->formatLikeSQL('NPSYY'), 'NPSYY');
+compare('7', $date->formatLikeSQL('NPSYYY'), 'NPSYYY');
+compare('2007', $date->formatLikeSQL('NPSYYYY'), 'NPSYYYY');
+compare('2007', $date->formatLikeSQL('NPSYYYYY'), 'NPSYYYYY');
+compare('2007', $date->formatLikeSQL('NPSYYYYYY'), 'NPSYYYYYY');
+compare('TWO THOUSAND SEVEN', $date->formatLikeSQL('NPSYYYYYYSP'), 'NPSYYYYYYSP');
+compare('Two Thousand Seven', $date->formatLikeSQL('NPSYYYYYYSp'), 'NPSYYYYYYSp');
+compare('two thousand seven', $date->formatLikeSQL('NPSYYYYYYsp'), 'NPSYYYYYYsp');
+compare('TWO THOUSAND SEVENTH', $date->formatLikeSQL('NPSYYYYYYSPth'), 'NPSYYYYYYSPth');
+compare('Two Thousand Seventh', $date->formatLikeSQL('NPSYYYYYYSpth'), 'NPSYYYYYYSpth');
+compare('two thousand seventh', $date->formatLikeSQL('NPSYYYYYYthsp'), 'NPSYYYYYYthsp');
+compare('2007th', $date->formatLikeSQL('NPSYYYYYYth'), 'NPSYYYYYYth');
+compare('2007TH', $date->formatLikeSQL('NPSYYYYYYTH'), 'NPSYYYYYYTH');
+
+compare('7', $date->formatLikeSQL('Y'), 'Y');
+compare('07', $date->formatLikeSQL('YY'), 'YY');
+compare('007', $date->formatLikeSQL('YYY'), 'YYY');
+compare('2,007', $date->formatLikeSQL('Y,YYY'), 'Y,YYY');
+compare('02.007', $date->formatLikeSQL('YY.YYY'), 'YY.YYY');
+compare('002�007', $date->formatLikeSQL('YYY�YYY'), 'YYY�YYY');
+compare(' 7', $date->formatLikeSQL('SY'), 'SY');
+compare(' 07', $date->formatLikeSQL('SYY'), 'SYY');
+compare(' 007', $date->formatLikeSQL('SYYY'), 'SYYY');
+compare(' 2\'007', $date->formatLikeSQL('SY\'YYY'), 'SY\'YYY');
+compare(' 02 007', $date->formatLikeSQL('SYY YYY'), 'SYY YYY');
+
+// The semi-colon (':') is an invalid separator:
+//
+compare(' 007:007', $date->formatLikeSQL('SYYY:YYY'), 'SYYY:YYY');
+compare('2,007', $date->formatLikeSQL('NPSYYY,YYY,YYY'), 'NPSYYY,YYY,YYY');
+
+compare('29', $date->formatLikeDate('d'), 'd (formatLikeDate)');
+compare('Thu', $date->formatLikeDate('D'), 'D (formatLikeDate)');
+compare('29', $date->formatLikeDate('j'), 'j (formatLikeDate)');
+compare('Thursday', $date->formatLikeDate('l'), 'l (formatLikeDate)');
+compare('4', $date->formatLikeDate('N'), 'N (formatLikeDate)');
+compare('29th', $date->formatLikeDate('dS'), 'dS (formatLikeDate)');
+compare('4', $date->formatLikeDate('w'), 'w (formatLikeDate)');
+compare('332', $date->formatLikeDate('z'), 'z (formatLikeDate)');
+compare('48', $date->formatLikeDate('W'), 'W (formatLikeDate)');
+compare('November', $date->formatLikeDate('F'), 'F (formatLikeDate)');
+compare('11', $date->formatLikeDate('m'), 'm (formatLikeDate)');
+compare('Nov', $date->formatLikeDate('M'), 'M (formatLikeDate)');
+compare('11', $date->formatLikeDate('n'), 'n (formatLikeDate)');
+compare('30', $date->formatLikeDate('t'), 't (formatLikeDate)');
+compare('0', $date->formatLikeDate('L'), 'L (formatLikeDate)');
+compare('2007', $date->formatLikeDate('o'), 'o (formatLikeDate)');
+compare('2007', $date->formatLikeDate('Y'), 'Y (formatLikeDate)');
+compare('07', $date->formatLikeDate('y'), 'y (formatLikeDate)');
+compare("pm", $date->formatLikeDate('a'), 'a (formatLikeDate)');
+compare('PM', $date->formatLikeDate('A'), 'A (formatLikeDate)');
+compare('11', $date->formatLikeDate('g'), 'g (formatLikeDate)');
+compare('23', $date->formatLikeDate('G'), 'G (formatLikeDate)');
+compare('11', $date->formatLikeDate('h'), 'h (formatLikeDate)');
+compare('23', $date->formatLikeDate('H'), 'H (formatLikeDate)');
+compare('13', $date->formatLikeDate('i'), 'i (formatLikeDate)');
+compare('46', $date->formatLikeDate('s'), 's (formatLikeDate)');
+compare('46090', $date->formatLikeDate('u'), 'u (formatLikeDate)');
+compare("Europe/Amsterdam", $date->formatLikeDate('e'), 'e (formatLikeDate)');
+compare('0', $date->formatLikeDate('I'), 'I (formatLikeDate)');
+compare('+0100', $date->formatLikeDate('O'), 'O (formatLikeDate)');
+compare('+01:00', $date->formatLikeDate('P'), 'P (formatLikeDate)');
+compare('CET', $date->formatLikeDate('T'), 'T (formatLikeDate)');
+compare('03600', $date->formatLikeDate('Z'), 'Z (formatLikeDate)');
+compare('2007-11-29T23:13:46+01:00', $date->formatLikeDate('c'), 'c (formatLikeDate)');
+compare('Thu, 29 Nov 2007 23:13:46 +0100', $date->formatLikeDate('r'), 'r (formatLikeDate)');
+compare('1196374426', $date->formatLikeDate('U'), 'U (formatLikeDate)');
+compare('text\\', $date->formatLikeDate('\t\e\x\t\\\\'), '\\t\\e\\x\\t\\\\ (formatLikeDate)');
+compare('"', $date->formatLikeDate('"'), '" (formatLikeDate)');
+compare(' ', $date->formatLikeDate(' '), 'blank space (formatLikeDate)');
+
+compare('2007-11-29T23:13:46+01:00', $date->formatLikeDate(DATE_ATOM), 'DATE_ATOM [' . DATE_ATOM . '] (formatLikeDate)');
+compare('Thursday, 29-Nov-07 23:13:46 CET', $date->formatLikeDate(DATE_COOKIE), 'DATE_COOKIE [' . DATE_COOKIE . '] (formatLikeDate)');
+compare('2007-11-29T23:13:46+0100', $date->formatLikeDate(DATE_ISO8601), 'DATE_ISO8601 [' . DATE_ISO8601 . '] (formatLikeDate)');
+compare('Thu, 29 Nov 07 23:13:46 +0100', $date->formatLikeDate(DATE_RFC822), 'DATE_RFC822 [' . DATE_RFC822 . '] (formatLikeDate)');
+compare('Thursday, 29-Nov-07 23:13:46 CET', $date->formatLikeDate(DATE_RFC850), 'DATE_RFC850 [' . DATE_RFC850 . '] (formatLikeDate)');
+compare('Thu, 29 Nov 07 23:13:46 +0100', $date->formatLikeDate(DATE_RFC1036), 'DATE_RFC1036 [' . DATE_RFC1036 . '] (formatLikeDate)');
+compare('Thu, 29 Nov 2007 23:13:46 +0100', $date->formatLikeDate(DATE_RFC1123), 'DATE_RFC1123 [' . DATE_RFC1123 . '] (formatLikeDate)');
+compare('Thu, 29 Nov 2007 23:13:46 +0100', $date->formatLikeDate(DATE_RFC2822), 'DATE_RFC2822 [' . DATE_RFC2822 . '] (formatLikeDate)');
+compare('2007-11-29T23:13:46+01:00', $date->formatLikeDate(DATE_RFC3339), 'DATE_RFC3339 [' . DATE_RFC3339 . '] (formatLikeDate)');
+compare('Thu, 29 Nov 2007 23:13:46 +0100', $date->formatLikeDate(DATE_RSS), 'DATE_RSS [' . DATE_RSS . '] (formatLikeDate)');
+compare('2007-11-29T23:13:46+01:00', $date->formatLikeDate(DATE_W3C), 'DATE_W3C [' . DATE_W3C . '] (formatLikeDate)');
diff --git a/extlib/Date/tests/test_julianday.php b/extlib/Date/tests/test_julianday.php
new file mode 100644 (file)
index 0000000..854a1b8
--- /dev/null
@@ -0,0 +1,4504 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests Date_Calc::julianDay()
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+
+compare('-4713 11 24', Date_Calc::DaysToDate(0, "%Y %m %d"), '0000 (top)');
+compare(0, Date_Calc::DateToDays(24, 11, -4713), '-4713 11 24 (top)');
+compare('-0001 12 31', Date_Calc::DaysToDate(1721059, "%Y %m %d"), '1721059 (top)');
+compare(1721059, Date_Calc::DateToDays(31, 12, -1), '-0001 12 31 (top)');
+compare('0000 01 01', Date_Calc::DaysToDate(1721060, "%Y %m %d"), '1721060 (top)');
+compare(1721060, Date_Calc::DateToDays(1, 1, 0), '0000 01 01 (top)');
+compare('0000 01 02', Date_Calc::DaysToDate(1721061, "%Y %m %d"), '1721061 (top)');
+compare(1721061, Date_Calc::DateToDays(2, 1, 0), '0000 01 02 (top)');
+compare('1858 11 16', Date_Calc::DaysToDate(2400000, "%Y %m %d"), '2400000 (top)');
+compare(2400000, Date_Calc::DateToDays(16, 11, 1858), '1858 11 16 (top)');
+compare('2132 08 31', Date_Calc::DaysToDate(2500000, "%Y %m %d"), '2500000 (top)');
+compare(2500000, Date_Calc::DateToDays(31, 8, 2132), '2132 08 31 (top)');
+
+compare('-4714 11 24', $hs_date = Date_Calc::DaysToDate(-365, "%Y %m %d"), '-365');
+compare(-365, Date_Calc::DateToDays(24, 11, -4714), '-4714 11 24');
+compare('-4714 11 25', $hs_date = Date_Calc::DaysToDate(-364, "%Y %m %d"), '-364');
+compare(-364, Date_Calc::DateToDays(25, 11, -4714), '-4714 11 25');
+compare('-4714 11 26', $hs_date = Date_Calc::DaysToDate(-363, "%Y %m %d"), '-363');
+compare(-363, Date_Calc::DateToDays(26, 11, -4714), '-4714 11 26');
+compare('-4714 11 27', $hs_date = Date_Calc::DaysToDate(-362, "%Y %m %d"), '-362');
+compare(-362, Date_Calc::DateToDays(27, 11, -4714), '-4714 11 27');
+compare('-4714 11 28', $hs_date = Date_Calc::DaysToDate(-361, "%Y %m %d"), '-361');
+compare(-361, Date_Calc::DateToDays(28, 11, -4714), '-4714 11 28');
+compare('-4714 11 29', $hs_date = Date_Calc::DaysToDate(-360, "%Y %m %d"), '-360');
+compare(-360, Date_Calc::DateToDays(29, 11, -4714), '-4714 11 29');
+compare('-4714 11 30', $hs_date = Date_Calc::DaysToDate(-359, "%Y %m %d"), '-359');
+compare(-359, Date_Calc::DateToDays(30, 11, -4714), '-4714 11 30');
+compare('-4714 12 01', $hs_date = Date_Calc::DaysToDate(-358, "%Y %m %d"), '-358');
+compare(-358, Date_Calc::DateToDays(1, 12, -4714), '-4714 12 01');
+compare('-4714 12 02', $hs_date = Date_Calc::DaysToDate(-357, "%Y %m %d"), '-357');
+compare(-357, Date_Calc::DateToDays(2, 12, -4714), '-4714 12 02');
+compare('-4714 12 03', $hs_date = Date_Calc::DaysToDate(-356, "%Y %m %d"), '-356');
+compare(-356, Date_Calc::DateToDays(3, 12, -4714), '-4714 12 03');
+compare('-4714 12 04', $hs_date = Date_Calc::DaysToDate(-355, "%Y %m %d"), '-355');
+compare(-355, Date_Calc::DateToDays(4, 12, -4714), '-4714 12 04');
+compare('-4714 12 05', $hs_date = Date_Calc::DaysToDate(-354, "%Y %m %d"), '-354');
+compare(-354, Date_Calc::DateToDays(5, 12, -4714), '-4714 12 05');
+compare('-4714 12 06', $hs_date = Date_Calc::DaysToDate(-353, "%Y %m %d"), '-353');
+compare(-353, Date_Calc::DateToDays(6, 12, -4714), '-4714 12 06');
+compare('-4714 12 07', $hs_date = Date_Calc::DaysToDate(-352, "%Y %m %d"), '-352');
+compare(-352, Date_Calc::DateToDays(7, 12, -4714), '-4714 12 07');
+compare('-4714 12 08', $hs_date = Date_Calc::DaysToDate(-351, "%Y %m %d"), '-351');
+compare(-351, Date_Calc::DateToDays(8, 12, -4714), '-4714 12 08');
+compare('-4714 12 09', $hs_date = Date_Calc::DaysToDate(-350, "%Y %m %d"), '-350');
+compare(-350, Date_Calc::DateToDays(9, 12, -4714), '-4714 12 09');
+compare('-4714 12 10', $hs_date = Date_Calc::DaysToDate(-349, "%Y %m %d"), '-349');
+compare(-349, Date_Calc::DateToDays(10, 12, -4714), '-4714 12 10');
+compare('-4714 12 11', $hs_date = Date_Calc::DaysToDate(-348, "%Y %m %d"), '-348');
+compare(-348, Date_Calc::DateToDays(11, 12, -4714), '-4714 12 11');
+compare('-4714 12 12', $hs_date = Date_Calc::DaysToDate(-347, "%Y %m %d"), '-347');
+compare(-347, Date_Calc::DateToDays(12, 12, -4714), '-4714 12 12');
+compare('-4714 12 13', $hs_date = Date_Calc::DaysToDate(-346, "%Y %m %d"), '-346');
+compare(-346, Date_Calc::DateToDays(13, 12, -4714), '-4714 12 13');
+compare('-4714 12 14', $hs_date = Date_Calc::DaysToDate(-345, "%Y %m %d"), '-345');
+compare(-345, Date_Calc::DateToDays(14, 12, -4714), '-4714 12 14');
+compare('-4714 12 15', $hs_date = Date_Calc::DaysToDate(-344, "%Y %m %d"), '-344');
+compare(-344, Date_Calc::DateToDays(15, 12, -4714), '-4714 12 15');
+compare('-4714 12 16', $hs_date = Date_Calc::DaysToDate(-343, "%Y %m %d"), '-343');
+compare(-343, Date_Calc::DateToDays(16, 12, -4714), '-4714 12 16');
+compare('-4714 12 17', $hs_date = Date_Calc::DaysToDate(-342, "%Y %m %d"), '-342');
+compare(-342, Date_Calc::DateToDays(17, 12, -4714), '-4714 12 17');
+compare('-4714 12 18', $hs_date = Date_Calc::DaysToDate(-341, "%Y %m %d"), '-341');
+compare(-341, Date_Calc::DateToDays(18, 12, -4714), '-4714 12 18');
+compare('-4714 12 19', $hs_date = Date_Calc::DaysToDate(-340, "%Y %m %d"), '-340');
+compare(-340, Date_Calc::DateToDays(19, 12, -4714), '-4714 12 19');
+compare('-4714 12 20', $hs_date = Date_Calc::DaysToDate(-339, "%Y %m %d"), '-339');
+compare(-339, Date_Calc::DateToDays(20, 12, -4714), '-4714 12 20');
+compare('-4714 12 21', $hs_date = Date_Calc::DaysToDate(-338, "%Y %m %d"), '-338');
+compare(-338, Date_Calc::DateToDays(21, 12, -4714), '-4714 12 21');
+compare('-4714 12 22', $hs_date = Date_Calc::DaysToDate(-337, "%Y %m %d"), '-337');
+compare(-337, Date_Calc::DateToDays(22, 12, -4714), '-4714 12 22');
+compare('-4714 12 23', $hs_date = Date_Calc::DaysToDate(-336, "%Y %m %d"), '-336');
+compare(-336, Date_Calc::DateToDays(23, 12, -4714), '-4714 12 23');
+compare('-4714 12 24', $hs_date = Date_Calc::DaysToDate(-335, "%Y %m %d"), '-335');
+compare(-335, Date_Calc::DateToDays(24, 12, -4714), '-4714 12 24');
+compare('-4714 12 25', $hs_date = Date_Calc::DaysToDate(-334, "%Y %m %d"), '-334');
+compare(-334, Date_Calc::DateToDays(25, 12, -4714), '-4714 12 25');
+compare('-4714 12 26', $hs_date = Date_Calc::DaysToDate(-333, "%Y %m %d"), '-333');
+compare(-333, Date_Calc::DateToDays(26, 12, -4714), '-4714 12 26');
+compare('-4714 12 27', $hs_date = Date_Calc::DaysToDate(-332, "%Y %m %d"), '-332');
+compare(-332, Date_Calc::DateToDays(27, 12, -4714), '-4714 12 27');
+compare('-4714 12 28', $hs_date = Date_Calc::DaysToDate(-331, "%Y %m %d"), '-331');
+compare(-331, Date_Calc::DateToDays(28, 12, -4714), '-4714 12 28');
+compare('-4714 12 29', $hs_date = Date_Calc::DaysToDate(-330, "%Y %m %d"), '-330');
+compare(-330, Date_Calc::DateToDays(29, 12, -4714), '-4714 12 29');
+compare('-4714 12 30', $hs_date = Date_Calc::DaysToDate(-329, "%Y %m %d"), '-329');
+compare(-329, Date_Calc::DateToDays(30, 12, -4714), '-4714 12 30');
+compare('-4714 12 31', $hs_date = Date_Calc::DaysToDate(-328, "%Y %m %d"), '-328');
+compare(-328, Date_Calc::DateToDays(31, 12, -4714), '-4714 12 31');
+compare('-4713 01 01', $hs_date = Date_Calc::DaysToDate(-327, "%Y %m %d"), '-327');
+compare(-327, Date_Calc::DateToDays(1, 1, -4713), '-4713 01 01');
+compare('-4713 01 02', $hs_date = Date_Calc::DaysToDate(-326, "%Y %m %d"), '-326');
+compare(-326, Date_Calc::DateToDays(2, 1, -4713), '-4713 01 02');
+compare('-4713 01 03', $hs_date = Date_Calc::DaysToDate(-325, "%Y %m %d"), '-325');
+compare(-325, Date_Calc::DateToDays(3, 1, -4713), '-4713 01 03');
+compare('-4713 01 04', $hs_date = Date_Calc::DaysToDate(-324, "%Y %m %d"), '-324');
+compare(-324, Date_Calc::DateToDays(4, 1, -4713), '-4713 01 04');
+compare('-4713 01 05', $hs_date = Date_Calc::DaysToDate(-323, "%Y %m %d"), '-323');
+compare(-323, Date_Calc::DateToDays(5, 1, -4713), '-4713 01 05');
+compare('-4713 01 06', $hs_date = Date_Calc::DaysToDate(-322, "%Y %m %d"), '-322');
+compare(-322, Date_Calc::DateToDays(6, 1, -4713), '-4713 01 06');
+compare('-4713 01 07', $hs_date = Date_Calc::DaysToDate(-321, "%Y %m %d"), '-321');
+compare(-321, Date_Calc::DateToDays(7, 1, -4713), '-4713 01 07');
+compare('-4713 01 08', $hs_date = Date_Calc::DaysToDate(-320, "%Y %m %d"), '-320');
+compare(-320, Date_Calc::DateToDays(8, 1, -4713), '-4713 01 08');
+compare('-4713 01 09', $hs_date = Date_Calc::DaysToDate(-319, "%Y %m %d"), '-319');
+compare(-319, Date_Calc::DateToDays(9, 1, -4713), '-4713 01 09');
+compare('-4713 01 10', $hs_date = Date_Calc::DaysToDate(-318, "%Y %m %d"), '-318');
+compare(-318, Date_Calc::DateToDays(10, 1, -4713), '-4713 01 10');
+compare('-4713 01 11', $hs_date = Date_Calc::DaysToDate(-317, "%Y %m %d"), '-317');
+compare(-317, Date_Calc::DateToDays(11, 1, -4713), '-4713 01 11');
+compare('-4713 01 12', $hs_date = Date_Calc::DaysToDate(-316, "%Y %m %d"), '-316');
+compare(-316, Date_Calc::DateToDays(12, 1, -4713), '-4713 01 12');
+compare('-4713 01 13', $hs_date = Date_Calc::DaysToDate(-315, "%Y %m %d"), '-315');
+compare(-315, Date_Calc::DateToDays(13, 1, -4713), '-4713 01 13');
+compare('-4713 01 14', $hs_date = Date_Calc::DaysToDate(-314, "%Y %m %d"), '-314');
+compare(-314, Date_Calc::DateToDays(14, 1, -4713), '-4713 01 14');
+compare('-4713 01 15', $hs_date = Date_Calc::DaysToDate(-313, "%Y %m %d"), '-313');
+compare(-313, Date_Calc::DateToDays(15, 1, -4713), '-4713 01 15');
+compare('-4713 01 16', $hs_date = Date_Calc::DaysToDate(-312, "%Y %m %d"), '-312');
+compare(-312, Date_Calc::DateToDays(16, 1, -4713), '-4713 01 16');
+compare('-4713 01 17', $hs_date = Date_Calc::DaysToDate(-311, "%Y %m %d"), '-311');
+compare(-311, Date_Calc::DateToDays(17, 1, -4713), '-4713 01 17');
+compare('-4713 01 18', $hs_date = Date_Calc::DaysToDate(-310, "%Y %m %d"), '-310');
+compare(-310, Date_Calc::DateToDays(18, 1, -4713), '-4713 01 18');
+compare('-4713 01 19', $hs_date = Date_Calc::DaysToDate(-309, "%Y %m %d"), '-309');
+compare(-309, Date_Calc::DateToDays(19, 1, -4713), '-4713 01 19');
+compare('-4713 01 20', $hs_date = Date_Calc::DaysToDate(-308, "%Y %m %d"), '-308');
+compare(-308, Date_Calc::DateToDays(20, 1, -4713), '-4713 01 20');
+compare('-4713 01 21', $hs_date = Date_Calc::DaysToDate(-307, "%Y %m %d"), '-307');
+compare(-307, Date_Calc::DateToDays(21, 1, -4713), '-4713 01 21');
+compare('-4713 01 22', $hs_date = Date_Calc::DaysToDate(-306, "%Y %m %d"), '-306');
+compare(-306, Date_Calc::DateToDays(22, 1, -4713), '-4713 01 22');
+compare('-4713 01 23', $hs_date = Date_Calc::DaysToDate(-305, "%Y %m %d"), '-305');
+compare(-305, Date_Calc::DateToDays(23, 1, -4713), '-4713 01 23');
+compare('-4713 01 24', $hs_date = Date_Calc::DaysToDate(-304, "%Y %m %d"), '-304');
+compare(-304, Date_Calc::DateToDays(24, 1, -4713), '-4713 01 24');
+compare('-4713 01 25', $hs_date = Date_Calc::DaysToDate(-303, "%Y %m %d"), '-303');
+compare(-303, Date_Calc::DateToDays(25, 1, -4713), '-4713 01 25');
+compare('-4713 01 26', $hs_date = Date_Calc::DaysToDate(-302, "%Y %m %d"), '-302');
+compare(-302, Date_Calc::DateToDays(26, 1, -4713), '-4713 01 26');
+compare('-4713 01 27', $hs_date = Date_Calc::DaysToDate(-301, "%Y %m %d"), '-301');
+compare(-301, Date_Calc::DateToDays(27, 1, -4713), '-4713 01 27');
+compare('-4713 01 28', $hs_date = Date_Calc::DaysToDate(-300, "%Y %m %d"), '-300');
+compare(-300, Date_Calc::DateToDays(28, 1, -4713), '-4713 01 28');
+compare('-4713 01 29', $hs_date = Date_Calc::DaysToDate(-299, "%Y %m %d"), '-299');
+compare(-299, Date_Calc::DateToDays(29, 1, -4713), '-4713 01 29');
+compare('-4713 01 30', $hs_date = Date_Calc::DaysToDate(-298, "%Y %m %d"), '-298');
+compare(-298, Date_Calc::DateToDays(30, 1, -4713), '-4713 01 30');
+compare('-4713 01 31', $hs_date = Date_Calc::DaysToDate(-297, "%Y %m %d"), '-297');
+compare(-297, Date_Calc::DateToDays(31, 1, -4713), '-4713 01 31');
+compare('-4713 02 01', $hs_date = Date_Calc::DaysToDate(-296, "%Y %m %d"), '-296');
+compare(-296, Date_Calc::DateToDays(1, 2, -4713), '-4713 02 01');
+compare('-4713 02 02', $hs_date = Date_Calc::DaysToDate(-295, "%Y %m %d"), '-295');
+compare(-295, Date_Calc::DateToDays(2, 2, -4713), '-4713 02 02');
+compare('-4713 02 03', $hs_date = Date_Calc::DaysToDate(-294, "%Y %m %d"), '-294');
+compare(-294, Date_Calc::DateToDays(3, 2, -4713), '-4713 02 03');
+compare('-4713 02 04', $hs_date = Date_Calc::DaysToDate(-293, "%Y %m %d"), '-293');
+compare(-293, Date_Calc::DateToDays(4, 2, -4713), '-4713 02 04');
+compare('-4713 02 05', $hs_date = Date_Calc::DaysToDate(-292, "%Y %m %d"), '-292');
+compare(-292, Date_Calc::DateToDays(5, 2, -4713), '-4713 02 05');
+compare('-4713 02 06', $hs_date = Date_Calc::DaysToDate(-291, "%Y %m %d"), '-291');
+compare(-291, Date_Calc::DateToDays(6, 2, -4713), '-4713 02 06');
+compare('-4713 02 07', $hs_date = Date_Calc::DaysToDate(-290, "%Y %m %d"), '-290');
+compare(-290, Date_Calc::DateToDays(7, 2, -4713), '-4713 02 07');
+compare('-4713 02 08', $hs_date = Date_Calc::DaysToDate(-289, "%Y %m %d"), '-289');
+compare(-289, Date_Calc::DateToDays(8, 2, -4713), '-4713 02 08');
+compare('-4713 02 09', $hs_date = Date_Calc::DaysToDate(-288, "%Y %m %d"), '-288');
+compare(-288, Date_Calc::DateToDays(9, 2, -4713), '-4713 02 09');
+compare('-4713 02 10', $hs_date = Date_Calc::DaysToDate(-287, "%Y %m %d"), '-287');
+compare(-287, Date_Calc::DateToDays(10, 2, -4713), '-4713 02 10');
+compare('-4713 02 11', $hs_date = Date_Calc::DaysToDate(-286, "%Y %m %d"), '-286');
+compare(-286, Date_Calc::DateToDays(11, 2, -4713), '-4713 02 11');
+compare('-4713 02 12', $hs_date = Date_Calc::DaysToDate(-285, "%Y %m %d"), '-285');
+compare(-285, Date_Calc::DateToDays(12, 2, -4713), '-4713 02 12');
+compare('-4713 02 13', $hs_date = Date_Calc::DaysToDate(-284, "%Y %m %d"), '-284');
+compare(-284, Date_Calc::DateToDays(13, 2, -4713), '-4713 02 13');
+compare('-4713 02 14', $hs_date = Date_Calc::DaysToDate(-283, "%Y %m %d"), '-283');
+compare(-283, Date_Calc::DateToDays(14, 2, -4713), '-4713 02 14');
+compare('-4713 02 15', $hs_date = Date_Calc::DaysToDate(-282, "%Y %m %d"), '-282');
+compare(-282, Date_Calc::DateToDays(15, 2, -4713), '-4713 02 15');
+compare('-4713 02 16', $hs_date = Date_Calc::DaysToDate(-281, "%Y %m %d"), '-281');
+compare(-281, Date_Calc::DateToDays(16, 2, -4713), '-4713 02 16');
+compare('-4713 02 17', $hs_date = Date_Calc::DaysToDate(-280, "%Y %m %d"), '-280');
+compare(-280, Date_Calc::DateToDays(17, 2, -4713), '-4713 02 17');
+compare('-4713 02 18', $hs_date = Date_Calc::DaysToDate(-279, "%Y %m %d"), '-279');
+compare(-279, Date_Calc::DateToDays(18, 2, -4713), '-4713 02 18');
+compare('-4713 02 19', $hs_date = Date_Calc::DaysToDate(-278, "%Y %m %d"), '-278');
+compare(-278, Date_Calc::DateToDays(19, 2, -4713), '-4713 02 19');
+compare('-4713 02 20', $hs_date = Date_Calc::DaysToDate(-277, "%Y %m %d"), '-277');
+compare(-277, Date_Calc::DateToDays(20, 2, -4713), '-4713 02 20');
+compare('-4713 02 21', $hs_date = Date_Calc::DaysToDate(-276, "%Y %m %d"), '-276');
+compare(-276, Date_Calc::DateToDays(21, 2, -4713), '-4713 02 21');
+compare('-4713 02 22', $hs_date = Date_Calc::DaysToDate(-275, "%Y %m %d"), '-275');
+compare(-275, Date_Calc::DateToDays(22, 2, -4713), '-4713 02 22');
+compare('-4713 02 23', $hs_date = Date_Calc::DaysToDate(-274, "%Y %m %d"), '-274');
+compare(-274, Date_Calc::DateToDays(23, 2, -4713), '-4713 02 23');
+compare('-4713 02 24', $hs_date = Date_Calc::DaysToDate(-273, "%Y %m %d"), '-273');
+compare(-273, Date_Calc::DateToDays(24, 2, -4713), '-4713 02 24');
+compare('-4713 02 25', $hs_date = Date_Calc::DaysToDate(-272, "%Y %m %d"), '-272');
+compare(-272, Date_Calc::DateToDays(25, 2, -4713), '-4713 02 25');
+compare('-4713 02 26', $hs_date = Date_Calc::DaysToDate(-271, "%Y %m %d"), '-271');
+compare(-271, Date_Calc::DateToDays(26, 2, -4713), '-4713 02 26');
+compare('-4713 02 27', $hs_date = Date_Calc::DaysToDate(-270, "%Y %m %d"), '-270');
+compare(-270, Date_Calc::DateToDays(27, 2, -4713), '-4713 02 27');
+compare('-4713 02 28', $hs_date = Date_Calc::DaysToDate(-269, "%Y %m %d"), '-269');
+compare(-269, Date_Calc::DateToDays(28, 2, -4713), '-4713 02 28');
+compare('-4713 03 01', $hs_date = Date_Calc::DaysToDate(-268, "%Y %m %d"), '-268');
+compare(-268, Date_Calc::DateToDays(1, 3, -4713), '-4713 03 01');
+compare('-4713 03 02', $hs_date = Date_Calc::DaysToDate(-267, "%Y %m %d"), '-267');
+compare(-267, Date_Calc::DateToDays(2, 3, -4713), '-4713 03 02');
+compare('-4713 03 03', $hs_date = Date_Calc::DaysToDate(-266, "%Y %m %d"), '-266');
+compare(-266, Date_Calc::DateToDays(3, 3, -4713), '-4713 03 03');
+compare('-4713 03 04', $hs_date = Date_Calc::DaysToDate(-265, "%Y %m %d"), '-265');
+compare(-265, Date_Calc::DateToDays(4, 3, -4713), '-4713 03 04');
+compare('-4713 03 05', $hs_date = Date_Calc::DaysToDate(-264, "%Y %m %d"), '-264');
+compare(-264, Date_Calc::DateToDays(5, 3, -4713), '-4713 03 05');
+compare('-4713 03 06', $hs_date = Date_Calc::DaysToDate(-263, "%Y %m %d"), '-263');
+compare(-263, Date_Calc::DateToDays(6, 3, -4713), '-4713 03 06');
+compare('-4713 03 07', $hs_date = Date_Calc::DaysToDate(-262, "%Y %m %d"), '-262');
+compare(-262, Date_Calc::DateToDays(7, 3, -4713), '-4713 03 07');
+compare('-4713 03 08', $hs_date = Date_Calc::DaysToDate(-261, "%Y %m %d"), '-261');
+compare(-261, Date_Calc::DateToDays(8, 3, -4713), '-4713 03 08');
+compare('-4713 03 09', $hs_date = Date_Calc::DaysToDate(-260, "%Y %m %d"), '-260');
+compare(-260, Date_Calc::DateToDays(9, 3, -4713), '-4713 03 09');
+compare('-4713 03 10', $hs_date = Date_Calc::DaysToDate(-259, "%Y %m %d"), '-259');
+compare(-259, Date_Calc::DateToDays(10, 3, -4713), '-4713 03 10');
+compare('-4713 03 11', $hs_date = Date_Calc::DaysToDate(-258, "%Y %m %d"), '-258');
+compare(-258, Date_Calc::DateToDays(11, 3, -4713), '-4713 03 11');
+compare('-4713 03 12', $hs_date = Date_Calc::DaysToDate(-257, "%Y %m %d"), '-257');
+compare(-257, Date_Calc::DateToDays(12, 3, -4713), '-4713 03 12');
+compare('-4713 03 13', $hs_date = Date_Calc::DaysToDate(-256, "%Y %m %d"), '-256');
+compare(-256, Date_Calc::DateToDays(13, 3, -4713), '-4713 03 13');
+compare('-4713 03 14', $hs_date = Date_Calc::DaysToDate(-255, "%Y %m %d"), '-255');
+compare(-255, Date_Calc::DateToDays(14, 3, -4713), '-4713 03 14');
+compare('-4713 03 15', $hs_date = Date_Calc::DaysToDate(-254, "%Y %m %d"), '-254');
+compare(-254, Date_Calc::DateToDays(15, 3, -4713), '-4713 03 15');
+compare('-4713 03 16', $hs_date = Date_Calc::DaysToDate(-253, "%Y %m %d"), '-253');
+compare(-253, Date_Calc::DateToDays(16, 3, -4713), '-4713 03 16');
+compare('-4713 03 17', $hs_date = Date_Calc::DaysToDate(-252, "%Y %m %d"), '-252');
+compare(-252, Date_Calc::DateToDays(17, 3, -4713), '-4713 03 17');
+compare('-4713 03 18', $hs_date = Date_Calc::DaysToDate(-251, "%Y %m %d"), '-251');
+compare(-251, Date_Calc::DateToDays(18, 3, -4713), '-4713 03 18');
+compare('-4713 03 19', $hs_date = Date_Calc::DaysToDate(-250, "%Y %m %d"), '-250');
+compare(-250, Date_Calc::DateToDays(19, 3, -4713), '-4713 03 19');
+compare('-4713 03 20', $hs_date = Date_Calc::DaysToDate(-249, "%Y %m %d"), '-249');
+compare(-249, Date_Calc::DateToDays(20, 3, -4713), '-4713 03 20');
+compare('-4713 03 21', $hs_date = Date_Calc::DaysToDate(-248, "%Y %m %d"), '-248');
+compare(-248, Date_Calc::DateToDays(21, 3, -4713), '-4713 03 21');
+compare('-4713 03 22', $hs_date = Date_Calc::DaysToDate(-247, "%Y %m %d"), '-247');
+compare(-247, Date_Calc::DateToDays(22, 3, -4713), '-4713 03 22');
+compare('-4713 03 23', $hs_date = Date_Calc::DaysToDate(-246, "%Y %m %d"), '-246');
+compare(-246, Date_Calc::DateToDays(23, 3, -4713), '-4713 03 23');
+compare('-4713 03 24', $hs_date = Date_Calc::DaysToDate(-245, "%Y %m %d"), '-245');
+compare(-245, Date_Calc::DateToDays(24, 3, -4713), '-4713 03 24');
+compare('-4713 03 25', $hs_date = Date_Calc::DaysToDate(-244, "%Y %m %d"), '-244');
+compare(-244, Date_Calc::DateToDays(25, 3, -4713), '-4713 03 25');
+compare('-4713 03 26', $hs_date = Date_Calc::DaysToDate(-243, "%Y %m %d"), '-243');
+compare(-243, Date_Calc::DateToDays(26, 3, -4713), '-4713 03 26');
+compare('-4713 03 27', $hs_date = Date_Calc::DaysToDate(-242, "%Y %m %d"), '-242');
+compare(-242, Date_Calc::DateToDays(27, 3, -4713), '-4713 03 27');
+compare('-4713 03 28', $hs_date = Date_Calc::DaysToDate(-241, "%Y %m %d"), '-241');
+compare(-241, Date_Calc::DateToDays(28, 3, -4713), '-4713 03 28');
+compare('-4713 03 29', $hs_date = Date_Calc::DaysToDate(-240, "%Y %m %d"), '-240');
+compare(-240, Date_Calc::DateToDays(29, 3, -4713), '-4713 03 29');
+compare('-4713 03 30', $hs_date = Date_Calc::DaysToDate(-239, "%Y %m %d"), '-239');
+compare(-239, Date_Calc::DateToDays(30, 3, -4713), '-4713 03 30');
+compare('-4713 03 31', $hs_date = Date_Calc::DaysToDate(-238, "%Y %m %d"), '-238');
+compare(-238, Date_Calc::DateToDays(31, 3, -4713), '-4713 03 31');
+compare('-4713 04 01', $hs_date = Date_Calc::DaysToDate(-237, "%Y %m %d"), '-237');
+compare(-237, Date_Calc::DateToDays(1, 4, -4713), '-4713 04 01');
+compare('-4713 04 02', $hs_date = Date_Calc::DaysToDate(-236, "%Y %m %d"), '-236');
+compare(-236, Date_Calc::DateToDays(2, 4, -4713), '-4713 04 02');
+compare('-4713 04 03', $hs_date = Date_Calc::DaysToDate(-235, "%Y %m %d"), '-235');
+compare(-235, Date_Calc::DateToDays(3, 4, -4713), '-4713 04 03');
+compare('-4713 04 04', $hs_date = Date_Calc::DaysToDate(-234, "%Y %m %d"), '-234');
+compare(-234, Date_Calc::DateToDays(4, 4, -4713), '-4713 04 04');
+compare('-4713 04 05', $hs_date = Date_Calc::DaysToDate(-233, "%Y %m %d"), '-233');
+compare(-233, Date_Calc::DateToDays(5, 4, -4713), '-4713 04 05');
+compare('-4713 04 06', $hs_date = Date_Calc::DaysToDate(-232, "%Y %m %d"), '-232');
+compare(-232, Date_Calc::DateToDays(6, 4, -4713), '-4713 04 06');
+compare('-4713 04 07', $hs_date = Date_Calc::DaysToDate(-231, "%Y %m %d"), '-231');
+compare(-231, Date_Calc::DateToDays(7, 4, -4713), '-4713 04 07');
+compare('-4713 04 08', $hs_date = Date_Calc::DaysToDate(-230, "%Y %m %d"), '-230');
+compare(-230, Date_Calc::DateToDays(8, 4, -4713), '-4713 04 08');
+compare('-4713 04 09', $hs_date = Date_Calc::DaysToDate(-229, "%Y %m %d"), '-229');
+compare(-229, Date_Calc::DateToDays(9, 4, -4713), '-4713 04 09');
+compare('-4713 04 10', $hs_date = Date_Calc::DaysToDate(-228, "%Y %m %d"), '-228');
+compare(-228, Date_Calc::DateToDays(10, 4, -4713), '-4713 04 10');
+compare('-4713 04 11', $hs_date = Date_Calc::DaysToDate(-227, "%Y %m %d"), '-227');
+compare(-227, Date_Calc::DateToDays(11, 4, -4713), '-4713 04 11');
+compare('-4713 04 12', $hs_date = Date_Calc::DaysToDate(-226, "%Y %m %d"), '-226');
+compare(-226, Date_Calc::DateToDays(12, 4, -4713), '-4713 04 12');
+compare('-4713 04 13', $hs_date = Date_Calc::DaysToDate(-225, "%Y %m %d"), '-225');
+compare(-225, Date_Calc::DateToDays(13, 4, -4713), '-4713 04 13');
+compare('-4713 04 14', $hs_date = Date_Calc::DaysToDate(-224, "%Y %m %d"), '-224');
+compare(-224, Date_Calc::DateToDays(14, 4, -4713), '-4713 04 14');
+compare('-4713 04 15', $hs_date = Date_Calc::DaysToDate(-223, "%Y %m %d"), '-223');
+compare(-223, Date_Calc::DateToDays(15, 4, -4713), '-4713 04 15');
+compare('-4713 04 16', $hs_date = Date_Calc::DaysToDate(-222, "%Y %m %d"), '-222');
+compare(-222, Date_Calc::DateToDays(16, 4, -4713), '-4713 04 16');
+compare('-4713 04 17', $hs_date = Date_Calc::DaysToDate(-221, "%Y %m %d"), '-221');
+compare(-221, Date_Calc::DateToDays(17, 4, -4713), '-4713 04 17');
+compare('-4713 04 18', $hs_date = Date_Calc::DaysToDate(-220, "%Y %m %d"), '-220');
+compare(-220, Date_Calc::DateToDays(18, 4, -4713), '-4713 04 18');
+compare('-4713 04 19', $hs_date = Date_Calc::DaysToDate(-219, "%Y %m %d"), '-219');
+compare(-219, Date_Calc::DateToDays(19, 4, -4713), '-4713 04 19');
+compare('-4713 04 20', $hs_date = Date_Calc::DaysToDate(-218, "%Y %m %d"), '-218');
+compare(-218, Date_Calc::DateToDays(20, 4, -4713), '-4713 04 20');
+compare('-4713 04 21', $hs_date = Date_Calc::DaysToDate(-217, "%Y %m %d"), '-217');
+compare(-217, Date_Calc::DateToDays(21, 4, -4713), '-4713 04 21');
+compare('-4713 04 22', $hs_date = Date_Calc::DaysToDate(-216, "%Y %m %d"), '-216');
+compare(-216, Date_Calc::DateToDays(22, 4, -4713), '-4713 04 22');
+compare('-4713 04 23', $hs_date = Date_Calc::DaysToDate(-215, "%Y %m %d"), '-215');
+compare(-215, Date_Calc::DateToDays(23, 4, -4713), '-4713 04 23');
+compare('-4713 04 24', $hs_date = Date_Calc::DaysToDate(-214, "%Y %m %d"), '-214');
+compare(-214, Date_Calc::DateToDays(24, 4, -4713), '-4713 04 24');
+compare('-4713 04 25', $hs_date = Date_Calc::DaysToDate(-213, "%Y %m %d"), '-213');
+compare(-213, Date_Calc::DateToDays(25, 4, -4713), '-4713 04 25');
+compare('-4713 04 26', $hs_date = Date_Calc::DaysToDate(-212, "%Y %m %d"), '-212');
+compare(-212, Date_Calc::DateToDays(26, 4, -4713), '-4713 04 26');
+compare('-4713 04 27', $hs_date = Date_Calc::DaysToDate(-211, "%Y %m %d"), '-211');
+compare(-211, Date_Calc::DateToDays(27, 4, -4713), '-4713 04 27');
+compare('-4713 04 28', $hs_date = Date_Calc::DaysToDate(-210, "%Y %m %d"), '-210');
+compare(-210, Date_Calc::DateToDays(28, 4, -4713), '-4713 04 28');
+compare('-4713 04 29', $hs_date = Date_Calc::DaysToDate(-209, "%Y %m %d"), '-209');
+compare(-209, Date_Calc::DateToDays(29, 4, -4713), '-4713 04 29');
+compare('-4713 04 30', $hs_date = Date_Calc::DaysToDate(-208, "%Y %m %d"), '-208');
+compare(-208, Date_Calc::DateToDays(30, 4, -4713), '-4713 04 30');
+compare('-4713 05 01', $hs_date = Date_Calc::DaysToDate(-207, "%Y %m %d"), '-207');
+compare(-207, Date_Calc::DateToDays(1, 5, -4713), '-4713 05 01');
+compare('-4713 05 02', $hs_date = Date_Calc::DaysToDate(-206, "%Y %m %d"), '-206');
+compare(-206, Date_Calc::DateToDays(2, 5, -4713), '-4713 05 02');
+compare('-4713 05 03', $hs_date = Date_Calc::DaysToDate(-205, "%Y %m %d"), '-205');
+compare(-205, Date_Calc::DateToDays(3, 5, -4713), '-4713 05 03');
+compare('-4713 05 04', $hs_date = Date_Calc::DaysToDate(-204, "%Y %m %d"), '-204');
+compare(-204, Date_Calc::DateToDays(4, 5, -4713), '-4713 05 04');
+compare('-4713 05 05', $hs_date = Date_Calc::DaysToDate(-203, "%Y %m %d"), '-203');
+compare(-203, Date_Calc::DateToDays(5, 5, -4713), '-4713 05 05');
+compare('-4713 05 06', $hs_date = Date_Calc::DaysToDate(-202, "%Y %m %d"), '-202');
+compare(-202, Date_Calc::DateToDays(6, 5, -4713), '-4713 05 06');
+compare('-4713 05 07', $hs_date = Date_Calc::DaysToDate(-201, "%Y %m %d"), '-201');
+compare(-201, Date_Calc::DateToDays(7, 5, -4713), '-4713 05 07');
+compare('-4713 05 08', $hs_date = Date_Calc::DaysToDate(-200, "%Y %m %d"), '-200');
+compare(-200, Date_Calc::DateToDays(8, 5, -4713), '-4713 05 08');
+compare('-4713 05 09', $hs_date = Date_Calc::DaysToDate(-199, "%Y %m %d"), '-199');
+compare(-199, Date_Calc::DateToDays(9, 5, -4713), '-4713 05 09');
+compare('-4713 05 10', $hs_date = Date_Calc::DaysToDate(-198, "%Y %m %d"), '-198');
+compare(-198, Date_Calc::DateToDays(10, 5, -4713), '-4713 05 10');
+compare('-4713 05 11', $hs_date = Date_Calc::DaysToDate(-197, "%Y %m %d"), '-197');
+compare(-197, Date_Calc::DateToDays(11, 5, -4713), '-4713 05 11');
+compare('-4713 05 12', $hs_date = Date_Calc::DaysToDate(-196, "%Y %m %d"), '-196');
+compare(-196, Date_Calc::DateToDays(12, 5, -4713), '-4713 05 12');
+compare('-4713 05 13', $hs_date = Date_Calc::DaysToDate(-195, "%Y %m %d"), '-195');
+compare(-195, Date_Calc::DateToDays(13, 5, -4713), '-4713 05 13');
+compare('-4713 05 14', $hs_date = Date_Calc::DaysToDate(-194, "%Y %m %d"), '-194');
+compare(-194, Date_Calc::DateToDays(14, 5, -4713), '-4713 05 14');
+compare('-4713 05 15', $hs_date = Date_Calc::DaysToDate(-193, "%Y %m %d"), '-193');
+compare(-193, Date_Calc::DateToDays(15, 5, -4713), '-4713 05 15');
+compare('-4713 05 16', $hs_date = Date_Calc::DaysToDate(-192, "%Y %m %d"), '-192');
+compare(-192, Date_Calc::DateToDays(16, 5, -4713), '-4713 05 16');
+compare('-4713 05 17', $hs_date = Date_Calc::DaysToDate(-191, "%Y %m %d"), '-191');
+compare(-191, Date_Calc::DateToDays(17, 5, -4713), '-4713 05 17');
+compare('-4713 05 18', $hs_date = Date_Calc::DaysToDate(-190, "%Y %m %d"), '-190');
+compare(-190, Date_Calc::DateToDays(18, 5, -4713), '-4713 05 18');
+compare('-4713 05 19', $hs_date = Date_Calc::DaysToDate(-189, "%Y %m %d"), '-189');
+compare(-189, Date_Calc::DateToDays(19, 5, -4713), '-4713 05 19');
+compare('-4713 05 20', $hs_date = Date_Calc::DaysToDate(-188, "%Y %m %d"), '-188');
+compare(-188, Date_Calc::DateToDays(20, 5, -4713), '-4713 05 20');
+compare('-4713 05 21', $hs_date = Date_Calc::DaysToDate(-187, "%Y %m %d"), '-187');
+compare(-187, Date_Calc::DateToDays(21, 5, -4713), '-4713 05 21');
+compare('-4713 05 22', $hs_date = Date_Calc::DaysToDate(-186, "%Y %m %d"), '-186');
+compare(-186, Date_Calc::DateToDays(22, 5, -4713), '-4713 05 22');
+compare('-4713 05 23', $hs_date = Date_Calc::DaysToDate(-185, "%Y %m %d"), '-185');
+compare(-185, Date_Calc::DateToDays(23, 5, -4713), '-4713 05 23');
+compare('-4713 05 24', $hs_date = Date_Calc::DaysToDate(-184, "%Y %m %d"), '-184');
+compare(-184, Date_Calc::DateToDays(24, 5, -4713), '-4713 05 24');
+compare('-4713 05 25', $hs_date = Date_Calc::DaysToDate(-183, "%Y %m %d"), '-183');
+compare(-183, Date_Calc::DateToDays(25, 5, -4713), '-4713 05 25');
+compare('-4713 05 26', $hs_date = Date_Calc::DaysToDate(-182, "%Y %m %d"), '-182');
+compare(-182, Date_Calc::DateToDays(26, 5, -4713), '-4713 05 26');
+compare('-4713 05 27', $hs_date = Date_Calc::DaysToDate(-181, "%Y %m %d"), '-181');
+compare(-181, Date_Calc::DateToDays(27, 5, -4713), '-4713 05 27');
+compare('-4713 05 28', $hs_date = Date_Calc::DaysToDate(-180, "%Y %m %d"), '-180');
+compare(-180, Date_Calc::DateToDays(28, 5, -4713), '-4713 05 28');
+compare('-4713 05 29', $hs_date = Date_Calc::DaysToDate(-179, "%Y %m %d"), '-179');
+compare(-179, Date_Calc::DateToDays(29, 5, -4713), '-4713 05 29');
+compare('-4713 05 30', $hs_date = Date_Calc::DaysToDate(-178, "%Y %m %d"), '-178');
+compare(-178, Date_Calc::DateToDays(30, 5, -4713), '-4713 05 30');
+compare('-4713 05 31', $hs_date = Date_Calc::DaysToDate(-177, "%Y %m %d"), '-177');
+compare(-177, Date_Calc::DateToDays(31, 5, -4713), '-4713 05 31');
+compare('-4713 06 01', $hs_date = Date_Calc::DaysToDate(-176, "%Y %m %d"), '-176');
+compare(-176, Date_Calc::DateToDays(1, 6, -4713), '-4713 06 01');
+compare('-4713 06 02', $hs_date = Date_Calc::DaysToDate(-175, "%Y %m %d"), '-175');
+compare(-175, Date_Calc::DateToDays(2, 6, -4713), '-4713 06 02');
+compare('-4713 06 03', $hs_date = Date_Calc::DaysToDate(-174, "%Y %m %d"), '-174');
+compare(-174, Date_Calc::DateToDays(3, 6, -4713), '-4713 06 03');
+compare('-4713 06 04', $hs_date = Date_Calc::DaysToDate(-173, "%Y %m %d"), '-173');
+compare(-173, Date_Calc::DateToDays(4, 6, -4713), '-4713 06 04');
+compare('-4713 06 05', $hs_date = Date_Calc::DaysToDate(-172, "%Y %m %d"), '-172');
+compare(-172, Date_Calc::DateToDays(5, 6, -4713), '-4713 06 05');
+compare('-4713 06 06', $hs_date = Date_Calc::DaysToDate(-171, "%Y %m %d"), '-171');
+compare(-171, Date_Calc::DateToDays(6, 6, -4713), '-4713 06 06');
+compare('-4713 06 07', $hs_date = Date_Calc::DaysToDate(-170, "%Y %m %d"), '-170');
+compare(-170, Date_Calc::DateToDays(7, 6, -4713), '-4713 06 07');
+compare('-4713 06 08', $hs_date = Date_Calc::DaysToDate(-169, "%Y %m %d"), '-169');
+compare(-169, Date_Calc::DateToDays(8, 6, -4713), '-4713 06 08');
+compare('-4713 06 09', $hs_date = Date_Calc::DaysToDate(-168, "%Y %m %d"), '-168');
+compare(-168, Date_Calc::DateToDays(9, 6, -4713), '-4713 06 09');
+compare('-4713 06 10', $hs_date = Date_Calc::DaysToDate(-167, "%Y %m %d"), '-167');
+compare(-167, Date_Calc::DateToDays(10, 6, -4713), '-4713 06 10');
+compare('-4713 06 11', $hs_date = Date_Calc::DaysToDate(-166, "%Y %m %d"), '-166');
+compare(-166, Date_Calc::DateToDays(11, 6, -4713), '-4713 06 11');
+compare('-4713 06 12', $hs_date = Date_Calc::DaysToDate(-165, "%Y %m %d"), '-165');
+compare(-165, Date_Calc::DateToDays(12, 6, -4713), '-4713 06 12');
+compare('-4713 06 13', $hs_date = Date_Calc::DaysToDate(-164, "%Y %m %d"), '-164');
+compare(-164, Date_Calc::DateToDays(13, 6, -4713), '-4713 06 13');
+compare('-4713 06 14', $hs_date = Date_Calc::DaysToDate(-163, "%Y %m %d"), '-163');
+compare(-163, Date_Calc::DateToDays(14, 6, -4713), '-4713 06 14');
+compare('-4713 06 15', $hs_date = Date_Calc::DaysToDate(-162, "%Y %m %d"), '-162');
+compare(-162, Date_Calc::DateToDays(15, 6, -4713), '-4713 06 15');
+compare('-4713 06 16', $hs_date = Date_Calc::DaysToDate(-161, "%Y %m %d"), '-161');
+compare(-161, Date_Calc::DateToDays(16, 6, -4713), '-4713 06 16');
+compare('-4713 06 17', $hs_date = Date_Calc::DaysToDate(-160, "%Y %m %d"), '-160');
+compare(-160, Date_Calc::DateToDays(17, 6, -4713), '-4713 06 17');
+compare('-4713 06 18', $hs_date = Date_Calc::DaysToDate(-159, "%Y %m %d"), '-159');
+compare(-159, Date_Calc::DateToDays(18, 6, -4713), '-4713 06 18');
+compare('-4713 06 19', $hs_date = Date_Calc::DaysToDate(-158, "%Y %m %d"), '-158');
+compare(-158, Date_Calc::DateToDays(19, 6, -4713), '-4713 06 19');
+compare('-4713 06 20', $hs_date = Date_Calc::DaysToDate(-157, "%Y %m %d"), '-157');
+compare(-157, Date_Calc::DateToDays(20, 6, -4713), '-4713 06 20');
+compare('-4713 06 21', $hs_date = Date_Calc::DaysToDate(-156, "%Y %m %d"), '-156');
+compare(-156, Date_Calc::DateToDays(21, 6, -4713), '-4713 06 21');
+compare('-4713 06 22', $hs_date = Date_Calc::DaysToDate(-155, "%Y %m %d"), '-155');
+compare(-155, Date_Calc::DateToDays(22, 6, -4713), '-4713 06 22');
+compare('-4713 06 23', $hs_date = Date_Calc::DaysToDate(-154, "%Y %m %d"), '-154');
+compare(-154, Date_Calc::DateToDays(23, 6, -4713), '-4713 06 23');
+compare('-4713 06 24', $hs_date = Date_Calc::DaysToDate(-153, "%Y %m %d"), '-153');
+compare(-153, Date_Calc::DateToDays(24, 6, -4713), '-4713 06 24');
+compare('-4713 06 25', $hs_date = Date_Calc::DaysToDate(-152, "%Y %m %d"), '-152');
+compare(-152, Date_Calc::DateToDays(25, 6, -4713), '-4713 06 25');
+compare('-4713 06 26', $hs_date = Date_Calc::DaysToDate(-151, "%Y %m %d"), '-151');
+compare(-151, Date_Calc::DateToDays(26, 6, -4713), '-4713 06 26');
+compare('-4713 06 27', $hs_date = Date_Calc::DaysToDate(-150, "%Y %m %d"), '-150');
+compare(-150, Date_Calc::DateToDays(27, 6, -4713), '-4713 06 27');
+compare('-4713 06 28', $hs_date = Date_Calc::DaysToDate(-149, "%Y %m %d"), '-149');
+compare(-149, Date_Calc::DateToDays(28, 6, -4713), '-4713 06 28');
+compare('-4713 06 29', $hs_date = Date_Calc::DaysToDate(-148, "%Y %m %d"), '-148');
+compare(-148, Date_Calc::DateToDays(29, 6, -4713), '-4713 06 29');
+compare('-4713 06 30', $hs_date = Date_Calc::DaysToDate(-147, "%Y %m %d"), '-147');
+compare(-147, Date_Calc::DateToDays(30, 6, -4713), '-4713 06 30');
+compare('-4713 07 01', $hs_date = Date_Calc::DaysToDate(-146, "%Y %m %d"), '-146');
+compare(-146, Date_Calc::DateToDays(1, 7, -4713), '-4713 07 01');
+compare('-4713 07 02', $hs_date = Date_Calc::DaysToDate(-145, "%Y %m %d"), '-145');
+compare(-145, Date_Calc::DateToDays(2, 7, -4713), '-4713 07 02');
+compare('-4713 07 03', $hs_date = Date_Calc::DaysToDate(-144, "%Y %m %d"), '-144');
+compare(-144, Date_Calc::DateToDays(3, 7, -4713), '-4713 07 03');
+compare('-4713 07 04', $hs_date = Date_Calc::DaysToDate(-143, "%Y %m %d"), '-143');
+compare(-143, Date_Calc::DateToDays(4, 7, -4713), '-4713 07 04');
+compare('-4713 07 05', $hs_date = Date_Calc::DaysToDate(-142, "%Y %m %d"), '-142');
+compare(-142, Date_Calc::DateToDays(5, 7, -4713), '-4713 07 05');
+compare('-4713 07 06', $hs_date = Date_Calc::DaysToDate(-141, "%Y %m %d"), '-141');
+compare(-141, Date_Calc::DateToDays(6, 7, -4713), '-4713 07 06');
+compare('-4713 07 07', $hs_date = Date_Calc::DaysToDate(-140, "%Y %m %d"), '-140');
+compare(-140, Date_Calc::DateToDays(7, 7, -4713), '-4713 07 07');
+compare('-4713 07 08', $hs_date = Date_Calc::DaysToDate(-139, "%Y %m %d"), '-139');
+compare(-139, Date_Calc::DateToDays(8, 7, -4713), '-4713 07 08');
+compare('-4713 07 09', $hs_date = Date_Calc::DaysToDate(-138, "%Y %m %d"), '-138');
+compare(-138, Date_Calc::DateToDays(9, 7, -4713), '-4713 07 09');
+compare('-4713 07 10', $hs_date = Date_Calc::DaysToDate(-137, "%Y %m %d"), '-137');
+compare(-137, Date_Calc::DateToDays(10, 7, -4713), '-4713 07 10');
+compare('-4713 07 11', $hs_date = Date_Calc::DaysToDate(-136, "%Y %m %d"), '-136');
+compare(-136, Date_Calc::DateToDays(11, 7, -4713), '-4713 07 11');
+compare('-4713 07 12', $hs_date = Date_Calc::DaysToDate(-135, "%Y %m %d"), '-135');
+compare(-135, Date_Calc::DateToDays(12, 7, -4713), '-4713 07 12');
+compare('-4713 07 13', $hs_date = Date_Calc::DaysToDate(-134, "%Y %m %d"), '-134');
+compare(-134, Date_Calc::DateToDays(13, 7, -4713), '-4713 07 13');
+compare('-4713 07 14', $hs_date = Date_Calc::DaysToDate(-133, "%Y %m %d"), '-133');
+compare(-133, Date_Calc::DateToDays(14, 7, -4713), '-4713 07 14');
+compare('-4713 07 15', $hs_date = Date_Calc::DaysToDate(-132, "%Y %m %d"), '-132');
+compare(-132, Date_Calc::DateToDays(15, 7, -4713), '-4713 07 15');
+compare('-4713 07 16', $hs_date = Date_Calc::DaysToDate(-131, "%Y %m %d"), '-131');
+compare(-131, Date_Calc::DateToDays(16, 7, -4713), '-4713 07 16');
+compare('-4713 07 17', $hs_date = Date_Calc::DaysToDate(-130, "%Y %m %d"), '-130');
+compare(-130, Date_Calc::DateToDays(17, 7, -4713), '-4713 07 17');
+compare('-4713 07 18', $hs_date = Date_Calc::DaysToDate(-129, "%Y %m %d"), '-129');
+compare(-129, Date_Calc::DateToDays(18, 7, -4713), '-4713 07 18');
+compare('-4713 07 19', $hs_date = Date_Calc::DaysToDate(-128, "%Y %m %d"), '-128');
+compare(-128, Date_Calc::DateToDays(19, 7, -4713), '-4713 07 19');
+compare('-4713 07 20', $hs_date = Date_Calc::DaysToDate(-127, "%Y %m %d"), '-127');
+compare(-127, Date_Calc::DateToDays(20, 7, -4713), '-4713 07 20');
+compare('-4713 07 21', $hs_date = Date_Calc::DaysToDate(-126, "%Y %m %d"), '-126');
+compare(-126, Date_Calc::DateToDays(21, 7, -4713), '-4713 07 21');
+compare('-4713 07 22', $hs_date = Date_Calc::DaysToDate(-125, "%Y %m %d"), '-125');
+compare(-125, Date_Calc::DateToDays(22, 7, -4713), '-4713 07 22');
+compare('-4713 07 23', $hs_date = Date_Calc::DaysToDate(-124, "%Y %m %d"), '-124');
+compare(-124, Date_Calc::DateToDays(23, 7, -4713), '-4713 07 23');
+compare('-4713 07 24', $hs_date = Date_Calc::DaysToDate(-123, "%Y %m %d"), '-123');
+compare(-123, Date_Calc::DateToDays(24, 7, -4713), '-4713 07 24');
+compare('-4713 07 25', $hs_date = Date_Calc::DaysToDate(-122, "%Y %m %d"), '-122');
+compare(-122, Date_Calc::DateToDays(25, 7, -4713), '-4713 07 25');
+compare('-4713 07 26', $hs_date = Date_Calc::DaysToDate(-121, "%Y %m %d"), '-121');
+compare(-121, Date_Calc::DateToDays(26, 7, -4713), '-4713 07 26');
+compare('-4713 07 27', $hs_date = Date_Calc::DaysToDate(-120, "%Y %m %d"), '-120');
+compare(-120, Date_Calc::DateToDays(27, 7, -4713), '-4713 07 27');
+compare('-4713 07 28', $hs_date = Date_Calc::DaysToDate(-119, "%Y %m %d"), '-119');
+compare(-119, Date_Calc::DateToDays(28, 7, -4713), '-4713 07 28');
+compare('-4713 07 29', $hs_date = Date_Calc::DaysToDate(-118, "%Y %m %d"), '-118');
+compare(-118, Date_Calc::DateToDays(29, 7, -4713), '-4713 07 29');
+compare('-4713 07 30', $hs_date = Date_Calc::DaysToDate(-117, "%Y %m %d"), '-117');
+compare(-117, Date_Calc::DateToDays(30, 7, -4713), '-4713 07 30');
+compare('-4713 07 31', $hs_date = Date_Calc::DaysToDate(-116, "%Y %m %d"), '-116');
+compare(-116, Date_Calc::DateToDays(31, 7, -4713), '-4713 07 31');
+compare('-4713 08 01', $hs_date = Date_Calc::DaysToDate(-115, "%Y %m %d"), '-115');
+compare(-115, Date_Calc::DateToDays(1, 8, -4713), '-4713 08 01');
+compare('-4713 08 02', $hs_date = Date_Calc::DaysToDate(-114, "%Y %m %d"), '-114');
+compare(-114, Date_Calc::DateToDays(2, 8, -4713), '-4713 08 02');
+compare('-4713 08 03', $hs_date = Date_Calc::DaysToDate(-113, "%Y %m %d"), '-113');
+compare(-113, Date_Calc::DateToDays(3, 8, -4713), '-4713 08 03');
+compare('-4713 08 04', $hs_date = Date_Calc::DaysToDate(-112, "%Y %m %d"), '-112');
+compare(-112, Date_Calc::DateToDays(4, 8, -4713), '-4713 08 04');
+compare('-4713 08 05', $hs_date = Date_Calc::DaysToDate(-111, "%Y %m %d"), '-111');
+compare(-111, Date_Calc::DateToDays(5, 8, -4713), '-4713 08 05');
+compare('-4713 08 06', $hs_date = Date_Calc::DaysToDate(-110, "%Y %m %d"), '-110');
+compare(-110, Date_Calc::DateToDays(6, 8, -4713), '-4713 08 06');
+compare('-4713 08 07', $hs_date = Date_Calc::DaysToDate(-109, "%Y %m %d"), '-109');
+compare(-109, Date_Calc::DateToDays(7, 8, -4713), '-4713 08 07');
+compare('-4713 08 08', $hs_date = Date_Calc::DaysToDate(-108, "%Y %m %d"), '-108');
+compare(-108, Date_Calc::DateToDays(8, 8, -4713), '-4713 08 08');
+compare('-4713 08 09', $hs_date = Date_Calc::DaysToDate(-107, "%Y %m %d"), '-107');
+compare(-107, Date_Calc::DateToDays(9, 8, -4713), '-4713 08 09');
+compare('-4713 08 10', $hs_date = Date_Calc::DaysToDate(-106, "%Y %m %d"), '-106');
+compare(-106, Date_Calc::DateToDays(10, 8, -4713), '-4713 08 10');
+compare('-4713 08 11', $hs_date = Date_Calc::DaysToDate(-105, "%Y %m %d"), '-105');
+compare(-105, Date_Calc::DateToDays(11, 8, -4713), '-4713 08 11');
+compare('-4713 08 12', $hs_date = Date_Calc::DaysToDate(-104, "%Y %m %d"), '-104');
+compare(-104, Date_Calc::DateToDays(12, 8, -4713), '-4713 08 12');
+compare('-4713 08 13', $hs_date = Date_Calc::DaysToDate(-103, "%Y %m %d"), '-103');
+compare(-103, Date_Calc::DateToDays(13, 8, -4713), '-4713 08 13');
+compare('-4713 08 14', $hs_date = Date_Calc::DaysToDate(-102, "%Y %m %d"), '-102');
+compare(-102, Date_Calc::DateToDays(14, 8, -4713), '-4713 08 14');
+compare('-4713 08 15', $hs_date = Date_Calc::DaysToDate(-101, "%Y %m %d"), '-101');
+compare(-101, Date_Calc::DateToDays(15, 8, -4713), '-4713 08 15');
+compare('-4713 08 16', $hs_date = Date_Calc::DaysToDate(-100, "%Y %m %d"), '-100');
+compare(-100, Date_Calc::DateToDays(16, 8, -4713), '-4713 08 16');
+compare('-4713 08 17', $hs_date = Date_Calc::DaysToDate(-99, "%Y %m %d"), '-99');
+compare(-99, Date_Calc::DateToDays(17, 8, -4713), '-4713 08 17');
+compare('-4713 08 18', $hs_date = Date_Calc::DaysToDate(-98, "%Y %m %d"), '-98');
+compare(-98, Date_Calc::DateToDays(18, 8, -4713), '-4713 08 18');
+compare('-4713 08 19', $hs_date = Date_Calc::DaysToDate(-97, "%Y %m %d"), '-97');
+compare(-97, Date_Calc::DateToDays(19, 8, -4713), '-4713 08 19');
+compare('-4713 08 20', $hs_date = Date_Calc::DaysToDate(-96, "%Y %m %d"), '-96');
+compare(-96, Date_Calc::DateToDays(20, 8, -4713), '-4713 08 20');
+compare('-4713 08 21', $hs_date = Date_Calc::DaysToDate(-95, "%Y %m %d"), '-95');
+compare(-95, Date_Calc::DateToDays(21, 8, -4713), '-4713 08 21');
+compare('-4713 08 22', $hs_date = Date_Calc::DaysToDate(-94, "%Y %m %d"), '-94');
+compare(-94, Date_Calc::DateToDays(22, 8, -4713), '-4713 08 22');
+compare('-4713 08 23', $hs_date = Date_Calc::DaysToDate(-93, "%Y %m %d"), '-93');
+compare(-93, Date_Calc::DateToDays(23, 8, -4713), '-4713 08 23');
+compare('-4713 08 24', $hs_date = Date_Calc::DaysToDate(-92, "%Y %m %d"), '-92');
+compare(-92, Date_Calc::DateToDays(24, 8, -4713), '-4713 08 24');
+compare('-4713 08 25', $hs_date = Date_Calc::DaysToDate(-91, "%Y %m %d"), '-91');
+compare(-91, Date_Calc::DateToDays(25, 8, -4713), '-4713 08 25');
+compare('-4713 08 26', $hs_date = Date_Calc::DaysToDate(-90, "%Y %m %d"), '-90');
+compare(-90, Date_Calc::DateToDays(26, 8, -4713), '-4713 08 26');
+compare('-4713 08 27', $hs_date = Date_Calc::DaysToDate(-89, "%Y %m %d"), '-89');
+compare(-89, Date_Calc::DateToDays(27, 8, -4713), '-4713 08 27');
+compare('-4713 08 28', $hs_date = Date_Calc::DaysToDate(-88, "%Y %m %d"), '-88');
+compare(-88, Date_Calc::DateToDays(28, 8, -4713), '-4713 08 28');
+compare('-4713 08 29', $hs_date = Date_Calc::DaysToDate(-87, "%Y %m %d"), '-87');
+compare(-87, Date_Calc::DateToDays(29, 8, -4713), '-4713 08 29');
+compare('-4713 08 30', $hs_date = Date_Calc::DaysToDate(-86, "%Y %m %d"), '-86');
+compare(-86, Date_Calc::DateToDays(30, 8, -4713), '-4713 08 30');
+compare('-4713 08 31', $hs_date = Date_Calc::DaysToDate(-85, "%Y %m %d"), '-85');
+compare(-85, Date_Calc::DateToDays(31, 8, -4713), '-4713 08 31');
+compare('-4713 09 01', $hs_date = Date_Calc::DaysToDate(-84, "%Y %m %d"), '-84');
+compare(-84, Date_Calc::DateToDays(1, 9, -4713), '-4713 09 01');
+compare('-4713 09 02', $hs_date = Date_Calc::DaysToDate(-83, "%Y %m %d"), '-83');
+compare(-83, Date_Calc::DateToDays(2, 9, -4713), '-4713 09 02');
+compare('-4713 09 03', $hs_date = Date_Calc::DaysToDate(-82, "%Y %m %d"), '-82');
+compare(-82, Date_Calc::DateToDays(3, 9, -4713), '-4713 09 03');
+compare('-4713 09 04', $hs_date = Date_Calc::DaysToDate(-81, "%Y %m %d"), '-81');
+compare(-81, Date_Calc::DateToDays(4, 9, -4713), '-4713 09 04');
+compare('-4713 09 05', $hs_date = Date_Calc::DaysToDate(-80, "%Y %m %d"), '-80');
+compare(-80, Date_Calc::DateToDays(5, 9, -4713), '-4713 09 05');
+compare('-4713 09 06', $hs_date = Date_Calc::DaysToDate(-79, "%Y %m %d"), '-79');
+compare(-79, Date_Calc::DateToDays(6, 9, -4713), '-4713 09 06');
+compare('-4713 09 07', $hs_date = Date_Calc::DaysToDate(-78, "%Y %m %d"), '-78');
+compare(-78, Date_Calc::DateToDays(7, 9, -4713), '-4713 09 07');
+compare('-4713 09 08', $hs_date = Date_Calc::DaysToDate(-77, "%Y %m %d"), '-77');
+compare(-77, Date_Calc::DateToDays(8, 9, -4713), '-4713 09 08');
+compare('-4713 09 09', $hs_date = Date_Calc::DaysToDate(-76, "%Y %m %d"), '-76');
+compare(-76, Date_Calc::DateToDays(9, 9, -4713), '-4713 09 09');
+compare('-4713 09 10', $hs_date = Date_Calc::DaysToDate(-75, "%Y %m %d"), '-75');
+compare(-75, Date_Calc::DateToDays(10, 9, -4713), '-4713 09 10');
+compare('-4713 09 11', $hs_date = Date_Calc::DaysToDate(-74, "%Y %m %d"), '-74');
+compare(-74, Date_Calc::DateToDays(11, 9, -4713), '-4713 09 11');
+compare('-4713 09 12', $hs_date = Date_Calc::DaysToDate(-73, "%Y %m %d"), '-73');
+compare(-73, Date_Calc::DateToDays(12, 9, -4713), '-4713 09 12');
+compare('-4713 09 13', $hs_date = Date_Calc::DaysToDate(-72, "%Y %m %d"), '-72');
+compare(-72, Date_Calc::DateToDays(13, 9, -4713), '-4713 09 13');
+compare('-4713 09 14', $hs_date = Date_Calc::DaysToDate(-71, "%Y %m %d"), '-71');
+compare(-71, Date_Calc::DateToDays(14, 9, -4713), '-4713 09 14');
+compare('-4713 09 15', $hs_date = Date_Calc::DaysToDate(-70, "%Y %m %d"), '-70');
+compare(-70, Date_Calc::DateToDays(15, 9, -4713), '-4713 09 15');
+compare('-4713 09 16', $hs_date = Date_Calc::DaysToDate(-69, "%Y %m %d"), '-69');
+compare(-69, Date_Calc::DateToDays(16, 9, -4713), '-4713 09 16');
+compare('-4713 09 17', $hs_date = Date_Calc::DaysToDate(-68, "%Y %m %d"), '-68');
+compare(-68, Date_Calc::DateToDays(17, 9, -4713), '-4713 09 17');
+compare('-4713 09 18', $hs_date = Date_Calc::DaysToDate(-67, "%Y %m %d"), '-67');
+compare(-67, Date_Calc::DateToDays(18, 9, -4713), '-4713 09 18');
+compare('-4713 09 19', $hs_date = Date_Calc::DaysToDate(-66, "%Y %m %d"), '-66');
+compare(-66, Date_Calc::DateToDays(19, 9, -4713), '-4713 09 19');
+compare('-4713 09 20', $hs_date = Date_Calc::DaysToDate(-65, "%Y %m %d"), '-65');
+compare(-65, Date_Calc::DateToDays(20, 9, -4713), '-4713 09 20');
+compare('-4713 09 21', $hs_date = Date_Calc::DaysToDate(-64, "%Y %m %d"), '-64');
+compare(-64, Date_Calc::DateToDays(21, 9, -4713), '-4713 09 21');
+compare('-4713 09 22', $hs_date = Date_Calc::DaysToDate(-63, "%Y %m %d"), '-63');
+compare(-63, Date_Calc::DateToDays(22, 9, -4713), '-4713 09 22');
+compare('-4713 09 23', $hs_date = Date_Calc::DaysToDate(-62, "%Y %m %d"), '-62');
+compare(-62, Date_Calc::DateToDays(23, 9, -4713), '-4713 09 23');
+compare('-4713 09 24', $hs_date = Date_Calc::DaysToDate(-61, "%Y %m %d"), '-61');
+compare(-61, Date_Calc::DateToDays(24, 9, -4713), '-4713 09 24');
+compare('-4713 09 25', $hs_date = Date_Calc::DaysToDate(-60, "%Y %m %d"), '-60');
+compare(-60, Date_Calc::DateToDays(25, 9, -4713), '-4713 09 25');
+compare('-4713 09 26', $hs_date = Date_Calc::DaysToDate(-59, "%Y %m %d"), '-59');
+compare(-59, Date_Calc::DateToDays(26, 9, -4713), '-4713 09 26');
+compare('-4713 09 27', $hs_date = Date_Calc::DaysToDate(-58, "%Y %m %d"), '-58');
+compare(-58, Date_Calc::DateToDays(27, 9, -4713), '-4713 09 27');
+compare('-4713 09 28', $hs_date = Date_Calc::DaysToDate(-57, "%Y %m %d"), '-57');
+compare(-57, Date_Calc::DateToDays(28, 9, -4713), '-4713 09 28');
+compare('-4713 09 29', $hs_date = Date_Calc::DaysToDate(-56, "%Y %m %d"), '-56');
+compare(-56, Date_Calc::DateToDays(29, 9, -4713), '-4713 09 29');
+compare('-4713 09 30', $hs_date = Date_Calc::DaysToDate(-55, "%Y %m %d"), '-55');
+compare(-55, Date_Calc::DateToDays(30, 9, -4713), '-4713 09 30');
+compare('-4713 10 01', $hs_date = Date_Calc::DaysToDate(-54, "%Y %m %d"), '-54');
+compare(-54, Date_Calc::DateToDays(1, 10, -4713), '-4713 10 01');
+compare('-4713 10 02', $hs_date = Date_Calc::DaysToDate(-53, "%Y %m %d"), '-53');
+compare(-53, Date_Calc::DateToDays(2, 10, -4713), '-4713 10 02');
+compare('-4713 10 03', $hs_date = Date_Calc::DaysToDate(-52, "%Y %m %d"), '-52');
+compare(-52, Date_Calc::DateToDays(3, 10, -4713), '-4713 10 03');
+compare('-4713 10 04', $hs_date = Date_Calc::DaysToDate(-51, "%Y %m %d"), '-51');
+compare(-51, Date_Calc::DateToDays(4, 10, -4713), '-4713 10 04');
+compare('-4713 10 05', $hs_date = Date_Calc::DaysToDate(-50, "%Y %m %d"), '-50');
+compare(-50, Date_Calc::DateToDays(5, 10, -4713), '-4713 10 05');
+compare('-4713 10 06', $hs_date = Date_Calc::DaysToDate(-49, "%Y %m %d"), '-49');
+compare(-49, Date_Calc::DateToDays(6, 10, -4713), '-4713 10 06');
+compare('-4713 10 07', $hs_date = Date_Calc::DaysToDate(-48, "%Y %m %d"), '-48');
+compare(-48, Date_Calc::DateToDays(7, 10, -4713), '-4713 10 07');
+compare('-4713 10 08', $hs_date = Date_Calc::DaysToDate(-47, "%Y %m %d"), '-47');
+compare(-47, Date_Calc::DateToDays(8, 10, -4713), '-4713 10 08');
+compare('-4713 10 09', $hs_date = Date_Calc::DaysToDate(-46, "%Y %m %d"), '-46');
+compare(-46, Date_Calc::DateToDays(9, 10, -4713), '-4713 10 09');
+compare('-4713 10 10', $hs_date = Date_Calc::DaysToDate(-45, "%Y %m %d"), '-45');
+compare(-45, Date_Calc::DateToDays(10, 10, -4713), '-4713 10 10');
+compare('-4713 10 11', $hs_date = Date_Calc::DaysToDate(-44, "%Y %m %d"), '-44');
+compare(-44, Date_Calc::DateToDays(11, 10, -4713), '-4713 10 11');
+compare('-4713 10 12', $hs_date = Date_Calc::DaysToDate(-43, "%Y %m %d"), '-43');
+compare(-43, Date_Calc::DateToDays(12, 10, -4713), '-4713 10 12');
+compare('-4713 10 13', $hs_date = Date_Calc::DaysToDate(-42, "%Y %m %d"), '-42');
+compare(-42, Date_Calc::DateToDays(13, 10, -4713), '-4713 10 13');
+compare('-4713 10 14', $hs_date = Date_Calc::DaysToDate(-41, "%Y %m %d"), '-41');
+compare(-41, Date_Calc::DateToDays(14, 10, -4713), '-4713 10 14');
+compare('-4713 10 15', $hs_date = Date_Calc::DaysToDate(-40, "%Y %m %d"), '-40');
+compare(-40, Date_Calc::DateToDays(15, 10, -4713), '-4713 10 15');
+compare('-4713 10 16', $hs_date = Date_Calc::DaysToDate(-39, "%Y %m %d"), '-39');
+compare(-39, Date_Calc::DateToDays(16, 10, -4713), '-4713 10 16');
+compare('-4713 10 17', $hs_date = Date_Calc::DaysToDate(-38, "%Y %m %d"), '-38');
+compare(-38, Date_Calc::DateToDays(17, 10, -4713), '-4713 10 17');
+compare('-4713 10 18', $hs_date = Date_Calc::DaysToDate(-37, "%Y %m %d"), '-37');
+compare(-37, Date_Calc::DateToDays(18, 10, -4713), '-4713 10 18');
+compare('-4713 10 19', $hs_date = Date_Calc::DaysToDate(-36, "%Y %m %d"), '-36');
+compare(-36, Date_Calc::DateToDays(19, 10, -4713), '-4713 10 19');
+compare('-4713 10 20', $hs_date = Date_Calc::DaysToDate(-35, "%Y %m %d"), '-35');
+compare(-35, Date_Calc::DateToDays(20, 10, -4713), '-4713 10 20');
+compare('-4713 10 21', $hs_date = Date_Calc::DaysToDate(-34, "%Y %m %d"), '-34');
+compare(-34, Date_Calc::DateToDays(21, 10, -4713), '-4713 10 21');
+compare('-4713 10 22', $hs_date = Date_Calc::DaysToDate(-33, "%Y %m %d"), '-33');
+compare(-33, Date_Calc::DateToDays(22, 10, -4713), '-4713 10 22');
+compare('-4713 10 23', $hs_date = Date_Calc::DaysToDate(-32, "%Y %m %d"), '-32');
+compare(-32, Date_Calc::DateToDays(23, 10, -4713), '-4713 10 23');
+compare('-4713 10 24', $hs_date = Date_Calc::DaysToDate(-31, "%Y %m %d"), '-31');
+compare(-31, Date_Calc::DateToDays(24, 10, -4713), '-4713 10 24');
+compare('-4713 10 25', $hs_date = Date_Calc::DaysToDate(-30, "%Y %m %d"), '-30');
+compare(-30, Date_Calc::DateToDays(25, 10, -4713), '-4713 10 25');
+compare('-4713 10 26', $hs_date = Date_Calc::DaysToDate(-29, "%Y %m %d"), '-29');
+compare(-29, Date_Calc::DateToDays(26, 10, -4713), '-4713 10 26');
+compare('-4713 10 27', $hs_date = Date_Calc::DaysToDate(-28, "%Y %m %d"), '-28');
+compare(-28, Date_Calc::DateToDays(27, 10, -4713), '-4713 10 27');
+compare('-4713 10 28', $hs_date = Date_Calc::DaysToDate(-27, "%Y %m %d"), '-27');
+compare(-27, Date_Calc::DateToDays(28, 10, -4713), '-4713 10 28');
+compare('-4713 10 29', $hs_date = Date_Calc::DaysToDate(-26, "%Y %m %d"), '-26');
+compare(-26, Date_Calc::DateToDays(29, 10, -4713), '-4713 10 29');
+compare('-4713 10 30', $hs_date = Date_Calc::DaysToDate(-25, "%Y %m %d"), '-25');
+compare(-25, Date_Calc::DateToDays(30, 10, -4713), '-4713 10 30');
+compare('-4713 10 31', $hs_date = Date_Calc::DaysToDate(-24, "%Y %m %d"), '-24');
+compare(-24, Date_Calc::DateToDays(31, 10, -4713), '-4713 10 31');
+compare('-4713 11 01', $hs_date = Date_Calc::DaysToDate(-23, "%Y %m %d"), '-23');
+compare(-23, Date_Calc::DateToDays(1, 11, -4713), '-4713 11 01');
+compare('-4713 11 02', $hs_date = Date_Calc::DaysToDate(-22, "%Y %m %d"), '-22');
+compare(-22, Date_Calc::DateToDays(2, 11, -4713), '-4713 11 02');
+compare('-4713 11 03', $hs_date = Date_Calc::DaysToDate(-21, "%Y %m %d"), '-21');
+compare(-21, Date_Calc::DateToDays(3, 11, -4713), '-4713 11 03');
+compare('-4713 11 04', $hs_date = Date_Calc::DaysToDate(-20, "%Y %m %d"), '-20');
+compare(-20, Date_Calc::DateToDays(4, 11, -4713), '-4713 11 04');
+compare('-4713 11 05', $hs_date = Date_Calc::DaysToDate(-19, "%Y %m %d"), '-19');
+compare(-19, Date_Calc::DateToDays(5, 11, -4713), '-4713 11 05');
+compare('-4713 11 06', $hs_date = Date_Calc::DaysToDate(-18, "%Y %m %d"), '-18');
+compare(-18, Date_Calc::DateToDays(6, 11, -4713), '-4713 11 06');
+compare('-4713 11 07', $hs_date = Date_Calc::DaysToDate(-17, "%Y %m %d"), '-17');
+compare(-17, Date_Calc::DateToDays(7, 11, -4713), '-4713 11 07');
+compare('-4713 11 08', $hs_date = Date_Calc::DaysToDate(-16, "%Y %m %d"), '-16');
+compare(-16, Date_Calc::DateToDays(8, 11, -4713), '-4713 11 08');
+compare('-4713 11 09', $hs_date = Date_Calc::DaysToDate(-15, "%Y %m %d"), '-15');
+compare(-15, Date_Calc::DateToDays(9, 11, -4713), '-4713 11 09');
+compare('-4713 11 10', $hs_date = Date_Calc::DaysToDate(-14, "%Y %m %d"), '-14');
+compare(-14, Date_Calc::DateToDays(10, 11, -4713), '-4713 11 10');
+compare('-4713 11 11', $hs_date = Date_Calc::DaysToDate(-13, "%Y %m %d"), '-13');
+compare(-13, Date_Calc::DateToDays(11, 11, -4713), '-4713 11 11');
+compare('-4713 11 12', $hs_date = Date_Calc::DaysToDate(-12, "%Y %m %d"), '-12');
+compare(-12, Date_Calc::DateToDays(12, 11, -4713), '-4713 11 12');
+compare('-4713 11 13', $hs_date = Date_Calc::DaysToDate(-11, "%Y %m %d"), '-11');
+compare(-11, Date_Calc::DateToDays(13, 11, -4713), '-4713 11 13');
+compare('-4713 11 14', $hs_date = Date_Calc::DaysToDate(-10, "%Y %m %d"), '-10');
+compare(-10, Date_Calc::DateToDays(14, 11, -4713), '-4713 11 14');
+compare('-4713 11 15', $hs_date = Date_Calc::DaysToDate(-9, "%Y %m %d"), '-9');
+compare(-9, Date_Calc::DateToDays(15, 11, -4713), '-4713 11 15');
+compare('-4713 11 16', $hs_date = Date_Calc::DaysToDate(-8, "%Y %m %d"), '-8');
+compare(-8, Date_Calc::DateToDays(16, 11, -4713), '-4713 11 16');
+compare('-4713 11 17', $hs_date = Date_Calc::DaysToDate(-7, "%Y %m %d"), '-7');
+compare(-7, Date_Calc::DateToDays(17, 11, -4713), '-4713 11 17');
+compare('-4713 11 18', $hs_date = Date_Calc::DaysToDate(-6, "%Y %m %d"), '-6');
+compare(-6, Date_Calc::DateToDays(18, 11, -4713), '-4713 11 18');
+compare('-4713 11 19', $hs_date = Date_Calc::DaysToDate(-5, "%Y %m %d"), '-5');
+compare(-5, Date_Calc::DateToDays(19, 11, -4713), '-4713 11 19');
+compare('-4713 11 20', $hs_date = Date_Calc::DaysToDate(-4, "%Y %m %d"), '-4');
+compare(-4, Date_Calc::DateToDays(20, 11, -4713), '-4713 11 20');
+compare('-4713 11 21', $hs_date = Date_Calc::DaysToDate(-3, "%Y %m %d"), '-3');
+compare(-3, Date_Calc::DateToDays(21, 11, -4713), '-4713 11 21');
+compare('-4713 11 22', $hs_date = Date_Calc::DaysToDate(-2, "%Y %m %d"), '-2');
+compare(-2, Date_Calc::DateToDays(22, 11, -4713), '-4713 11 22');
+compare('-4713 11 23', $hs_date = Date_Calc::DaysToDate(-1, "%Y %m %d"), '-1');
+compare(-1, Date_Calc::DateToDays(23, 11, -4713), '-4713 11 23');
+compare('-4713 11 24', $hs_date = Date_Calc::DaysToDate(0, "%Y %m %d"), '0');
+compare(0, Date_Calc::DateToDays(24, 11, -4713), '-4713 11 24');
+compare('-4713 11 25', $hs_date = Date_Calc::DaysToDate(1, "%Y %m %d"), '1');
+compare(1, Date_Calc::DateToDays(25, 11, -4713), '-4713 11 25');
+compare('-4713 11 26', $hs_date = Date_Calc::DaysToDate(2, "%Y %m %d"), '2');
+compare(2, Date_Calc::DateToDays(26, 11, -4713), '-4713 11 26');
+compare('-4713 11 27', $hs_date = Date_Calc::DaysToDate(3, "%Y %m %d"), '3');
+compare(3, Date_Calc::DateToDays(27, 11, -4713), '-4713 11 27');
+compare('-4713 11 28', $hs_date = Date_Calc::DaysToDate(4, "%Y %m %d"), '4');
+compare(4, Date_Calc::DateToDays(28, 11, -4713), '-4713 11 28');
+compare('-4713 11 29', $hs_date = Date_Calc::DaysToDate(5, "%Y %m %d"), '5');
+compare(5, Date_Calc::DateToDays(29, 11, -4713), '-4713 11 29');
+compare('-4713 11 30', $hs_date = Date_Calc::DaysToDate(6, "%Y %m %d"), '6');
+compare(6, Date_Calc::DateToDays(30, 11, -4713), '-4713 11 30');
+compare('-4713 12 01', $hs_date = Date_Calc::DaysToDate(7, "%Y %m %d"), '7');
+compare(7, Date_Calc::DateToDays(1, 12, -4713), '-4713 12 01');
+compare('-4713 12 02', $hs_date = Date_Calc::DaysToDate(8, "%Y %m %d"), '8');
+compare(8, Date_Calc::DateToDays(2, 12, -4713), '-4713 12 02');
+compare('-4713 12 03', $hs_date = Date_Calc::DaysToDate(9, "%Y %m %d"), '9');
+compare(9, Date_Calc::DateToDays(3, 12, -4713), '-4713 12 03');
+compare('-4713 12 04', $hs_date = Date_Calc::DaysToDate(10, "%Y %m %d"), '10');
+compare(10, Date_Calc::DateToDays(4, 12, -4713), '-4713 12 04');
+compare('-4713 12 05', $hs_date = Date_Calc::DaysToDate(11, "%Y %m %d"), '11');
+compare(11, Date_Calc::DateToDays(5, 12, -4713), '-4713 12 05');
+compare('-4713 12 06', $hs_date = Date_Calc::DaysToDate(12, "%Y %m %d"), '12');
+compare(12, Date_Calc::DateToDays(6, 12, -4713), '-4713 12 06');
+compare('-4713 12 07', $hs_date = Date_Calc::DaysToDate(13, "%Y %m %d"), '13');
+compare(13, Date_Calc::DateToDays(7, 12, -4713), '-4713 12 07');
+compare('-4713 12 08', $hs_date = Date_Calc::DaysToDate(14, "%Y %m %d"), '14');
+compare(14, Date_Calc::DateToDays(8, 12, -4713), '-4713 12 08');
+compare('-4713 12 09', $hs_date = Date_Calc::DaysToDate(15, "%Y %m %d"), '15');
+compare(15, Date_Calc::DateToDays(9, 12, -4713), '-4713 12 09');
+compare('-4713 12 10', $hs_date = Date_Calc::DaysToDate(16, "%Y %m %d"), '16');
+compare(16, Date_Calc::DateToDays(10, 12, -4713), '-4713 12 10');
+compare('-4713 12 11', $hs_date = Date_Calc::DaysToDate(17, "%Y %m %d"), '17');
+compare(17, Date_Calc::DateToDays(11, 12, -4713), '-4713 12 11');
+compare('-4713 12 12', $hs_date = Date_Calc::DaysToDate(18, "%Y %m %d"), '18');
+compare(18, Date_Calc::DateToDays(12, 12, -4713), '-4713 12 12');
+compare('-4713 12 13', $hs_date = Date_Calc::DaysToDate(19, "%Y %m %d"), '19');
+compare(19, Date_Calc::DateToDays(13, 12, -4713), '-4713 12 13');
+compare('-4713 12 14', $hs_date = Date_Calc::DaysToDate(20, "%Y %m %d"), '20');
+compare(20, Date_Calc::DateToDays(14, 12, -4713), '-4713 12 14');
+compare('-4713 12 15', $hs_date = Date_Calc::DaysToDate(21, "%Y %m %d"), '21');
+compare(21, Date_Calc::DateToDays(15, 12, -4713), '-4713 12 15');
+compare('-4713 12 16', $hs_date = Date_Calc::DaysToDate(22, "%Y %m %d"), '22');
+compare(22, Date_Calc::DateToDays(16, 12, -4713), '-4713 12 16');
+compare('-4713 12 17', $hs_date = Date_Calc::DaysToDate(23, "%Y %m %d"), '23');
+compare(23, Date_Calc::DateToDays(17, 12, -4713), '-4713 12 17');
+compare('-4713 12 18', $hs_date = Date_Calc::DaysToDate(24, "%Y %m %d"), '24');
+compare(24, Date_Calc::DateToDays(18, 12, -4713), '-4713 12 18');
+compare('-4713 12 19', $hs_date = Date_Calc::DaysToDate(25, "%Y %m %d"), '25');
+compare(25, Date_Calc::DateToDays(19, 12, -4713), '-4713 12 19');
+compare('-4713 12 20', $hs_date = Date_Calc::DaysToDate(26, "%Y %m %d"), '26');
+compare(26, Date_Calc::DateToDays(20, 12, -4713), '-4713 12 20');
+compare('-4713 12 21', $hs_date = Date_Calc::DaysToDate(27, "%Y %m %d"), '27');
+compare(27, Date_Calc::DateToDays(21, 12, -4713), '-4713 12 21');
+compare('-4713 12 22', $hs_date = Date_Calc::DaysToDate(28, "%Y %m %d"), '28');
+compare(28, Date_Calc::DateToDays(22, 12, -4713), '-4713 12 22');
+compare('-4713 12 23', $hs_date = Date_Calc::DaysToDate(29, "%Y %m %d"), '29');
+compare(29, Date_Calc::DateToDays(23, 12, -4713), '-4713 12 23');
+compare('-4713 12 24', $hs_date = Date_Calc::DaysToDate(30, "%Y %m %d"), '30');
+compare(30, Date_Calc::DateToDays(24, 12, -4713), '-4713 12 24');
+compare('-4713 12 25', $hs_date = Date_Calc::DaysToDate(31, "%Y %m %d"), '31');
+compare(31, Date_Calc::DateToDays(25, 12, -4713), '-4713 12 25');
+compare('-4713 12 26', $hs_date = Date_Calc::DaysToDate(32, "%Y %m %d"), '32');
+compare(32, Date_Calc::DateToDays(26, 12, -4713), '-4713 12 26');
+compare('-4713 12 27', $hs_date = Date_Calc::DaysToDate(33, "%Y %m %d"), '33');
+compare(33, Date_Calc::DateToDays(27, 12, -4713), '-4713 12 27');
+compare('-4713 12 28', $hs_date = Date_Calc::DaysToDate(34, "%Y %m %d"), '34');
+compare(34, Date_Calc::DateToDays(28, 12, -4713), '-4713 12 28');
+compare('-4713 12 29', $hs_date = Date_Calc::DaysToDate(35, "%Y %m %d"), '35');
+compare(35, Date_Calc::DateToDays(29, 12, -4713), '-4713 12 29');
+compare('-4713 12 30', $hs_date = Date_Calc::DaysToDate(36, "%Y %m %d"), '36');
+compare(36, Date_Calc::DateToDays(30, 12, -4713), '-4713 12 30');
+compare('-4713 12 31', $hs_date = Date_Calc::DaysToDate(37, "%Y %m %d"), '37');
+compare(37, Date_Calc::DateToDays(31, 12, -4713), '-4713 12 31');
+compare('-4712 01 01', $hs_date = Date_Calc::DaysToDate(38, "%Y %m %d"), '38');
+compare(38, Date_Calc::DateToDays(1, 1, -4712), '-4712 01 01');
+compare('-4712 01 02', $hs_date = Date_Calc::DaysToDate(39, "%Y %m %d"), '39');
+compare(39, Date_Calc::DateToDays(2, 1, -4712), '-4712 01 02');
+compare('-4712 01 03', $hs_date = Date_Calc::DaysToDate(40, "%Y %m %d"), '40');
+compare(40, Date_Calc::DateToDays(3, 1, -4712), '-4712 01 03');
+compare('-4712 01 04', $hs_date = Date_Calc::DaysToDate(41, "%Y %m %d"), '41');
+compare(41, Date_Calc::DateToDays(4, 1, -4712), '-4712 01 04');
+compare('-4712 01 05', $hs_date = Date_Calc::DaysToDate(42, "%Y %m %d"), '42');
+compare(42, Date_Calc::DateToDays(5, 1, -4712), '-4712 01 05');
+compare('-4712 01 06', $hs_date = Date_Calc::DaysToDate(43, "%Y %m %d"), '43');
+compare(43, Date_Calc::DateToDays(6, 1, -4712), '-4712 01 06');
+compare('-4712 01 07', $hs_date = Date_Calc::DaysToDate(44, "%Y %m %d"), '44');
+compare(44, Date_Calc::DateToDays(7, 1, -4712), '-4712 01 07');
+compare('-4712 01 08', $hs_date = Date_Calc::DaysToDate(45, "%Y %m %d"), '45');
+compare(45, Date_Calc::DateToDays(8, 1, -4712), '-4712 01 08');
+compare('-4712 01 09', $hs_date = Date_Calc::DaysToDate(46, "%Y %m %d"), '46');
+compare(46, Date_Calc::DateToDays(9, 1, -4712), '-4712 01 09');
+compare('-4712 01 10', $hs_date = Date_Calc::DaysToDate(47, "%Y %m %d"), '47');
+compare(47, Date_Calc::DateToDays(10, 1, -4712), '-4712 01 10');
+compare('-4712 01 11', $hs_date = Date_Calc::DaysToDate(48, "%Y %m %d"), '48');
+compare(48, Date_Calc::DateToDays(11, 1, -4712), '-4712 01 11');
+compare('-4712 01 12', $hs_date = Date_Calc::DaysToDate(49, "%Y %m %d"), '49');
+compare(49, Date_Calc::DateToDays(12, 1, -4712), '-4712 01 12');
+compare('-4712 01 13', $hs_date = Date_Calc::DaysToDate(50, "%Y %m %d"), '50');
+compare(50, Date_Calc::DateToDays(13, 1, -4712), '-4712 01 13');
+compare('-4712 01 14', $hs_date = Date_Calc::DaysToDate(51, "%Y %m %d"), '51');
+compare(51, Date_Calc::DateToDays(14, 1, -4712), '-4712 01 14');
+compare('-4712 01 15', $hs_date = Date_Calc::DaysToDate(52, "%Y %m %d"), '52');
+compare(52, Date_Calc::DateToDays(15, 1, -4712), '-4712 01 15');
+compare('-4712 01 16', $hs_date = Date_Calc::DaysToDate(53, "%Y %m %d"), '53');
+compare(53, Date_Calc::DateToDays(16, 1, -4712), '-4712 01 16');
+compare('-4712 01 17', $hs_date = Date_Calc::DaysToDate(54, "%Y %m %d"), '54');
+compare(54, Date_Calc::DateToDays(17, 1, -4712), '-4712 01 17');
+compare('-4712 01 18', $hs_date = Date_Calc::DaysToDate(55, "%Y %m %d"), '55');
+compare(55, Date_Calc::DateToDays(18, 1, -4712), '-4712 01 18');
+compare('-4712 01 19', $hs_date = Date_Calc::DaysToDate(56, "%Y %m %d"), '56');
+compare(56, Date_Calc::DateToDays(19, 1, -4712), '-4712 01 19');
+compare('-4712 01 20', $hs_date = Date_Calc::DaysToDate(57, "%Y %m %d"), '57');
+compare(57, Date_Calc::DateToDays(20, 1, -4712), '-4712 01 20');
+compare('-4712 01 21', $hs_date = Date_Calc::DaysToDate(58, "%Y %m %d"), '58');
+compare(58, Date_Calc::DateToDays(21, 1, -4712), '-4712 01 21');
+compare('-4712 01 22', $hs_date = Date_Calc::DaysToDate(59, "%Y %m %d"), '59');
+compare(59, Date_Calc::DateToDays(22, 1, -4712), '-4712 01 22');
+compare('-4712 01 23', $hs_date = Date_Calc::DaysToDate(60, "%Y %m %d"), '60');
+compare(60, Date_Calc::DateToDays(23, 1, -4712), '-4712 01 23');
+compare('-4712 01 24', $hs_date = Date_Calc::DaysToDate(61, "%Y %m %d"), '61');
+compare(61, Date_Calc::DateToDays(24, 1, -4712), '-4712 01 24');
+compare('-4712 01 25', $hs_date = Date_Calc::DaysToDate(62, "%Y %m %d"), '62');
+compare(62, Date_Calc::DateToDays(25, 1, -4712), '-4712 01 25');
+compare('-4712 01 26', $hs_date = Date_Calc::DaysToDate(63, "%Y %m %d"), '63');
+compare(63, Date_Calc::DateToDays(26, 1, -4712), '-4712 01 26');
+compare('-4712 01 27', $hs_date = Date_Calc::DaysToDate(64, "%Y %m %d"), '64');
+compare(64, Date_Calc::DateToDays(27, 1, -4712), '-4712 01 27');
+compare('-4712 01 28', $hs_date = Date_Calc::DaysToDate(65, "%Y %m %d"), '65');
+compare(65, Date_Calc::DateToDays(28, 1, -4712), '-4712 01 28');
+compare('-4712 01 29', $hs_date = Date_Calc::DaysToDate(66, "%Y %m %d"), '66');
+compare(66, Date_Calc::DateToDays(29, 1, -4712), '-4712 01 29');
+compare('-4712 01 30', $hs_date = Date_Calc::DaysToDate(67, "%Y %m %d"), '67');
+compare(67, Date_Calc::DateToDays(30, 1, -4712), '-4712 01 30');
+compare('-4712 01 31', $hs_date = Date_Calc::DaysToDate(68, "%Y %m %d"), '68');
+compare(68, Date_Calc::DateToDays(31, 1, -4712), '-4712 01 31');
+compare('-4712 02 01', $hs_date = Date_Calc::DaysToDate(69, "%Y %m %d"), '69');
+compare(69, Date_Calc::DateToDays(1, 2, -4712), '-4712 02 01');
+compare('-4712 02 02', $hs_date = Date_Calc::DaysToDate(70, "%Y %m %d"), '70');
+compare(70, Date_Calc::DateToDays(2, 2, -4712), '-4712 02 02');
+compare('-4712 02 03', $hs_date = Date_Calc::DaysToDate(71, "%Y %m %d"), '71');
+compare(71, Date_Calc::DateToDays(3, 2, -4712), '-4712 02 03');
+compare('-4712 02 04', $hs_date = Date_Calc::DaysToDate(72, "%Y %m %d"), '72');
+compare(72, Date_Calc::DateToDays(4, 2, -4712), '-4712 02 04');
+compare('-4712 02 05', $hs_date = Date_Calc::DaysToDate(73, "%Y %m %d"), '73');
+compare(73, Date_Calc::DateToDays(5, 2, -4712), '-4712 02 05');
+compare('-4712 02 06', $hs_date = Date_Calc::DaysToDate(74, "%Y %m %d"), '74');
+compare(74, Date_Calc::DateToDays(6, 2, -4712), '-4712 02 06');
+compare('-4712 02 07', $hs_date = Date_Calc::DaysToDate(75, "%Y %m %d"), '75');
+compare(75, Date_Calc::DateToDays(7, 2, -4712), '-4712 02 07');
+compare('-4712 02 08', $hs_date = Date_Calc::DaysToDate(76, "%Y %m %d"), '76');
+compare(76, Date_Calc::DateToDays(8, 2, -4712), '-4712 02 08');
+compare('-4712 02 09', $hs_date = Date_Calc::DaysToDate(77, "%Y %m %d"), '77');
+compare(77, Date_Calc::DateToDays(9, 2, -4712), '-4712 02 09');
+compare('-4712 02 10', $hs_date = Date_Calc::DaysToDate(78, "%Y %m %d"), '78');
+compare(78, Date_Calc::DateToDays(10, 2, -4712), '-4712 02 10');
+compare('-4712 02 11', $hs_date = Date_Calc::DaysToDate(79, "%Y %m %d"), '79');
+compare(79, Date_Calc::DateToDays(11, 2, -4712), '-4712 02 11');
+compare('-4712 02 12', $hs_date = Date_Calc::DaysToDate(80, "%Y %m %d"), '80');
+compare(80, Date_Calc::DateToDays(12, 2, -4712), '-4712 02 12');
+compare('-4712 02 13', $hs_date = Date_Calc::DaysToDate(81, "%Y %m %d"), '81');
+compare(81, Date_Calc::DateToDays(13, 2, -4712), '-4712 02 13');
+compare('-4712 02 14', $hs_date = Date_Calc::DaysToDate(82, "%Y %m %d"), '82');
+compare(82, Date_Calc::DateToDays(14, 2, -4712), '-4712 02 14');
+compare('-4712 02 15', $hs_date = Date_Calc::DaysToDate(83, "%Y %m %d"), '83');
+compare(83, Date_Calc::DateToDays(15, 2, -4712), '-4712 02 15');
+compare('-4712 02 16', $hs_date = Date_Calc::DaysToDate(84, "%Y %m %d"), '84');
+compare(84, Date_Calc::DateToDays(16, 2, -4712), '-4712 02 16');
+compare('-4712 02 17', $hs_date = Date_Calc::DaysToDate(85, "%Y %m %d"), '85');
+compare(85, Date_Calc::DateToDays(17, 2, -4712), '-4712 02 17');
+compare('-4712 02 18', $hs_date = Date_Calc::DaysToDate(86, "%Y %m %d"), '86');
+compare(86, Date_Calc::DateToDays(18, 2, -4712), '-4712 02 18');
+compare('-4712 02 19', $hs_date = Date_Calc::DaysToDate(87, "%Y %m %d"), '87');
+compare(87, Date_Calc::DateToDays(19, 2, -4712), '-4712 02 19');
+compare('-4712 02 20', $hs_date = Date_Calc::DaysToDate(88, "%Y %m %d"), '88');
+compare(88, Date_Calc::DateToDays(20, 2, -4712), '-4712 02 20');
+compare('-4712 02 21', $hs_date = Date_Calc::DaysToDate(89, "%Y %m %d"), '89');
+compare(89, Date_Calc::DateToDays(21, 2, -4712), '-4712 02 21');
+compare('-4712 02 22', $hs_date = Date_Calc::DaysToDate(90, "%Y %m %d"), '90');
+compare(90, Date_Calc::DateToDays(22, 2, -4712), '-4712 02 22');
+compare('-4712 02 23', $hs_date = Date_Calc::DaysToDate(91, "%Y %m %d"), '91');
+compare(91, Date_Calc::DateToDays(23, 2, -4712), '-4712 02 23');
+compare('-4712 02 24', $hs_date = Date_Calc::DaysToDate(92, "%Y %m %d"), '92');
+compare(92, Date_Calc::DateToDays(24, 2, -4712), '-4712 02 24');
+compare('-4712 02 25', $hs_date = Date_Calc::DaysToDate(93, "%Y %m %d"), '93');
+compare(93, Date_Calc::DateToDays(25, 2, -4712), '-4712 02 25');
+compare('-4712 02 26', $hs_date = Date_Calc::DaysToDate(94, "%Y %m %d"), '94');
+compare(94, Date_Calc::DateToDays(26, 2, -4712), '-4712 02 26');
+compare('-4712 02 27', $hs_date = Date_Calc::DaysToDate(95, "%Y %m %d"), '95');
+compare(95, Date_Calc::DateToDays(27, 2, -4712), '-4712 02 27');
+compare('-4712 02 28', $hs_date = Date_Calc::DaysToDate(96, "%Y %m %d"), '96');
+compare(96, Date_Calc::DateToDays(28, 2, -4712), '-4712 02 28');
+compare('-4712 02 29', $hs_date = Date_Calc::DaysToDate(97, "%Y %m %d"), '97');
+compare(97, Date_Calc::DateToDays(29, 2, -4712), '-4712 02 29');
+compare('-4712 03 01', $hs_date = Date_Calc::DaysToDate(98, "%Y %m %d"), '98');
+compare(98, Date_Calc::DateToDays(1, 3, -4712), '-4712 03 01');
+compare('-4712 03 02', $hs_date = Date_Calc::DaysToDate(99, "%Y %m %d"), '99');
+compare(99, Date_Calc::DateToDays(2, 3, -4712), '-4712 03 02');
+compare('-4712 03 03', $hs_date = Date_Calc::DaysToDate(100, "%Y %m %d"), '100');
+compare(100, Date_Calc::DateToDays(3, 3, -4712), '-4712 03 03');
+compare('-4712 03 04', $hs_date = Date_Calc::DaysToDate(101, "%Y %m %d"), '101');
+compare(101, Date_Calc::DateToDays(4, 3, -4712), '-4712 03 04');
+compare('-4712 03 05', $hs_date = Date_Calc::DaysToDate(102, "%Y %m %d"), '102');
+compare(102, Date_Calc::DateToDays(5, 3, -4712), '-4712 03 05');
+compare('-4712 03 06', $hs_date = Date_Calc::DaysToDate(103, "%Y %m %d"), '103');
+compare(103, Date_Calc::DateToDays(6, 3, -4712), '-4712 03 06');
+compare('-4712 03 07', $hs_date = Date_Calc::DaysToDate(104, "%Y %m %d"), '104');
+compare(104, Date_Calc::DateToDays(7, 3, -4712), '-4712 03 07');
+compare('-4712 03 08', $hs_date = Date_Calc::DaysToDate(105, "%Y %m %d"), '105');
+compare(105, Date_Calc::DateToDays(8, 3, -4712), '-4712 03 08');
+compare('-4712 03 09', $hs_date = Date_Calc::DaysToDate(106, "%Y %m %d"), '106');
+compare(106, Date_Calc::DateToDays(9, 3, -4712), '-4712 03 09');
+compare('-4712 03 10', $hs_date = Date_Calc::DaysToDate(107, "%Y %m %d"), '107');
+compare(107, Date_Calc::DateToDays(10, 3, -4712), '-4712 03 10');
+compare('-4712 03 11', $hs_date = Date_Calc::DaysToDate(108, "%Y %m %d"), '108');
+compare(108, Date_Calc::DateToDays(11, 3, -4712), '-4712 03 11');
+compare('-4712 03 12', $hs_date = Date_Calc::DaysToDate(109, "%Y %m %d"), '109');
+compare(109, Date_Calc::DateToDays(12, 3, -4712), '-4712 03 12');
+compare('-4712 03 13', $hs_date = Date_Calc::DaysToDate(110, "%Y %m %d"), '110');
+compare(110, Date_Calc::DateToDays(13, 3, -4712), '-4712 03 13');
+compare('-4712 03 14', $hs_date = Date_Calc::DaysToDate(111, "%Y %m %d"), '111');
+compare(111, Date_Calc::DateToDays(14, 3, -4712), '-4712 03 14');
+compare('-4712 03 15', $hs_date = Date_Calc::DaysToDate(112, "%Y %m %d"), '112');
+compare(112, Date_Calc::DateToDays(15, 3, -4712), '-4712 03 15');
+compare('-4712 03 16', $hs_date = Date_Calc::DaysToDate(113, "%Y %m %d"), '113');
+compare(113, Date_Calc::DateToDays(16, 3, -4712), '-4712 03 16');
+compare('-4712 03 17', $hs_date = Date_Calc::DaysToDate(114, "%Y %m %d"), '114');
+compare(114, Date_Calc::DateToDays(17, 3, -4712), '-4712 03 17');
+compare('-4712 03 18', $hs_date = Date_Calc::DaysToDate(115, "%Y %m %d"), '115');
+compare(115, Date_Calc::DateToDays(18, 3, -4712), '-4712 03 18');
+compare('-4712 03 19', $hs_date = Date_Calc::DaysToDate(116, "%Y %m %d"), '116');
+compare(116, Date_Calc::DateToDays(19, 3, -4712), '-4712 03 19');
+compare('-4712 03 20', $hs_date = Date_Calc::DaysToDate(117, "%Y %m %d"), '117');
+compare(117, Date_Calc::DateToDays(20, 3, -4712), '-4712 03 20');
+compare('-4712 03 21', $hs_date = Date_Calc::DaysToDate(118, "%Y %m %d"), '118');
+compare(118, Date_Calc::DateToDays(21, 3, -4712), '-4712 03 21');
+compare('-4712 03 22', $hs_date = Date_Calc::DaysToDate(119, "%Y %m %d"), '119');
+compare(119, Date_Calc::DateToDays(22, 3, -4712), '-4712 03 22');
+compare('-4712 03 23', $hs_date = Date_Calc::DaysToDate(120, "%Y %m %d"), '120');
+compare(120, Date_Calc::DateToDays(23, 3, -4712), '-4712 03 23');
+compare('-4712 03 24', $hs_date = Date_Calc::DaysToDate(121, "%Y %m %d"), '121');
+compare(121, Date_Calc::DateToDays(24, 3, -4712), '-4712 03 24');
+compare('-4712 03 25', $hs_date = Date_Calc::DaysToDate(122, "%Y %m %d"), '122');
+compare(122, Date_Calc::DateToDays(25, 3, -4712), '-4712 03 25');
+compare('-4712 03 26', $hs_date = Date_Calc::DaysToDate(123, "%Y %m %d"), '123');
+compare(123, Date_Calc::DateToDays(26, 3, -4712), '-4712 03 26');
+compare('-4712 03 27', $hs_date = Date_Calc::DaysToDate(124, "%Y %m %d"), '124');
+compare(124, Date_Calc::DateToDays(27, 3, -4712), '-4712 03 27');
+compare('-4712 03 28', $hs_date = Date_Calc::DaysToDate(125, "%Y %m %d"), '125');
+compare(125, Date_Calc::DateToDays(28, 3, -4712), '-4712 03 28');
+compare('-4712 03 29', $hs_date = Date_Calc::DaysToDate(126, "%Y %m %d"), '126');
+compare(126, Date_Calc::DateToDays(29, 3, -4712), '-4712 03 29');
+compare('-4712 03 30', $hs_date = Date_Calc::DaysToDate(127, "%Y %m %d"), '127');
+compare(127, Date_Calc::DateToDays(30, 3, -4712), '-4712 03 30');
+compare('-4712 03 31', $hs_date = Date_Calc::DaysToDate(128, "%Y %m %d"), '128');
+compare(128, Date_Calc::DateToDays(31, 3, -4712), '-4712 03 31');
+compare('-4712 04 01', $hs_date = Date_Calc::DaysToDate(129, "%Y %m %d"), '129');
+compare(129, Date_Calc::DateToDays(1, 4, -4712), '-4712 04 01');
+compare('-4712 04 02', $hs_date = Date_Calc::DaysToDate(130, "%Y %m %d"), '130');
+compare(130, Date_Calc::DateToDays(2, 4, -4712), '-4712 04 02');
+compare('-4712 04 03', $hs_date = Date_Calc::DaysToDate(131, "%Y %m %d"), '131');
+compare(131, Date_Calc::DateToDays(3, 4, -4712), '-4712 04 03');
+compare('-4712 04 04', $hs_date = Date_Calc::DaysToDate(132, "%Y %m %d"), '132');
+compare(132, Date_Calc::DateToDays(4, 4, -4712), '-4712 04 04');
+compare('-4712 04 05', $hs_date = Date_Calc::DaysToDate(133, "%Y %m %d"), '133');
+compare(133, Date_Calc::DateToDays(5, 4, -4712), '-4712 04 05');
+compare('-4712 04 06', $hs_date = Date_Calc::DaysToDate(134, "%Y %m %d"), '134');
+compare(134, Date_Calc::DateToDays(6, 4, -4712), '-4712 04 06');
+compare('-4712 04 07', $hs_date = Date_Calc::DaysToDate(135, "%Y %m %d"), '135');
+compare(135, Date_Calc::DateToDays(7, 4, -4712), '-4712 04 07');
+compare('-4712 04 08', $hs_date = Date_Calc::DaysToDate(136, "%Y %m %d"), '136');
+compare(136, Date_Calc::DateToDays(8, 4, -4712), '-4712 04 08');
+compare('-4712 04 09', $hs_date = Date_Calc::DaysToDate(137, "%Y %m %d"), '137');
+compare(137, Date_Calc::DateToDays(9, 4, -4712), '-4712 04 09');
+compare('-4712 04 10', $hs_date = Date_Calc::DaysToDate(138, "%Y %m %d"), '138');
+compare(138, Date_Calc::DateToDays(10, 4, -4712), '-4712 04 10');
+compare('-4712 04 11', $hs_date = Date_Calc::DaysToDate(139, "%Y %m %d"), '139');
+compare(139, Date_Calc::DateToDays(11, 4, -4712), '-4712 04 11');
+compare('-4712 04 12', $hs_date = Date_Calc::DaysToDate(140, "%Y %m %d"), '140');
+compare(140, Date_Calc::DateToDays(12, 4, -4712), '-4712 04 12');
+compare('-4712 04 13', $hs_date = Date_Calc::DaysToDate(141, "%Y %m %d"), '141');
+compare(141, Date_Calc::DateToDays(13, 4, -4712), '-4712 04 13');
+compare('-4712 04 14', $hs_date = Date_Calc::DaysToDate(142, "%Y %m %d"), '142');
+compare(142, Date_Calc::DateToDays(14, 4, -4712), '-4712 04 14');
+compare('-4712 04 15', $hs_date = Date_Calc::DaysToDate(143, "%Y %m %d"), '143');
+compare(143, Date_Calc::DateToDays(15, 4, -4712), '-4712 04 15');
+compare('-4712 04 16', $hs_date = Date_Calc::DaysToDate(144, "%Y %m %d"), '144');
+compare(144, Date_Calc::DateToDays(16, 4, -4712), '-4712 04 16');
+compare('-4712 04 17', $hs_date = Date_Calc::DaysToDate(145, "%Y %m %d"), '145');
+compare(145, Date_Calc::DateToDays(17, 4, -4712), '-4712 04 17');
+compare('-4712 04 18', $hs_date = Date_Calc::DaysToDate(146, "%Y %m %d"), '146');
+compare(146, Date_Calc::DateToDays(18, 4, -4712), '-4712 04 18');
+compare('-4712 04 19', $hs_date = Date_Calc::DaysToDate(147, "%Y %m %d"), '147');
+compare(147, Date_Calc::DateToDays(19, 4, -4712), '-4712 04 19');
+compare('-4712 04 20', $hs_date = Date_Calc::DaysToDate(148, "%Y %m %d"), '148');
+compare(148, Date_Calc::DateToDays(20, 4, -4712), '-4712 04 20');
+compare('-4712 04 21', $hs_date = Date_Calc::DaysToDate(149, "%Y %m %d"), '149');
+compare(149, Date_Calc::DateToDays(21, 4, -4712), '-4712 04 21');
+compare('-4712 04 22', $hs_date = Date_Calc::DaysToDate(150, "%Y %m %d"), '150');
+compare(150, Date_Calc::DateToDays(22, 4, -4712), '-4712 04 22');
+compare('-4712 04 23', $hs_date = Date_Calc::DaysToDate(151, "%Y %m %d"), '151');
+compare(151, Date_Calc::DateToDays(23, 4, -4712), '-4712 04 23');
+compare('-4712 04 24', $hs_date = Date_Calc::DaysToDate(152, "%Y %m %d"), '152');
+compare(152, Date_Calc::DateToDays(24, 4, -4712), '-4712 04 24');
+compare('-4712 04 25', $hs_date = Date_Calc::DaysToDate(153, "%Y %m %d"), '153');
+compare(153, Date_Calc::DateToDays(25, 4, -4712), '-4712 04 25');
+compare('-4712 04 26', $hs_date = Date_Calc::DaysToDate(154, "%Y %m %d"), '154');
+compare(154, Date_Calc::DateToDays(26, 4, -4712), '-4712 04 26');
+compare('-4712 04 27', $hs_date = Date_Calc::DaysToDate(155, "%Y %m %d"), '155');
+compare(155, Date_Calc::DateToDays(27, 4, -4712), '-4712 04 27');
+compare('-4712 04 28', $hs_date = Date_Calc::DaysToDate(156, "%Y %m %d"), '156');
+compare(156, Date_Calc::DateToDays(28, 4, -4712), '-4712 04 28');
+compare('-4712 04 29', $hs_date = Date_Calc::DaysToDate(157, "%Y %m %d"), '157');
+compare(157, Date_Calc::DateToDays(29, 4, -4712), '-4712 04 29');
+compare('-4712 04 30', $hs_date = Date_Calc::DaysToDate(158, "%Y %m %d"), '158');
+compare(158, Date_Calc::DateToDays(30, 4, -4712), '-4712 04 30');
+compare('-4712 05 01', $hs_date = Date_Calc::DaysToDate(159, "%Y %m %d"), '159');
+compare(159, Date_Calc::DateToDays(1, 5, -4712), '-4712 05 01');
+compare('-4712 05 02', $hs_date = Date_Calc::DaysToDate(160, "%Y %m %d"), '160');
+compare(160, Date_Calc::DateToDays(2, 5, -4712), '-4712 05 02');
+compare('-4712 05 03', $hs_date = Date_Calc::DaysToDate(161, "%Y %m %d"), '161');
+compare(161, Date_Calc::DateToDays(3, 5, -4712), '-4712 05 03');
+compare('-4712 05 04', $hs_date = Date_Calc::DaysToDate(162, "%Y %m %d"), '162');
+compare(162, Date_Calc::DateToDays(4, 5, -4712), '-4712 05 04');
+compare('-4712 05 05', $hs_date = Date_Calc::DaysToDate(163, "%Y %m %d"), '163');
+compare(163, Date_Calc::DateToDays(5, 5, -4712), '-4712 05 05');
+compare('-4712 05 06', $hs_date = Date_Calc::DaysToDate(164, "%Y %m %d"), '164');
+compare(164, Date_Calc::DateToDays(6, 5, -4712), '-4712 05 06');
+compare('-4712 05 07', $hs_date = Date_Calc::DaysToDate(165, "%Y %m %d"), '165');
+compare(165, Date_Calc::DateToDays(7, 5, -4712), '-4712 05 07');
+compare('-4712 05 08', $hs_date = Date_Calc::DaysToDate(166, "%Y %m %d"), '166');
+compare(166, Date_Calc::DateToDays(8, 5, -4712), '-4712 05 08');
+compare('-4712 05 09', $hs_date = Date_Calc::DaysToDate(167, "%Y %m %d"), '167');
+compare(167, Date_Calc::DateToDays(9, 5, -4712), '-4712 05 09');
+compare('-4712 05 10', $hs_date = Date_Calc::DaysToDate(168, "%Y %m %d"), '168');
+compare(168, Date_Calc::DateToDays(10, 5, -4712), '-4712 05 10');
+compare('-4712 05 11', $hs_date = Date_Calc::DaysToDate(169, "%Y %m %d"), '169');
+compare(169, Date_Calc::DateToDays(11, 5, -4712), '-4712 05 11');
+compare('-4712 05 12', $hs_date = Date_Calc::DaysToDate(170, "%Y %m %d"), '170');
+compare(170, Date_Calc::DateToDays(12, 5, -4712), '-4712 05 12');
+compare('-4712 05 13', $hs_date = Date_Calc::DaysToDate(171, "%Y %m %d"), '171');
+compare(171, Date_Calc::DateToDays(13, 5, -4712), '-4712 05 13');
+compare('-4712 05 14', $hs_date = Date_Calc::DaysToDate(172, "%Y %m %d"), '172');
+compare(172, Date_Calc::DateToDays(14, 5, -4712), '-4712 05 14');
+compare('-4712 05 15', $hs_date = Date_Calc::DaysToDate(173, "%Y %m %d"), '173');
+compare(173, Date_Calc::DateToDays(15, 5, -4712), '-4712 05 15');
+compare('-4712 05 16', $hs_date = Date_Calc::DaysToDate(174, "%Y %m %d"), '174');
+compare(174, Date_Calc::DateToDays(16, 5, -4712), '-4712 05 16');
+compare('-4712 05 17', $hs_date = Date_Calc::DaysToDate(175, "%Y %m %d"), '175');
+compare(175, Date_Calc::DateToDays(17, 5, -4712), '-4712 05 17');
+compare('-4712 05 18', $hs_date = Date_Calc::DaysToDate(176, "%Y %m %d"), '176');
+compare(176, Date_Calc::DateToDays(18, 5, -4712), '-4712 05 18');
+compare('-4712 05 19', $hs_date = Date_Calc::DaysToDate(177, "%Y %m %d"), '177');
+compare(177, Date_Calc::DateToDays(19, 5, -4712), '-4712 05 19');
+compare('-4712 05 20', $hs_date = Date_Calc::DaysToDate(178, "%Y %m %d"), '178');
+compare(178, Date_Calc::DateToDays(20, 5, -4712), '-4712 05 20');
+compare('-4712 05 21', $hs_date = Date_Calc::DaysToDate(179, "%Y %m %d"), '179');
+compare(179, Date_Calc::DateToDays(21, 5, -4712), '-4712 05 21');
+compare('-4712 05 22', $hs_date = Date_Calc::DaysToDate(180, "%Y %m %d"), '180');
+compare(180, Date_Calc::DateToDays(22, 5, -4712), '-4712 05 22');
+compare('-4712 05 23', $hs_date = Date_Calc::DaysToDate(181, "%Y %m %d"), '181');
+compare(181, Date_Calc::DateToDays(23, 5, -4712), '-4712 05 23');
+compare('-4712 05 24', $hs_date = Date_Calc::DaysToDate(182, "%Y %m %d"), '182');
+compare(182, Date_Calc::DateToDays(24, 5, -4712), '-4712 05 24');
+compare('-4712 05 25', $hs_date = Date_Calc::DaysToDate(183, "%Y %m %d"), '183');
+compare(183, Date_Calc::DateToDays(25, 5, -4712), '-4712 05 25');
+compare('-4712 05 26', $hs_date = Date_Calc::DaysToDate(184, "%Y %m %d"), '184');
+compare(184, Date_Calc::DateToDays(26, 5, -4712), '-4712 05 26');
+compare('-4712 05 27', $hs_date = Date_Calc::DaysToDate(185, "%Y %m %d"), '185');
+compare(185, Date_Calc::DateToDays(27, 5, -4712), '-4712 05 27');
+compare('-4712 05 28', $hs_date = Date_Calc::DaysToDate(186, "%Y %m %d"), '186');
+compare(186, Date_Calc::DateToDays(28, 5, -4712), '-4712 05 28');
+compare('-4712 05 29', $hs_date = Date_Calc::DaysToDate(187, "%Y %m %d"), '187');
+compare(187, Date_Calc::DateToDays(29, 5, -4712), '-4712 05 29');
+compare('-4712 05 30', $hs_date = Date_Calc::DaysToDate(188, "%Y %m %d"), '188');
+compare(188, Date_Calc::DateToDays(30, 5, -4712), '-4712 05 30');
+compare('-4712 05 31', $hs_date = Date_Calc::DaysToDate(189, "%Y %m %d"), '189');
+compare(189, Date_Calc::DateToDays(31, 5, -4712), '-4712 05 31');
+compare('-4712 06 01', $hs_date = Date_Calc::DaysToDate(190, "%Y %m %d"), '190');
+compare(190, Date_Calc::DateToDays(1, 6, -4712), '-4712 06 01');
+compare('-4712 06 02', $hs_date = Date_Calc::DaysToDate(191, "%Y %m %d"), '191');
+compare(191, Date_Calc::DateToDays(2, 6, -4712), '-4712 06 02');
+compare('-4712 06 03', $hs_date = Date_Calc::DaysToDate(192, "%Y %m %d"), '192');
+compare(192, Date_Calc::DateToDays(3, 6, -4712), '-4712 06 03');
+compare('-4712 06 04', $hs_date = Date_Calc::DaysToDate(193, "%Y %m %d"), '193');
+compare(193, Date_Calc::DateToDays(4, 6, -4712), '-4712 06 04');
+compare('-4712 06 05', $hs_date = Date_Calc::DaysToDate(194, "%Y %m %d"), '194');
+compare(194, Date_Calc::DateToDays(5, 6, -4712), '-4712 06 05');
+compare('-4712 06 06', $hs_date = Date_Calc::DaysToDate(195, "%Y %m %d"), '195');
+compare(195, Date_Calc::DateToDays(6, 6, -4712), '-4712 06 06');
+compare('-4712 06 07', $hs_date = Date_Calc::DaysToDate(196, "%Y %m %d"), '196');
+compare(196, Date_Calc::DateToDays(7, 6, -4712), '-4712 06 07');
+compare('-4712 06 08', $hs_date = Date_Calc::DaysToDate(197, "%Y %m %d"), '197');
+compare(197, Date_Calc::DateToDays(8, 6, -4712), '-4712 06 08');
+compare('-4712 06 09', $hs_date = Date_Calc::DaysToDate(198, "%Y %m %d"), '198');
+compare(198, Date_Calc::DateToDays(9, 6, -4712), '-4712 06 09');
+compare('-4712 06 10', $hs_date = Date_Calc::DaysToDate(199, "%Y %m %d"), '199');
+compare(199, Date_Calc::DateToDays(10, 6, -4712), '-4712 06 10');
+compare('-4712 06 11', $hs_date = Date_Calc::DaysToDate(200, "%Y %m %d"), '200');
+compare(200, Date_Calc::DateToDays(11, 6, -4712), '-4712 06 11');
+compare('-4712 06 12', $hs_date = Date_Calc::DaysToDate(201, "%Y %m %d"), '201');
+compare(201, Date_Calc::DateToDays(12, 6, -4712), '-4712 06 12');
+compare('-4712 06 13', $hs_date = Date_Calc::DaysToDate(202, "%Y %m %d"), '202');
+compare(202, Date_Calc::DateToDays(13, 6, -4712), '-4712 06 13');
+compare('-4712 06 14', $hs_date = Date_Calc::DaysToDate(203, "%Y %m %d"), '203');
+compare(203, Date_Calc::DateToDays(14, 6, -4712), '-4712 06 14');
+compare('-4712 06 15', $hs_date = Date_Calc::DaysToDate(204, "%Y %m %d"), '204');
+compare(204, Date_Calc::DateToDays(15, 6, -4712), '-4712 06 15');
+compare('-4712 06 16', $hs_date = Date_Calc::DaysToDate(205, "%Y %m %d"), '205');
+compare(205, Date_Calc::DateToDays(16, 6, -4712), '-4712 06 16');
+compare('-4712 06 17', $hs_date = Date_Calc::DaysToDate(206, "%Y %m %d"), '206');
+compare(206, Date_Calc::DateToDays(17, 6, -4712), '-4712 06 17');
+compare('-4712 06 18', $hs_date = Date_Calc::DaysToDate(207, "%Y %m %d"), '207');
+compare(207, Date_Calc::DateToDays(18, 6, -4712), '-4712 06 18');
+compare('-4712 06 19', $hs_date = Date_Calc::DaysToDate(208, "%Y %m %d"), '208');
+compare(208, Date_Calc::DateToDays(19, 6, -4712), '-4712 06 19');
+compare('-4712 06 20', $hs_date = Date_Calc::DaysToDate(209, "%Y %m %d"), '209');
+compare(209, Date_Calc::DateToDays(20, 6, -4712), '-4712 06 20');
+compare('-4712 06 21', $hs_date = Date_Calc::DaysToDate(210, "%Y %m %d"), '210');
+compare(210, Date_Calc::DateToDays(21, 6, -4712), '-4712 06 21');
+compare('-4712 06 22', $hs_date = Date_Calc::DaysToDate(211, "%Y %m %d"), '211');
+compare(211, Date_Calc::DateToDays(22, 6, -4712), '-4712 06 22');
+compare('-4712 06 23', $hs_date = Date_Calc::DaysToDate(212, "%Y %m %d"), '212');
+compare(212, Date_Calc::DateToDays(23, 6, -4712), '-4712 06 23');
+compare('-4712 06 24', $hs_date = Date_Calc::DaysToDate(213, "%Y %m %d"), '213');
+compare(213, Date_Calc::DateToDays(24, 6, -4712), '-4712 06 24');
+compare('-4712 06 25', $hs_date = Date_Calc::DaysToDate(214, "%Y %m %d"), '214');
+compare(214, Date_Calc::DateToDays(25, 6, -4712), '-4712 06 25');
+compare('-4712 06 26', $hs_date = Date_Calc::DaysToDate(215, "%Y %m %d"), '215');
+compare(215, Date_Calc::DateToDays(26, 6, -4712), '-4712 06 26');
+compare('-4712 06 27', $hs_date = Date_Calc::DaysToDate(216, "%Y %m %d"), '216');
+compare(216, Date_Calc::DateToDays(27, 6, -4712), '-4712 06 27');
+compare('-4712 06 28', $hs_date = Date_Calc::DaysToDate(217, "%Y %m %d"), '217');
+compare(217, Date_Calc::DateToDays(28, 6, -4712), '-4712 06 28');
+compare('-4712 06 29', $hs_date = Date_Calc::DaysToDate(218, "%Y %m %d"), '218');
+compare(218, Date_Calc::DateToDays(29, 6, -4712), '-4712 06 29');
+compare('-4712 06 30', $hs_date = Date_Calc::DaysToDate(219, "%Y %m %d"), '219');
+compare(219, Date_Calc::DateToDays(30, 6, -4712), '-4712 06 30');
+compare('-4712 07 01', $hs_date = Date_Calc::DaysToDate(220, "%Y %m %d"), '220');
+compare(220, Date_Calc::DateToDays(1, 7, -4712), '-4712 07 01');
+compare('-4712 07 02', $hs_date = Date_Calc::DaysToDate(221, "%Y %m %d"), '221');
+compare(221, Date_Calc::DateToDays(2, 7, -4712), '-4712 07 02');
+compare('-4712 07 03', $hs_date = Date_Calc::DaysToDate(222, "%Y %m %d"), '222');
+compare(222, Date_Calc::DateToDays(3, 7, -4712), '-4712 07 03');
+compare('-4712 07 04', $hs_date = Date_Calc::DaysToDate(223, "%Y %m %d"), '223');
+compare(223, Date_Calc::DateToDays(4, 7, -4712), '-4712 07 04');
+compare('-4712 07 05', $hs_date = Date_Calc::DaysToDate(224, "%Y %m %d"), '224');
+compare(224, Date_Calc::DateToDays(5, 7, -4712), '-4712 07 05');
+compare('-4712 07 06', $hs_date = Date_Calc::DaysToDate(225, "%Y %m %d"), '225');
+compare(225, Date_Calc::DateToDays(6, 7, -4712), '-4712 07 06');
+compare('-4712 07 07', $hs_date = Date_Calc::DaysToDate(226, "%Y %m %d"), '226');
+compare(226, Date_Calc::DateToDays(7, 7, -4712), '-4712 07 07');
+compare('-4712 07 08', $hs_date = Date_Calc::DaysToDate(227, "%Y %m %d"), '227');
+compare(227, Date_Calc::DateToDays(8, 7, -4712), '-4712 07 08');
+compare('-4712 07 09', $hs_date = Date_Calc::DaysToDate(228, "%Y %m %d"), '228');
+compare(228, Date_Calc::DateToDays(9, 7, -4712), '-4712 07 09');
+compare('-4712 07 10', $hs_date = Date_Calc::DaysToDate(229, "%Y %m %d"), '229');
+compare(229, Date_Calc::DateToDays(10, 7, -4712), '-4712 07 10');
+compare('-4712 07 11', $hs_date = Date_Calc::DaysToDate(230, "%Y %m %d"), '230');
+compare(230, Date_Calc::DateToDays(11, 7, -4712), '-4712 07 11');
+compare('-4712 07 12', $hs_date = Date_Calc::DaysToDate(231, "%Y %m %d"), '231');
+compare(231, Date_Calc::DateToDays(12, 7, -4712), '-4712 07 12');
+compare('-4712 07 13', $hs_date = Date_Calc::DaysToDate(232, "%Y %m %d"), '232');
+compare(232, Date_Calc::DateToDays(13, 7, -4712), '-4712 07 13');
+compare('-4712 07 14', $hs_date = Date_Calc::DaysToDate(233, "%Y %m %d"), '233');
+compare(233, Date_Calc::DateToDays(14, 7, -4712), '-4712 07 14');
+compare('-4712 07 15', $hs_date = Date_Calc::DaysToDate(234, "%Y %m %d"), '234');
+compare(234, Date_Calc::DateToDays(15, 7, -4712), '-4712 07 15');
+compare('-4712 07 16', $hs_date = Date_Calc::DaysToDate(235, "%Y %m %d"), '235');
+compare(235, Date_Calc::DateToDays(16, 7, -4712), '-4712 07 16');
+compare('-4712 07 17', $hs_date = Date_Calc::DaysToDate(236, "%Y %m %d"), '236');
+compare(236, Date_Calc::DateToDays(17, 7, -4712), '-4712 07 17');
+compare('-4712 07 18', $hs_date = Date_Calc::DaysToDate(237, "%Y %m %d"), '237');
+compare(237, Date_Calc::DateToDays(18, 7, -4712), '-4712 07 18');
+compare('-4712 07 19', $hs_date = Date_Calc::DaysToDate(238, "%Y %m %d"), '238');
+compare(238, Date_Calc::DateToDays(19, 7, -4712), '-4712 07 19');
+compare('-4712 07 20', $hs_date = Date_Calc::DaysToDate(239, "%Y %m %d"), '239');
+compare(239, Date_Calc::DateToDays(20, 7, -4712), '-4712 07 20');
+compare('-4712 07 21', $hs_date = Date_Calc::DaysToDate(240, "%Y %m %d"), '240');
+compare(240, Date_Calc::DateToDays(21, 7, -4712), '-4712 07 21');
+compare('-4712 07 22', $hs_date = Date_Calc::DaysToDate(241, "%Y %m %d"), '241');
+compare(241, Date_Calc::DateToDays(22, 7, -4712), '-4712 07 22');
+compare('-4712 07 23', $hs_date = Date_Calc::DaysToDate(242, "%Y %m %d"), '242');
+compare(242, Date_Calc::DateToDays(23, 7, -4712), '-4712 07 23');
+compare('-4712 07 24', $hs_date = Date_Calc::DaysToDate(243, "%Y %m %d"), '243');
+compare(243, Date_Calc::DateToDays(24, 7, -4712), '-4712 07 24');
+compare('-4712 07 25', $hs_date = Date_Calc::DaysToDate(244, "%Y %m %d"), '244');
+compare(244, Date_Calc::DateToDays(25, 7, -4712), '-4712 07 25');
+compare('-4712 07 26', $hs_date = Date_Calc::DaysToDate(245, "%Y %m %d"), '245');
+compare(245, Date_Calc::DateToDays(26, 7, -4712), '-4712 07 26');
+compare('-4712 07 27', $hs_date = Date_Calc::DaysToDate(246, "%Y %m %d"), '246');
+compare(246, Date_Calc::DateToDays(27, 7, -4712), '-4712 07 27');
+compare('-4712 07 28', $hs_date = Date_Calc::DaysToDate(247, "%Y %m %d"), '247');
+compare(247, Date_Calc::DateToDays(28, 7, -4712), '-4712 07 28');
+compare('-4712 07 29', $hs_date = Date_Calc::DaysToDate(248, "%Y %m %d"), '248');
+compare(248, Date_Calc::DateToDays(29, 7, -4712), '-4712 07 29');
+compare('-4712 07 30', $hs_date = Date_Calc::DaysToDate(249, "%Y %m %d"), '249');
+compare(249, Date_Calc::DateToDays(30, 7, -4712), '-4712 07 30');
+compare('-4712 07 31', $hs_date = Date_Calc::DaysToDate(250, "%Y %m %d"), '250');
+compare(250, Date_Calc::DateToDays(31, 7, -4712), '-4712 07 31');
+compare('-4712 08 01', $hs_date = Date_Calc::DaysToDate(251, "%Y %m %d"), '251');
+compare(251, Date_Calc::DateToDays(1, 8, -4712), '-4712 08 01');
+compare('-4712 08 02', $hs_date = Date_Calc::DaysToDate(252, "%Y %m %d"), '252');
+compare(252, Date_Calc::DateToDays(2, 8, -4712), '-4712 08 02');
+compare('-4712 08 03', $hs_date = Date_Calc::DaysToDate(253, "%Y %m %d"), '253');
+compare(253, Date_Calc::DateToDays(3, 8, -4712), '-4712 08 03');
+compare('-4712 08 04', $hs_date = Date_Calc::DaysToDate(254, "%Y %m %d"), '254');
+compare(254, Date_Calc::DateToDays(4, 8, -4712), '-4712 08 04');
+compare('-4712 08 05', $hs_date = Date_Calc::DaysToDate(255, "%Y %m %d"), '255');
+compare(255, Date_Calc::DateToDays(5, 8, -4712), '-4712 08 05');
+compare('-4712 08 06', $hs_date = Date_Calc::DaysToDate(256, "%Y %m %d"), '256');
+compare(256, Date_Calc::DateToDays(6, 8, -4712), '-4712 08 06');
+compare('-4712 08 07', $hs_date = Date_Calc::DaysToDate(257, "%Y %m %d"), '257');
+compare(257, Date_Calc::DateToDays(7, 8, -4712), '-4712 08 07');
+compare('-4712 08 08', $hs_date = Date_Calc::DaysToDate(258, "%Y %m %d"), '258');
+compare(258, Date_Calc::DateToDays(8, 8, -4712), '-4712 08 08');
+compare('-4712 08 09', $hs_date = Date_Calc::DaysToDate(259, "%Y %m %d"), '259');
+compare(259, Date_Calc::DateToDays(9, 8, -4712), '-4712 08 09');
+compare('-4712 08 10', $hs_date = Date_Calc::DaysToDate(260, "%Y %m %d"), '260');
+compare(260, Date_Calc::DateToDays(10, 8, -4712), '-4712 08 10');
+compare('-4712 08 11', $hs_date = Date_Calc::DaysToDate(261, "%Y %m %d"), '261');
+compare(261, Date_Calc::DateToDays(11, 8, -4712), '-4712 08 11');
+compare('-4712 08 12', $hs_date = Date_Calc::DaysToDate(262, "%Y %m %d"), '262');
+compare(262, Date_Calc::DateToDays(12, 8, -4712), '-4712 08 12');
+compare('-4712 08 13', $hs_date = Date_Calc::DaysToDate(263, "%Y %m %d"), '263');
+compare(263, Date_Calc::DateToDays(13, 8, -4712), '-4712 08 13');
+compare('-4712 08 14', $hs_date = Date_Calc::DaysToDate(264, "%Y %m %d"), '264');
+compare(264, Date_Calc::DateToDays(14, 8, -4712), '-4712 08 14');
+compare('-4712 08 15', $hs_date = Date_Calc::DaysToDate(265, "%Y %m %d"), '265');
+compare(265, Date_Calc::DateToDays(15, 8, -4712), '-4712 08 15');
+compare('-4712 08 16', $hs_date = Date_Calc::DaysToDate(266, "%Y %m %d"), '266');
+compare(266, Date_Calc::DateToDays(16, 8, -4712), '-4712 08 16');
+compare('-4712 08 17', $hs_date = Date_Calc::DaysToDate(267, "%Y %m %d"), '267');
+compare(267, Date_Calc::DateToDays(17, 8, -4712), '-4712 08 17');
+compare('-4712 08 18', $hs_date = Date_Calc::DaysToDate(268, "%Y %m %d"), '268');
+compare(268, Date_Calc::DateToDays(18, 8, -4712), '-4712 08 18');
+compare('-4712 08 19', $hs_date = Date_Calc::DaysToDate(269, "%Y %m %d"), '269');
+compare(269, Date_Calc::DateToDays(19, 8, -4712), '-4712 08 19');
+compare('-4712 08 20', $hs_date = Date_Calc::DaysToDate(270, "%Y %m %d"), '270');
+compare(270, Date_Calc::DateToDays(20, 8, -4712), '-4712 08 20');
+compare('-4712 08 21', $hs_date = Date_Calc::DaysToDate(271, "%Y %m %d"), '271');
+compare(271, Date_Calc::DateToDays(21, 8, -4712), '-4712 08 21');
+compare('-4712 08 22', $hs_date = Date_Calc::DaysToDate(272, "%Y %m %d"), '272');
+compare(272, Date_Calc::DateToDays(22, 8, -4712), '-4712 08 22');
+compare('-4712 08 23', $hs_date = Date_Calc::DaysToDate(273, "%Y %m %d"), '273');
+compare(273, Date_Calc::DateToDays(23, 8, -4712), '-4712 08 23');
+compare('-4712 08 24', $hs_date = Date_Calc::DaysToDate(274, "%Y %m %d"), '274');
+compare(274, Date_Calc::DateToDays(24, 8, -4712), '-4712 08 24');
+compare('-4712 08 25', $hs_date = Date_Calc::DaysToDate(275, "%Y %m %d"), '275');
+compare(275, Date_Calc::DateToDays(25, 8, -4712), '-4712 08 25');
+compare('-4712 08 26', $hs_date = Date_Calc::DaysToDate(276, "%Y %m %d"), '276');
+compare(276, Date_Calc::DateToDays(26, 8, -4712), '-4712 08 26');
+compare('-4712 08 27', $hs_date = Date_Calc::DaysToDate(277, "%Y %m %d"), '277');
+compare(277, Date_Calc::DateToDays(27, 8, -4712), '-4712 08 27');
+compare('-4712 08 28', $hs_date = Date_Calc::DaysToDate(278, "%Y %m %d"), '278');
+compare(278, Date_Calc::DateToDays(28, 8, -4712), '-4712 08 28');
+compare('-4712 08 29', $hs_date = Date_Calc::DaysToDate(279, "%Y %m %d"), '279');
+compare(279, Date_Calc::DateToDays(29, 8, -4712), '-4712 08 29');
+compare('-4712 08 30', $hs_date = Date_Calc::DaysToDate(280, "%Y %m %d"), '280');
+compare(280, Date_Calc::DateToDays(30, 8, -4712), '-4712 08 30');
+compare('-4712 08 31', $hs_date = Date_Calc::DaysToDate(281, "%Y %m %d"), '281');
+compare(281, Date_Calc::DateToDays(31, 8, -4712), '-4712 08 31');
+compare('-4712 09 01', $hs_date = Date_Calc::DaysToDate(282, "%Y %m %d"), '282');
+compare(282, Date_Calc::DateToDays(1, 9, -4712), '-4712 09 01');
+compare('-4712 09 02', $hs_date = Date_Calc::DaysToDate(283, "%Y %m %d"), '283');
+compare(283, Date_Calc::DateToDays(2, 9, -4712), '-4712 09 02');
+compare('-4712 09 03', $hs_date = Date_Calc::DaysToDate(284, "%Y %m %d"), '284');
+compare(284, Date_Calc::DateToDays(3, 9, -4712), '-4712 09 03');
+compare('-4712 09 04', $hs_date = Date_Calc::DaysToDate(285, "%Y %m %d"), '285');
+compare(285, Date_Calc::DateToDays(4, 9, -4712), '-4712 09 04');
+compare('-4712 09 05', $hs_date = Date_Calc::DaysToDate(286, "%Y %m %d"), '286');
+compare(286, Date_Calc::DateToDays(5, 9, -4712), '-4712 09 05');
+compare('-4712 09 06', $hs_date = Date_Calc::DaysToDate(287, "%Y %m %d"), '287');
+compare(287, Date_Calc::DateToDays(6, 9, -4712), '-4712 09 06');
+compare('-4712 09 07', $hs_date = Date_Calc::DaysToDate(288, "%Y %m %d"), '288');
+compare(288, Date_Calc::DateToDays(7, 9, -4712), '-4712 09 07');
+compare('-4712 09 08', $hs_date = Date_Calc::DaysToDate(289, "%Y %m %d"), '289');
+compare(289, Date_Calc::DateToDays(8, 9, -4712), '-4712 09 08');
+compare('-4712 09 09', $hs_date = Date_Calc::DaysToDate(290, "%Y %m %d"), '290');
+compare(290, Date_Calc::DateToDays(9, 9, -4712), '-4712 09 09');
+compare('-4712 09 10', $hs_date = Date_Calc::DaysToDate(291, "%Y %m %d"), '291');
+compare(291, Date_Calc::DateToDays(10, 9, -4712), '-4712 09 10');
+compare('-4712 09 11', $hs_date = Date_Calc::DaysToDate(292, "%Y %m %d"), '292');
+compare(292, Date_Calc::DateToDays(11, 9, -4712), '-4712 09 11');
+compare('-4712 09 12', $hs_date = Date_Calc::DaysToDate(293, "%Y %m %d"), '293');
+compare(293, Date_Calc::DateToDays(12, 9, -4712), '-4712 09 12');
+compare('-4712 09 13', $hs_date = Date_Calc::DaysToDate(294, "%Y %m %d"), '294');
+compare(294, Date_Calc::DateToDays(13, 9, -4712), '-4712 09 13');
+compare('-4712 09 14', $hs_date = Date_Calc::DaysToDate(295, "%Y %m %d"), '295');
+compare(295, Date_Calc::DateToDays(14, 9, -4712), '-4712 09 14');
+compare('-4712 09 15', $hs_date = Date_Calc::DaysToDate(296, "%Y %m %d"), '296');
+compare(296, Date_Calc::DateToDays(15, 9, -4712), '-4712 09 15');
+compare('-4712 09 16', $hs_date = Date_Calc::DaysToDate(297, "%Y %m %d"), '297');
+compare(297, Date_Calc::DateToDays(16, 9, -4712), '-4712 09 16');
+compare('-4712 09 17', $hs_date = Date_Calc::DaysToDate(298, "%Y %m %d"), '298');
+compare(298, Date_Calc::DateToDays(17, 9, -4712), '-4712 09 17');
+compare('-4712 09 18', $hs_date = Date_Calc::DaysToDate(299, "%Y %m %d"), '299');
+compare(299, Date_Calc::DateToDays(18, 9, -4712), '-4712 09 18');
+compare('-4712 09 19', $hs_date = Date_Calc::DaysToDate(300, "%Y %m %d"), '300');
+compare(300, Date_Calc::DateToDays(19, 9, -4712), '-4712 09 19');
+compare('-4712 09 20', $hs_date = Date_Calc::DaysToDate(301, "%Y %m %d"), '301');
+compare(301, Date_Calc::DateToDays(20, 9, -4712), '-4712 09 20');
+compare('-4712 09 21', $hs_date = Date_Calc::DaysToDate(302, "%Y %m %d"), '302');
+compare(302, Date_Calc::DateToDays(21, 9, -4712), '-4712 09 21');
+compare('-4712 09 22', $hs_date = Date_Calc::DaysToDate(303, "%Y %m %d"), '303');
+compare(303, Date_Calc::DateToDays(22, 9, -4712), '-4712 09 22');
+compare('-4712 09 23', $hs_date = Date_Calc::DaysToDate(304, "%Y %m %d"), '304');
+compare(304, Date_Calc::DateToDays(23, 9, -4712), '-4712 09 23');
+compare('-4712 09 24', $hs_date = Date_Calc::DaysToDate(305, "%Y %m %d"), '305');
+compare(305, Date_Calc::DateToDays(24, 9, -4712), '-4712 09 24');
+compare('-4712 09 25', $hs_date = Date_Calc::DaysToDate(306, "%Y %m %d"), '306');
+compare(306, Date_Calc::DateToDays(25, 9, -4712), '-4712 09 25');
+compare('-4712 09 26', $hs_date = Date_Calc::DaysToDate(307, "%Y %m %d"), '307');
+compare(307, Date_Calc::DateToDays(26, 9, -4712), '-4712 09 26');
+compare('-4712 09 27', $hs_date = Date_Calc::DaysToDate(308, "%Y %m %d"), '308');
+compare(308, Date_Calc::DateToDays(27, 9, -4712), '-4712 09 27');
+compare('-4712 09 28', $hs_date = Date_Calc::DaysToDate(309, "%Y %m %d"), '309');
+compare(309, Date_Calc::DateToDays(28, 9, -4712), '-4712 09 28');
+compare('-4712 09 29', $hs_date = Date_Calc::DaysToDate(310, "%Y %m %d"), '310');
+compare(310, Date_Calc::DateToDays(29, 9, -4712), '-4712 09 29');
+compare('-4712 09 30', $hs_date = Date_Calc::DaysToDate(311, "%Y %m %d"), '311');
+compare(311, Date_Calc::DateToDays(30, 9, -4712), '-4712 09 30');
+compare('-4712 10 01', $hs_date = Date_Calc::DaysToDate(312, "%Y %m %d"), '312');
+compare(312, Date_Calc::DateToDays(1, 10, -4712), '-4712 10 01');
+compare('-4712 10 02', $hs_date = Date_Calc::DaysToDate(313, "%Y %m %d"), '313');
+compare(313, Date_Calc::DateToDays(2, 10, -4712), '-4712 10 02');
+compare('-4712 10 03', $hs_date = Date_Calc::DaysToDate(314, "%Y %m %d"), '314');
+compare(314, Date_Calc::DateToDays(3, 10, -4712), '-4712 10 03');
+compare('-4712 10 04', $hs_date = Date_Calc::DaysToDate(315, "%Y %m %d"), '315');
+compare(315, Date_Calc::DateToDays(4, 10, -4712), '-4712 10 04');
+compare('-4712 10 05', $hs_date = Date_Calc::DaysToDate(316, "%Y %m %d"), '316');
+compare(316, Date_Calc::DateToDays(5, 10, -4712), '-4712 10 05');
+compare('-4712 10 06', $hs_date = Date_Calc::DaysToDate(317, "%Y %m %d"), '317');
+compare(317, Date_Calc::DateToDays(6, 10, -4712), '-4712 10 06');
+compare('-4712 10 07', $hs_date = Date_Calc::DaysToDate(318, "%Y %m %d"), '318');
+compare(318, Date_Calc::DateToDays(7, 10, -4712), '-4712 10 07');
+compare('-4712 10 08', $hs_date = Date_Calc::DaysToDate(319, "%Y %m %d"), '319');
+compare(319, Date_Calc::DateToDays(8, 10, -4712), '-4712 10 08');
+compare('-4712 10 09', $hs_date = Date_Calc::DaysToDate(320, "%Y %m %d"), '320');
+compare(320, Date_Calc::DateToDays(9, 10, -4712), '-4712 10 09');
+compare('-4712 10 10', $hs_date = Date_Calc::DaysToDate(321, "%Y %m %d"), '321');
+compare(321, Date_Calc::DateToDays(10, 10, -4712), '-4712 10 10');
+compare('-4712 10 11', $hs_date = Date_Calc::DaysToDate(322, "%Y %m %d"), '322');
+compare(322, Date_Calc::DateToDays(11, 10, -4712), '-4712 10 11');
+compare('-4712 10 12', $hs_date = Date_Calc::DaysToDate(323, "%Y %m %d"), '323');
+compare(323, Date_Calc::DateToDays(12, 10, -4712), '-4712 10 12');
+compare('-4712 10 13', $hs_date = Date_Calc::DaysToDate(324, "%Y %m %d"), '324');
+compare(324, Date_Calc::DateToDays(13, 10, -4712), '-4712 10 13');
+compare('-4712 10 14', $hs_date = Date_Calc::DaysToDate(325, "%Y %m %d"), '325');
+compare(325, Date_Calc::DateToDays(14, 10, -4712), '-4712 10 14');
+compare('-4712 10 15', $hs_date = Date_Calc::DaysToDate(326, "%Y %m %d"), '326');
+compare(326, Date_Calc::DateToDays(15, 10, -4712), '-4712 10 15');
+compare('-4712 10 16', $hs_date = Date_Calc::DaysToDate(327, "%Y %m %d"), '327');
+compare(327, Date_Calc::DateToDays(16, 10, -4712), '-4712 10 16');
+compare('-4712 10 17', $hs_date = Date_Calc::DaysToDate(328, "%Y %m %d"), '328');
+compare(328, Date_Calc::DateToDays(17, 10, -4712), '-4712 10 17');
+compare('-4712 10 18', $hs_date = Date_Calc::DaysToDate(329, "%Y %m %d"), '329');
+compare(329, Date_Calc::DateToDays(18, 10, -4712), '-4712 10 18');
+compare('-4712 10 19', $hs_date = Date_Calc::DaysToDate(330, "%Y %m %d"), '330');
+compare(330, Date_Calc::DateToDays(19, 10, -4712), '-4712 10 19');
+compare('-4712 10 20', $hs_date = Date_Calc::DaysToDate(331, "%Y %m %d"), '331');
+compare(331, Date_Calc::DateToDays(20, 10, -4712), '-4712 10 20');
+compare('-4712 10 21', $hs_date = Date_Calc::DaysToDate(332, "%Y %m %d"), '332');
+compare(332, Date_Calc::DateToDays(21, 10, -4712), '-4712 10 21');
+compare('-4712 10 22', $hs_date = Date_Calc::DaysToDate(333, "%Y %m %d"), '333');
+compare(333, Date_Calc::DateToDays(22, 10, -4712), '-4712 10 22');
+compare('-4712 10 23', $hs_date = Date_Calc::DaysToDate(334, "%Y %m %d"), '334');
+compare(334, Date_Calc::DateToDays(23, 10, -4712), '-4712 10 23');
+compare('-4712 10 24', $hs_date = Date_Calc::DaysToDate(335, "%Y %m %d"), '335');
+compare(335, Date_Calc::DateToDays(24, 10, -4712), '-4712 10 24');
+compare('-4712 10 25', $hs_date = Date_Calc::DaysToDate(336, "%Y %m %d"), '336');
+compare(336, Date_Calc::DateToDays(25, 10, -4712), '-4712 10 25');
+compare('-4712 10 26', $hs_date = Date_Calc::DaysToDate(337, "%Y %m %d"), '337');
+compare(337, Date_Calc::DateToDays(26, 10, -4712), '-4712 10 26');
+compare('-4712 10 27', $hs_date = Date_Calc::DaysToDate(338, "%Y %m %d"), '338');
+compare(338, Date_Calc::DateToDays(27, 10, -4712), '-4712 10 27');
+compare('-4712 10 28', $hs_date = Date_Calc::DaysToDate(339, "%Y %m %d"), '339');
+compare(339, Date_Calc::DateToDays(28, 10, -4712), '-4712 10 28');
+compare('-4712 10 29', $hs_date = Date_Calc::DaysToDate(340, "%Y %m %d"), '340');
+compare(340, Date_Calc::DateToDays(29, 10, -4712), '-4712 10 29');
+compare('-4712 10 30', $hs_date = Date_Calc::DaysToDate(341, "%Y %m %d"), '341');
+compare(341, Date_Calc::DateToDays(30, 10, -4712), '-4712 10 30');
+compare('-4712 10 31', $hs_date = Date_Calc::DaysToDate(342, "%Y %m %d"), '342');
+compare(342, Date_Calc::DateToDays(31, 10, -4712), '-4712 10 31');
+compare('-4712 11 01', $hs_date = Date_Calc::DaysToDate(343, "%Y %m %d"), '343');
+compare(343, Date_Calc::DateToDays(1, 11, -4712), '-4712 11 01');
+compare('-4712 11 02', $hs_date = Date_Calc::DaysToDate(344, "%Y %m %d"), '344');
+compare(344, Date_Calc::DateToDays(2, 11, -4712), '-4712 11 02');
+compare('-4712 11 03', $hs_date = Date_Calc::DaysToDate(345, "%Y %m %d"), '345');
+compare(345, Date_Calc::DateToDays(3, 11, -4712), '-4712 11 03');
+compare('-4712 11 04', $hs_date = Date_Calc::DaysToDate(346, "%Y %m %d"), '346');
+compare(346, Date_Calc::DateToDays(4, 11, -4712), '-4712 11 04');
+compare('-4712 11 05', $hs_date = Date_Calc::DaysToDate(347, "%Y %m %d"), '347');
+compare(347, Date_Calc::DateToDays(5, 11, -4712), '-4712 11 05');
+compare('-4712 11 06', $hs_date = Date_Calc::DaysToDate(348, "%Y %m %d"), '348');
+compare(348, Date_Calc::DateToDays(6, 11, -4712), '-4712 11 06');
+compare('-4712 11 07', $hs_date = Date_Calc::DaysToDate(349, "%Y %m %d"), '349');
+compare(349, Date_Calc::DateToDays(7, 11, -4712), '-4712 11 07');
+compare('-4712 11 08', $hs_date = Date_Calc::DaysToDate(350, "%Y %m %d"), '350');
+compare(350, Date_Calc::DateToDays(8, 11, -4712), '-4712 11 08');
+compare('-4712 11 09', $hs_date = Date_Calc::DaysToDate(351, "%Y %m %d"), '351');
+compare(351, Date_Calc::DateToDays(9, 11, -4712), '-4712 11 09');
+compare('-4712 11 10', $hs_date = Date_Calc::DaysToDate(352, "%Y %m %d"), '352');
+compare(352, Date_Calc::DateToDays(10, 11, -4712), '-4712 11 10');
+compare('-4712 11 11', $hs_date = Date_Calc::DaysToDate(353, "%Y %m %d"), '353');
+compare(353, Date_Calc::DateToDays(11, 11, -4712), '-4712 11 11');
+compare('-4712 11 12', $hs_date = Date_Calc::DaysToDate(354, "%Y %m %d"), '354');
+compare(354, Date_Calc::DateToDays(12, 11, -4712), '-4712 11 12');
+compare('-4712 11 13', $hs_date = Date_Calc::DaysToDate(355, "%Y %m %d"), '355');
+compare(355, Date_Calc::DateToDays(13, 11, -4712), '-4712 11 13');
+compare('-4712 11 14', $hs_date = Date_Calc::DaysToDate(356, "%Y %m %d"), '356');
+compare(356, Date_Calc::DateToDays(14, 11, -4712), '-4712 11 14');
+compare('-4712 11 15', $hs_date = Date_Calc::DaysToDate(357, "%Y %m %d"), '357');
+compare(357, Date_Calc::DateToDays(15, 11, -4712), '-4712 11 15');
+compare('-4712 11 16', $hs_date = Date_Calc::DaysToDate(358, "%Y %m %d"), '358');
+compare(358, Date_Calc::DateToDays(16, 11, -4712), '-4712 11 16');
+compare('-4712 11 17', $hs_date = Date_Calc::DaysToDate(359, "%Y %m %d"), '359');
+compare(359, Date_Calc::DateToDays(17, 11, -4712), '-4712 11 17');
+compare('-4712 11 18', $hs_date = Date_Calc::DaysToDate(360, "%Y %m %d"), '360');
+compare(360, Date_Calc::DateToDays(18, 11, -4712), '-4712 11 18');
+compare('-4712 11 19', $hs_date = Date_Calc::DaysToDate(361, "%Y %m %d"), '361');
+compare(361, Date_Calc::DateToDays(19, 11, -4712), '-4712 11 19');
+compare('-4712 11 20', $hs_date = Date_Calc::DaysToDate(362, "%Y %m %d"), '362');
+compare(362, Date_Calc::DateToDays(20, 11, -4712), '-4712 11 20');
+compare('-4712 11 21', $hs_date = Date_Calc::DaysToDate(363, "%Y %m %d"), '363');
+compare(363, Date_Calc::DateToDays(21, 11, -4712), '-4712 11 21');
+compare('-4712 11 22', $hs_date = Date_Calc::DaysToDate(364, "%Y %m %d"), '364');
+compare(364, Date_Calc::DateToDays(22, 11, -4712), '-4712 11 22');
+compare('-4712 11 23', $hs_date = Date_Calc::DaysToDate(365, "%Y %m %d"), '365');
+compare(365, Date_Calc::DateToDays(23, 11, -4712), '-4712 11 23');
+compare('-4712 11 24', $hs_date = Date_Calc::DaysToDate(366, "%Y %m %d"), '366');
+compare(366, Date_Calc::DateToDays(24, 11, -4712), '-4712 11 24');
+
+compare('2006 11 07', Date_Calc::DaysToDate(2454047, "%Y %m %d"), '2454047');
+compare(2454047, Date_Calc::DateToDays(7, 11, 2006), '2006 11 07');
+compare('2006 11 08', Date_Calc::DaysToDate(2454048, "%Y %m %d"), '2454048');
+compare(2454048, Date_Calc::DateToDays(8, 11, 2006), '2006 11 08');
+compare('2006 11 09', Date_Calc::DaysToDate(2454049, "%Y %m %d"), '2454049');
+compare(2454049, Date_Calc::DateToDays(9, 11, 2006), '2006 11 09');
+compare('2006 11 10', Date_Calc::DaysToDate(2454050, "%Y %m %d"), '2454050');
+compare(2454050, Date_Calc::DateToDays(10, 11, 2006), '2006 11 10');
+compare('2006 11 11', Date_Calc::DaysToDate(2454051, "%Y %m %d"), '2454051');
+compare(2454051, Date_Calc::DateToDays(11, 11, 2006), '2006 11 11');
+compare('2006 11 12', Date_Calc::DaysToDate(2454052, "%Y %m %d"), '2454052');
+compare(2454052, Date_Calc::DateToDays(12, 11, 2006), '2006 11 12');
+compare('2006 11 13', Date_Calc::DaysToDate(2454053, "%Y %m %d"), '2454053');
+compare(2454053, Date_Calc::DateToDays(13, 11, 2006), '2006 11 13');
+compare('2006 11 14', Date_Calc::DaysToDate(2454054, "%Y %m %d"), '2454054');
+compare(2454054, Date_Calc::DateToDays(14, 11, 2006), '2006 11 14');
+compare('2006 11 15', Date_Calc::DaysToDate(2454055, "%Y %m %d"), '2454055');
+compare(2454055, Date_Calc::DateToDays(15, 11, 2006), '2006 11 15');
+compare('2006 11 16', Date_Calc::DaysToDate(2454056, "%Y %m %d"), '2454056');
+compare(2454056, Date_Calc::DateToDays(16, 11, 2006), '2006 11 16');
+compare('2006 11 17', Date_Calc::DaysToDate(2454057, "%Y %m %d"), '2454057');
+compare(2454057, Date_Calc::DateToDays(17, 11, 2006), '2006 11 17');
+compare('2006 11 18', Date_Calc::DaysToDate(2454058, "%Y %m %d"), '2454058');
+compare(2454058, Date_Calc::DateToDays(18, 11, 2006), '2006 11 18');
+compare('2006 11 19', Date_Calc::DaysToDate(2454059, "%Y %m %d"), '2454059');
+compare(2454059, Date_Calc::DateToDays(19, 11, 2006), '2006 11 19');
+compare('2006 11 20', Date_Calc::DaysToDate(2454060, "%Y %m %d"), '2454060');
+compare(2454060, Date_Calc::DateToDays(20, 11, 2006), '2006 11 20');
+compare('2006 11 21', Date_Calc::DaysToDate(2454061, "%Y %m %d"), '2454061');
+compare(2454061, Date_Calc::DateToDays(21, 11, 2006), '2006 11 21');
+compare('2006 11 22', Date_Calc::DaysToDate(2454062, "%Y %m %d"), '2454062');
+compare(2454062, Date_Calc::DateToDays(22, 11, 2006), '2006 11 22');
+compare('2006 11 23', Date_Calc::DaysToDate(2454063, "%Y %m %d"), '2454063');
+compare(2454063, Date_Calc::DateToDays(23, 11, 2006), '2006 11 23');
+compare('2006 11 24', Date_Calc::DaysToDate(2454064, "%Y %m %d"), '2454064');
+compare(2454064, Date_Calc::DateToDays(24, 11, 2006), '2006 11 24');
+compare('2006 11 25', Date_Calc::DaysToDate(2454065, "%Y %m %d"), '2454065');
+compare(2454065, Date_Calc::DateToDays(25, 11, 2006), '2006 11 25');
+compare('2006 11 26', Date_Calc::DaysToDate(2454066, "%Y %m %d"), '2454066');
+compare(2454066, Date_Calc::DateToDays(26, 11, 2006), '2006 11 26');
+compare('2006 11 27', Date_Calc::DaysToDate(2454067, "%Y %m %d"), '2454067');
+compare(2454067, Date_Calc::DateToDays(27, 11, 2006), '2006 11 27');
+compare('2006 11 28', Date_Calc::DaysToDate(2454068, "%Y %m %d"), '2454068');
+compare(2454068, Date_Calc::DateToDays(28, 11, 2006), '2006 11 28');
+compare('2006 11 29', Date_Calc::DaysToDate(2454069, "%Y %m %d"), '2454069');
+compare(2454069, Date_Calc::DateToDays(29, 11, 2006), '2006 11 29');
+compare('2006 11 30', Date_Calc::DaysToDate(2454070, "%Y %m %d"), '2454070');
+compare(2454070, Date_Calc::DateToDays(30, 11, 2006), '2006 11 30');
+compare('2006 12 01', Date_Calc::DaysToDate(2454071, "%Y %m %d"), '2454071');
+compare(2454071, Date_Calc::DateToDays(1, 12, 2006), '2006 12 01');
+compare('2006 12 02', Date_Calc::DaysToDate(2454072, "%Y %m %d"), '2454072');
+compare(2454072, Date_Calc::DateToDays(2, 12, 2006), '2006 12 02');
+compare('2006 12 03', Date_Calc::DaysToDate(2454073, "%Y %m %d"), '2454073');
+compare(2454073, Date_Calc::DateToDays(3, 12, 2006), '2006 12 03');
+compare('2006 12 04', Date_Calc::DaysToDate(2454074, "%Y %m %d"), '2454074');
+compare(2454074, Date_Calc::DateToDays(4, 12, 2006), '2006 12 04');
+compare('2006 12 05', Date_Calc::DaysToDate(2454075, "%Y %m %d"), '2454075');
+compare(2454075, Date_Calc::DateToDays(5, 12, 2006), '2006 12 05');
+compare('2006 12 06', Date_Calc::DaysToDate(2454076, "%Y %m %d"), '2454076');
+compare(2454076, Date_Calc::DateToDays(6, 12, 2006), '2006 12 06');
+compare('2006 12 07', Date_Calc::DaysToDate(2454077, "%Y %m %d"), '2454077');
+compare(2454077, Date_Calc::DateToDays(7, 12, 2006), '2006 12 07');
+compare('2006 12 08', Date_Calc::DaysToDate(2454078, "%Y %m %d"), '2454078');
+compare(2454078, Date_Calc::DateToDays(8, 12, 2006), '2006 12 08');
+compare('2006 12 09', Date_Calc::DaysToDate(2454079, "%Y %m %d"), '2454079');
+compare(2454079, Date_Calc::DateToDays(9, 12, 2006), '2006 12 09');
+compare('2006 12 10', Date_Calc::DaysToDate(2454080, "%Y %m %d"), '2454080');
+compare(2454080, Date_Calc::DateToDays(10, 12, 2006), '2006 12 10');
+compare('2006 12 11', Date_Calc::DaysToDate(2454081, "%Y %m %d"), '2454081');
+compare(2454081, Date_Calc::DateToDays(11, 12, 2006), '2006 12 11');
+compare('2006 12 12', Date_Calc::DaysToDate(2454082, "%Y %m %d"), '2454082');
+compare(2454082, Date_Calc::DateToDays(12, 12, 2006), '2006 12 12');
+compare('2006 12 13', Date_Calc::DaysToDate(2454083, "%Y %m %d"), '2454083');
+compare(2454083, Date_Calc::DateToDays(13, 12, 2006), '2006 12 13');
+compare('2006 12 14', Date_Calc::DaysToDate(2454084, "%Y %m %d"), '2454084');
+compare(2454084, Date_Calc::DateToDays(14, 12, 2006), '2006 12 14');
+compare('2006 12 15', Date_Calc::DaysToDate(2454085, "%Y %m %d"), '2454085');
+compare(2454085, Date_Calc::DateToDays(15, 12, 2006), '2006 12 15');
+compare('2006 12 16', Date_Calc::DaysToDate(2454086, "%Y %m %d"), '2454086');
+compare(2454086, Date_Calc::DateToDays(16, 12, 2006), '2006 12 16');
+compare('2006 12 17', Date_Calc::DaysToDate(2454087, "%Y %m %d"), '2454087');
+compare(2454087, Date_Calc::DateToDays(17, 12, 2006), '2006 12 17');
+compare('2006 12 18', Date_Calc::DaysToDate(2454088, "%Y %m %d"), '2454088');
+compare(2454088, Date_Calc::DateToDays(18, 12, 2006), '2006 12 18');
+compare('2006 12 19', Date_Calc::DaysToDate(2454089, "%Y %m %d"), '2454089');
+compare(2454089, Date_Calc::DateToDays(19, 12, 2006), '2006 12 19');
+compare('2006 12 20', Date_Calc::DaysToDate(2454090, "%Y %m %d"), '2454090');
+compare(2454090, Date_Calc::DateToDays(20, 12, 2006), '2006 12 20');
+compare('2006 12 21', Date_Calc::DaysToDate(2454091, "%Y %m %d"), '2454091');
+compare(2454091, Date_Calc::DateToDays(21, 12, 2006), '2006 12 21');
+compare('2006 12 22', Date_Calc::DaysToDate(2454092, "%Y %m %d"), '2454092');
+compare(2454092, Date_Calc::DateToDays(22, 12, 2006), '2006 12 22');
+compare('2006 12 23', Date_Calc::DaysToDate(2454093, "%Y %m %d"), '2454093');
+compare(2454093, Date_Calc::DateToDays(23, 12, 2006), '2006 12 23');
+compare('2006 12 24', Date_Calc::DaysToDate(2454094, "%Y %m %d"), '2454094');
+compare(2454094, Date_Calc::DateToDays(24, 12, 2006), '2006 12 24');
+compare('2006 12 25', Date_Calc::DaysToDate(2454095, "%Y %m %d"), '2454095');
+compare(2454095, Date_Calc::DateToDays(25, 12, 2006), '2006 12 25');
+compare('2006 12 26', Date_Calc::DaysToDate(2454096, "%Y %m %d"), '2454096');
+compare(2454096, Date_Calc::DateToDays(26, 12, 2006), '2006 12 26');
+compare('2006 12 27', Date_Calc::DaysToDate(2454097, "%Y %m %d"), '2454097');
+compare(2454097, Date_Calc::DateToDays(27, 12, 2006), '2006 12 27');
+compare('2006 12 28', Date_Calc::DaysToDate(2454098, "%Y %m %d"), '2454098');
+compare(2454098, Date_Calc::DateToDays(28, 12, 2006), '2006 12 28');
+compare('2006 12 29', Date_Calc::DaysToDate(2454099, "%Y %m %d"), '2454099');
+compare(2454099, Date_Calc::DateToDays(29, 12, 2006), '2006 12 29');
+compare('2006 12 30', Date_Calc::DaysToDate(2454100, "%Y %m %d"), '2454100');
+compare(2454100, Date_Calc::DateToDays(30, 12, 2006), '2006 12 30');
+compare('2006 12 31', Date_Calc::DaysToDate(2454101, "%Y %m %d"), '2454101');
+compare(2454101, Date_Calc::DateToDays(31, 12, 2006), '2006 12 31');
+compare('2007 01 01', Date_Calc::DaysToDate(2454102, "%Y %m %d"), '2454102');
+compare(2454102, Date_Calc::DateToDays(1, 1, 2007), '2007 01 01');
+compare('2007 01 02', Date_Calc::DaysToDate(2454103, "%Y %m %d"), '2454103');
+compare(2454103, Date_Calc::DateToDays(2, 1, 2007), '2007 01 02');
+compare('2007 01 03', Date_Calc::DaysToDate(2454104, "%Y %m %d"), '2454104');
+compare(2454104, Date_Calc::DateToDays(3, 1, 2007), '2007 01 03');
+compare('2007 01 04', Date_Calc::DaysToDate(2454105, "%Y %m %d"), '2454105');
+compare(2454105, Date_Calc::DateToDays(4, 1, 2007), '2007 01 04');
+compare('2007 01 05', Date_Calc::DaysToDate(2454106, "%Y %m %d"), '2454106');
+compare(2454106, Date_Calc::DateToDays(5, 1, 2007), '2007 01 05');
+compare('2007 01 06', Date_Calc::DaysToDate(2454107, "%Y %m %d"), '2454107');
+compare(2454107, Date_Calc::DateToDays(6, 1, 2007), '2007 01 06');
+compare('2007 01 07', Date_Calc::DaysToDate(2454108, "%Y %m %d"), '2454108');
+compare(2454108, Date_Calc::DateToDays(7, 1, 2007), '2007 01 07');
+compare('2007 01 08', Date_Calc::DaysToDate(2454109, "%Y %m %d"), '2454109');
+compare(2454109, Date_Calc::DateToDays(8, 1, 2007), '2007 01 08');
+compare('2007 01 09', Date_Calc::DaysToDate(2454110, "%Y %m %d"), '2454110');
+compare(2454110, Date_Calc::DateToDays(9, 1, 2007), '2007 01 09');
+compare('2007 01 10', Date_Calc::DaysToDate(2454111, "%Y %m %d"), '2454111');
+compare(2454111, Date_Calc::DateToDays(10, 1, 2007), '2007 01 10');
+compare('2007 01 11', Date_Calc::DaysToDate(2454112, "%Y %m %d"), '2454112');
+compare(2454112, Date_Calc::DateToDays(11, 1, 2007), '2007 01 11');
+compare('2007 01 12', Date_Calc::DaysToDate(2454113, "%Y %m %d"), '2454113');
+compare(2454113, Date_Calc::DateToDays(12, 1, 2007), '2007 01 12');
+compare('2007 01 13', Date_Calc::DaysToDate(2454114, "%Y %m %d"), '2454114');
+compare(2454114, Date_Calc::DateToDays(13, 1, 2007), '2007 01 13');
+compare('2007 01 14', Date_Calc::DaysToDate(2454115, "%Y %m %d"), '2454115');
+compare(2454115, Date_Calc::DateToDays(14, 1, 2007), '2007 01 14');
+compare('2007 01 15', Date_Calc::DaysToDate(2454116, "%Y %m %d"), '2454116');
+compare(2454116, Date_Calc::DateToDays(15, 1, 2007), '2007 01 15');
+compare('2007 01 16', Date_Calc::DaysToDate(2454117, "%Y %m %d"), '2454117');
+compare(2454117, Date_Calc::DateToDays(16, 1, 2007), '2007 01 16');
+compare('2007 01 17', Date_Calc::DaysToDate(2454118, "%Y %m %d"), '2454118');
+compare(2454118, Date_Calc::DateToDays(17, 1, 2007), '2007 01 17');
+compare('2007 01 18', Date_Calc::DaysToDate(2454119, "%Y %m %d"), '2454119');
+compare(2454119, Date_Calc::DateToDays(18, 1, 2007), '2007 01 18');
+compare('2007 01 19', Date_Calc::DaysToDate(2454120, "%Y %m %d"), '2454120');
+compare(2454120, Date_Calc::DateToDays(19, 1, 2007), '2007 01 19');
+compare('2007 01 20', Date_Calc::DaysToDate(2454121, "%Y %m %d"), '2454121');
+compare(2454121, Date_Calc::DateToDays(20, 1, 2007), '2007 01 20');
+compare('2007 01 21', Date_Calc::DaysToDate(2454122, "%Y %m %d"), '2454122');
+compare(2454122, Date_Calc::DateToDays(21, 1, 2007), '2007 01 21');
+compare('2007 01 22', Date_Calc::DaysToDate(2454123, "%Y %m %d"), '2454123');
+compare(2454123, Date_Calc::DateToDays(22, 1, 2007), '2007 01 22');
+compare('2007 01 23', Date_Calc::DaysToDate(2454124, "%Y %m %d"), '2454124');
+compare(2454124, Date_Calc::DateToDays(23, 1, 2007), '2007 01 23');
+compare('2007 01 24', Date_Calc::DaysToDate(2454125, "%Y %m %d"), '2454125');
+compare(2454125, Date_Calc::DateToDays(24, 1, 2007), '2007 01 24');
+compare('2007 01 25', Date_Calc::DaysToDate(2454126, "%Y %m %d"), '2454126');
+compare(2454126, Date_Calc::DateToDays(25, 1, 2007), '2007 01 25');
+compare('2007 01 26', Date_Calc::DaysToDate(2454127, "%Y %m %d"), '2454127');
+compare(2454127, Date_Calc::DateToDays(26, 1, 2007), '2007 01 26');
+compare('2007 01 27', Date_Calc::DaysToDate(2454128, "%Y %m %d"), '2454128');
+compare(2454128, Date_Calc::DateToDays(27, 1, 2007), '2007 01 27');
+compare('2007 01 28', Date_Calc::DaysToDate(2454129, "%Y %m %d"), '2454129');
+compare(2454129, Date_Calc::DateToDays(28, 1, 2007), '2007 01 28');
+compare('2007 01 29', Date_Calc::DaysToDate(2454130, "%Y %m %d"), '2454130');
+compare(2454130, Date_Calc::DateToDays(29, 1, 2007), '2007 01 29');
+compare('2007 01 30', Date_Calc::DaysToDate(2454131, "%Y %m %d"), '2454131');
+compare(2454131, Date_Calc::DateToDays(30, 1, 2007), '2007 01 30');
+compare('2007 01 31', Date_Calc::DaysToDate(2454132, "%Y %m %d"), '2454132');
+compare(2454132, Date_Calc::DateToDays(31, 1, 2007), '2007 01 31');
+compare('2007 02 01', Date_Calc::DaysToDate(2454133, "%Y %m %d"), '2454133');
+compare(2454133, Date_Calc::DateToDays(1, 2, 2007), '2007 02 01');
+compare('2007 02 02', Date_Calc::DaysToDate(2454134, "%Y %m %d"), '2454134');
+compare(2454134, Date_Calc::DateToDays(2, 2, 2007), '2007 02 02');
+compare('2007 02 03', Date_Calc::DaysToDate(2454135, "%Y %m %d"), '2454135');
+compare(2454135, Date_Calc::DateToDays(3, 2, 2007), '2007 02 03');
+compare('2007 02 04', Date_Calc::DaysToDate(2454136, "%Y %m %d"), '2454136');
+compare(2454136, Date_Calc::DateToDays(4, 2, 2007), '2007 02 04');
+compare('2007 02 05', Date_Calc::DaysToDate(2454137, "%Y %m %d"), '2454137');
+compare(2454137, Date_Calc::DateToDays(5, 2, 2007), '2007 02 05');
+compare('2007 02 06', Date_Calc::DaysToDate(2454138, "%Y %m %d"), '2454138');
+compare(2454138, Date_Calc::DateToDays(6, 2, 2007), '2007 02 06');
+compare('2007 02 07', Date_Calc::DaysToDate(2454139, "%Y %m %d"), '2454139');
+compare(2454139, Date_Calc::DateToDays(7, 2, 2007), '2007 02 07');
+compare('2007 02 08', Date_Calc::DaysToDate(2454140, "%Y %m %d"), '2454140');
+compare(2454140, Date_Calc::DateToDays(8, 2, 2007), '2007 02 08');
+compare('2007 02 09', Date_Calc::DaysToDate(2454141, "%Y %m %d"), '2454141');
+compare(2454141, Date_Calc::DateToDays(9, 2, 2007), '2007 02 09');
+compare('2007 02 10', Date_Calc::DaysToDate(2454142, "%Y %m %d"), '2454142');
+compare(2454142, Date_Calc::DateToDays(10, 2, 2007), '2007 02 10');
+compare('2007 02 11', Date_Calc::DaysToDate(2454143, "%Y %m %d"), '2454143');
+compare(2454143, Date_Calc::DateToDays(11, 2, 2007), '2007 02 11');
+compare('2007 02 12', Date_Calc::DaysToDate(2454144, "%Y %m %d"), '2454144');
+compare(2454144, Date_Calc::DateToDays(12, 2, 2007), '2007 02 12');
+compare('2007 02 13', Date_Calc::DaysToDate(2454145, "%Y %m %d"), '2454145');
+compare(2454145, Date_Calc::DateToDays(13, 2, 2007), '2007 02 13');
+compare('2007 02 14', Date_Calc::DaysToDate(2454146, "%Y %m %d"), '2454146');
+compare(2454146, Date_Calc::DateToDays(14, 2, 2007), '2007 02 14');
+compare('2007 02 15', Date_Calc::DaysToDate(2454147, "%Y %m %d"), '2454147');
+compare(2454147, Date_Calc::DateToDays(15, 2, 2007), '2007 02 15');
+compare('2007 02 16', Date_Calc::DaysToDate(2454148, "%Y %m %d"), '2454148');
+compare(2454148, Date_Calc::DateToDays(16, 2, 2007), '2007 02 16');
+compare('2007 02 17', Date_Calc::DaysToDate(2454149, "%Y %m %d"), '2454149');
+compare(2454149, Date_Calc::DateToDays(17, 2, 2007), '2007 02 17');
+compare('2007 02 18', Date_Calc::DaysToDate(2454150, "%Y %m %d"), '2454150');
+compare(2454150, Date_Calc::DateToDays(18, 2, 2007), '2007 02 18');
+compare('2007 02 19', Date_Calc::DaysToDate(2454151, "%Y %m %d"), '2454151');
+compare(2454151, Date_Calc::DateToDays(19, 2, 2007), '2007 02 19');
+compare('2007 02 20', Date_Calc::DaysToDate(2454152, "%Y %m %d"), '2454152');
+compare(2454152, Date_Calc::DateToDays(20, 2, 2007), '2007 02 20');
+compare('2007 02 21', Date_Calc::DaysToDate(2454153, "%Y %m %d"), '2454153');
+compare(2454153, Date_Calc::DateToDays(21, 2, 2007), '2007 02 21');
+compare('2007 02 22', Date_Calc::DaysToDate(2454154, "%Y %m %d"), '2454154');
+compare(2454154, Date_Calc::DateToDays(22, 2, 2007), '2007 02 22');
+compare('2007 02 23', Date_Calc::DaysToDate(2454155, "%Y %m %d"), '2454155');
+compare(2454155, Date_Calc::DateToDays(23, 2, 2007), '2007 02 23');
+compare('2007 02 24', Date_Calc::DaysToDate(2454156, "%Y %m %d"), '2454156');
+compare(2454156, Date_Calc::DateToDays(24, 2, 2007), '2007 02 24');
+compare('2007 02 25', Date_Calc::DaysToDate(2454157, "%Y %m %d"), '2454157');
+compare(2454157, Date_Calc::DateToDays(25, 2, 2007), '2007 02 25');
+compare('2007 02 26', Date_Calc::DaysToDate(2454158, "%Y %m %d"), '2454158');
+compare(2454158, Date_Calc::DateToDays(26, 2, 2007), '2007 02 26');
+compare('2007 02 27', Date_Calc::DaysToDate(2454159, "%Y %m %d"), '2454159');
+compare(2454159, Date_Calc::DateToDays(27, 2, 2007), '2007 02 27');
+compare('2007 02 28', Date_Calc::DaysToDate(2454160, "%Y %m %d"), '2454160');
+compare(2454160, Date_Calc::DateToDays(28, 2, 2007), '2007 02 28');
+compare('2007 03 01', Date_Calc::DaysToDate(2454161, "%Y %m %d"), '2454161');
+compare(2454161, Date_Calc::DateToDays(1, 3, 2007), '2007 03 01');
+compare('2007 03 02', Date_Calc::DaysToDate(2454162, "%Y %m %d"), '2454162');
+compare(2454162, Date_Calc::DateToDays(2, 3, 2007), '2007 03 02');
+compare('2007 03 03', Date_Calc::DaysToDate(2454163, "%Y %m %d"), '2454163');
+compare(2454163, Date_Calc::DateToDays(3, 3, 2007), '2007 03 03');
+compare('2007 03 04', Date_Calc::DaysToDate(2454164, "%Y %m %d"), '2454164');
+compare(2454164, Date_Calc::DateToDays(4, 3, 2007), '2007 03 04');
+compare('2007 03 05', Date_Calc::DaysToDate(2454165, "%Y %m %d"), '2454165');
+compare(2454165, Date_Calc::DateToDays(5, 3, 2007), '2007 03 05');
+compare('2007 03 06', Date_Calc::DaysToDate(2454166, "%Y %m %d"), '2454166');
+compare(2454166, Date_Calc::DateToDays(6, 3, 2007), '2007 03 06');
+compare('2007 03 07', Date_Calc::DaysToDate(2454167, "%Y %m %d"), '2454167');
+compare(2454167, Date_Calc::DateToDays(7, 3, 2007), '2007 03 07');
+compare('2007 03 08', Date_Calc::DaysToDate(2454168, "%Y %m %d"), '2454168');
+compare(2454168, Date_Calc::DateToDays(8, 3, 2007), '2007 03 08');
+compare('2007 03 09', Date_Calc::DaysToDate(2454169, "%Y %m %d"), '2454169');
+compare(2454169, Date_Calc::DateToDays(9, 3, 2007), '2007 03 09');
+compare('2007 03 10', Date_Calc::DaysToDate(2454170, "%Y %m %d"), '2454170');
+compare(2454170, Date_Calc::DateToDays(10, 3, 2007), '2007 03 10');
+compare('2007 03 11', Date_Calc::DaysToDate(2454171, "%Y %m %d"), '2454171');
+compare(2454171, Date_Calc::DateToDays(11, 3, 2007), '2007 03 11');
+compare('2007 03 12', Date_Calc::DaysToDate(2454172, "%Y %m %d"), '2454172');
+compare(2454172, Date_Calc::DateToDays(12, 3, 2007), '2007 03 12');
+compare('2007 03 13', Date_Calc::DaysToDate(2454173, "%Y %m %d"), '2454173');
+compare(2454173, Date_Calc::DateToDays(13, 3, 2007), '2007 03 13');
+compare('2007 03 14', Date_Calc::DaysToDate(2454174, "%Y %m %d"), '2454174');
+compare(2454174, Date_Calc::DateToDays(14, 3, 2007), '2007 03 14');
+compare('2007 03 15', Date_Calc::DaysToDate(2454175, "%Y %m %d"), '2454175');
+compare(2454175, Date_Calc::DateToDays(15, 3, 2007), '2007 03 15');
+compare('2007 03 16', Date_Calc::DaysToDate(2454176, "%Y %m %d"), '2454176');
+compare(2454176, Date_Calc::DateToDays(16, 3, 2007), '2007 03 16');
+compare('2007 03 17', Date_Calc::DaysToDate(2454177, "%Y %m %d"), '2454177');
+compare(2454177, Date_Calc::DateToDays(17, 3, 2007), '2007 03 17');
+compare('2007 03 18', Date_Calc::DaysToDate(2454178, "%Y %m %d"), '2454178');
+compare(2454178, Date_Calc::DateToDays(18, 3, 2007), '2007 03 18');
+compare('2007 03 19', Date_Calc::DaysToDate(2454179, "%Y %m %d"), '2454179');
+compare(2454179, Date_Calc::DateToDays(19, 3, 2007), '2007 03 19');
+compare('2007 03 20', Date_Calc::DaysToDate(2454180, "%Y %m %d"), '2454180');
+compare(2454180, Date_Calc::DateToDays(20, 3, 2007), '2007 03 20');
+compare('2007 03 21', Date_Calc::DaysToDate(2454181, "%Y %m %d"), '2454181');
+compare(2454181, Date_Calc::DateToDays(21, 3, 2007), '2007 03 21');
+compare('2007 03 22', Date_Calc::DaysToDate(2454182, "%Y %m %d"), '2454182');
+compare(2454182, Date_Calc::DateToDays(22, 3, 2007), '2007 03 22');
+compare('2007 03 23', Date_Calc::DaysToDate(2454183, "%Y %m %d"), '2454183');
+compare(2454183, Date_Calc::DateToDays(23, 3, 2007), '2007 03 23');
+compare('2007 03 24', Date_Calc::DaysToDate(2454184, "%Y %m %d"), '2454184');
+compare(2454184, Date_Calc::DateToDays(24, 3, 2007), '2007 03 24');
+compare('2007 03 25', Date_Calc::DaysToDate(2454185, "%Y %m %d"), '2454185');
+compare(2454185, Date_Calc::DateToDays(25, 3, 2007), '2007 03 25');
+compare('2007 03 26', Date_Calc::DaysToDate(2454186, "%Y %m %d"), '2454186');
+compare(2454186, Date_Calc::DateToDays(26, 3, 2007), '2007 03 26');
+compare('2007 03 27', Date_Calc::DaysToDate(2454187, "%Y %m %d"), '2454187');
+compare(2454187, Date_Calc::DateToDays(27, 3, 2007), '2007 03 27');
+compare('2007 03 28', Date_Calc::DaysToDate(2454188, "%Y %m %d"), '2454188');
+compare(2454188, Date_Calc::DateToDays(28, 3, 2007), '2007 03 28');
+compare('2007 03 29', Date_Calc::DaysToDate(2454189, "%Y %m %d"), '2454189');
+compare(2454189, Date_Calc::DateToDays(29, 3, 2007), '2007 03 29');
+compare('2007 03 30', Date_Calc::DaysToDate(2454190, "%Y %m %d"), '2454190');
+compare(2454190, Date_Calc::DateToDays(30, 3, 2007), '2007 03 30');
+compare('2007 03 31', Date_Calc::DaysToDate(2454191, "%Y %m %d"), '2454191');
+compare(2454191, Date_Calc::DateToDays(31, 3, 2007), '2007 03 31');
+compare('2007 04 01', Date_Calc::DaysToDate(2454192, "%Y %m %d"), '2454192');
+compare(2454192, Date_Calc::DateToDays(1, 4, 2007), '2007 04 01');
+compare('2007 04 02', Date_Calc::DaysToDate(2454193, "%Y %m %d"), '2454193');
+compare(2454193, Date_Calc::DateToDays(2, 4, 2007), '2007 04 02');
+compare('2007 04 03', Date_Calc::DaysToDate(2454194, "%Y %m %d"), '2454194');
+compare(2454194, Date_Calc::DateToDays(3, 4, 2007), '2007 04 03');
+compare('2007 04 04', Date_Calc::DaysToDate(2454195, "%Y %m %d"), '2454195');
+compare(2454195, Date_Calc::DateToDays(4, 4, 2007), '2007 04 04');
+compare('2007 04 05', Date_Calc::DaysToDate(2454196, "%Y %m %d"), '2454196');
+compare(2454196, Date_Calc::DateToDays(5, 4, 2007), '2007 04 05');
+compare('2007 04 06', Date_Calc::DaysToDate(2454197, "%Y %m %d"), '2454197');
+compare(2454197, Date_Calc::DateToDays(6, 4, 2007), '2007 04 06');
+compare('2007 04 07', Date_Calc::DaysToDate(2454198, "%Y %m %d"), '2454198');
+compare(2454198, Date_Calc::DateToDays(7, 4, 2007), '2007 04 07');
+compare('2007 04 08', Date_Calc::DaysToDate(2454199, "%Y %m %d"), '2454199');
+compare(2454199, Date_Calc::DateToDays(8, 4, 2007), '2007 04 08');
+compare('2007 04 09', Date_Calc::DaysToDate(2454200, "%Y %m %d"), '2454200');
+compare(2454200, Date_Calc::DateToDays(9, 4, 2007), '2007 04 09');
+compare('2007 04 10', Date_Calc::DaysToDate(2454201, "%Y %m %d"), '2454201');
+compare(2454201, Date_Calc::DateToDays(10, 4, 2007), '2007 04 10');
+compare('2007 04 11', Date_Calc::DaysToDate(2454202, "%Y %m %d"), '2454202');
+compare(2454202, Date_Calc::DateToDays(11, 4, 2007), '2007 04 11');
+compare('2007 04 12', Date_Calc::DaysToDate(2454203, "%Y %m %d"), '2454203');
+compare(2454203, Date_Calc::DateToDays(12, 4, 2007), '2007 04 12');
+compare('2007 04 13', Date_Calc::DaysToDate(2454204, "%Y %m %d"), '2454204');
+compare(2454204, Date_Calc::DateToDays(13, 4, 2007), '2007 04 13');
+compare('2007 04 14', Date_Calc::DaysToDate(2454205, "%Y %m %d"), '2454205');
+compare(2454205, Date_Calc::DateToDays(14, 4, 2007), '2007 04 14');
+compare('2007 04 15', Date_Calc::DaysToDate(2454206, "%Y %m %d"), '2454206');
+compare(2454206, Date_Calc::DateToDays(15, 4, 2007), '2007 04 15');
+compare('2007 04 16', Date_Calc::DaysToDate(2454207, "%Y %m %d"), '2454207');
+compare(2454207, Date_Calc::DateToDays(16, 4, 2007), '2007 04 16');
+compare('2007 04 17', Date_Calc::DaysToDate(2454208, "%Y %m %d"), '2454208');
+compare(2454208, Date_Calc::DateToDays(17, 4, 2007), '2007 04 17');
+compare('2007 04 18', Date_Calc::DaysToDate(2454209, "%Y %m %d"), '2454209');
+compare(2454209, Date_Calc::DateToDays(18, 4, 2007), '2007 04 18');
+compare('2007 04 19', Date_Calc::DaysToDate(2454210, "%Y %m %d"), '2454210');
+compare(2454210, Date_Calc::DateToDays(19, 4, 2007), '2007 04 19');
+compare('2007 04 20', Date_Calc::DaysToDate(2454211, "%Y %m %d"), '2454211');
+compare(2454211, Date_Calc::DateToDays(20, 4, 2007), '2007 04 20');
+compare('2007 04 21', Date_Calc::DaysToDate(2454212, "%Y %m %d"), '2454212');
+compare(2454212, Date_Calc::DateToDays(21, 4, 2007), '2007 04 21');
+compare('2007 04 22', Date_Calc::DaysToDate(2454213, "%Y %m %d"), '2454213');
+compare(2454213, Date_Calc::DateToDays(22, 4, 2007), '2007 04 22');
+compare('2007 04 23', Date_Calc::DaysToDate(2454214, "%Y %m %d"), '2454214');
+compare(2454214, Date_Calc::DateToDays(23, 4, 2007), '2007 04 23');
+compare('2007 04 24', Date_Calc::DaysToDate(2454215, "%Y %m %d"), '2454215');
+compare(2454215, Date_Calc::DateToDays(24, 4, 2007), '2007 04 24');
+compare('2007 04 25', Date_Calc::DaysToDate(2454216, "%Y %m %d"), '2454216');
+compare(2454216, Date_Calc::DateToDays(25, 4, 2007), '2007 04 25');
+compare('2007 04 26', Date_Calc::DaysToDate(2454217, "%Y %m %d"), '2454217');
+compare(2454217, Date_Calc::DateToDays(26, 4, 2007), '2007 04 26');
+compare('2007 04 27', Date_Calc::DaysToDate(2454218, "%Y %m %d"), '2454218');
+compare(2454218, Date_Calc::DateToDays(27, 4, 2007), '2007 04 27');
+compare('2007 04 28', Date_Calc::DaysToDate(2454219, "%Y %m %d"), '2454219');
+compare(2454219, Date_Calc::DateToDays(28, 4, 2007), '2007 04 28');
+compare('2007 04 29', Date_Calc::DaysToDate(2454220, "%Y %m %d"), '2454220');
+compare(2454220, Date_Calc::DateToDays(29, 4, 2007), '2007 04 29');
+compare('2007 04 30', Date_Calc::DaysToDate(2454221, "%Y %m %d"), '2454221');
+compare(2454221, Date_Calc::DateToDays(30, 4, 2007), '2007 04 30');
+compare('2007 05 01', Date_Calc::DaysToDate(2454222, "%Y %m %d"), '2454222');
+compare(2454222, Date_Calc::DateToDays(1, 5, 2007), '2007 05 01');
+compare('2007 05 02', Date_Calc::DaysToDate(2454223, "%Y %m %d"), '2454223');
+compare(2454223, Date_Calc::DateToDays(2, 5, 2007), '2007 05 02');
+compare('2007 05 03', Date_Calc::DaysToDate(2454224, "%Y %m %d"), '2454224');
+compare(2454224, Date_Calc::DateToDays(3, 5, 2007), '2007 05 03');
+compare('2007 05 04', Date_Calc::DaysToDate(2454225, "%Y %m %d"), '2454225');
+compare(2454225, Date_Calc::DateToDays(4, 5, 2007), '2007 05 04');
+compare('2007 05 05', Date_Calc::DaysToDate(2454226, "%Y %m %d"), '2454226');
+compare(2454226, Date_Calc::DateToDays(5, 5, 2007), '2007 05 05');
+compare('2007 05 06', Date_Calc::DaysToDate(2454227, "%Y %m %d"), '2454227');
+compare(2454227, Date_Calc::DateToDays(6, 5, 2007), '2007 05 06');
+compare('2007 05 07', Date_Calc::DaysToDate(2454228, "%Y %m %d"), '2454228');
+compare(2454228, Date_Calc::DateToDays(7, 5, 2007), '2007 05 07');
+compare('2007 05 08', Date_Calc::DaysToDate(2454229, "%Y %m %d"), '2454229');
+compare(2454229, Date_Calc::DateToDays(8, 5, 2007), '2007 05 08');
+compare('2007 05 09', Date_Calc::DaysToDate(2454230, "%Y %m %d"), '2454230');
+compare(2454230, Date_Calc::DateToDays(9, 5, 2007), '2007 05 09');
+compare('2007 05 10', Date_Calc::DaysToDate(2454231, "%Y %m %d"), '2454231');
+compare(2454231, Date_Calc::DateToDays(10, 5, 2007), '2007 05 10');
+compare('2007 05 11', Date_Calc::DaysToDate(2454232, "%Y %m %d"), '2454232');
+compare(2454232, Date_Calc::DateToDays(11, 5, 2007), '2007 05 11');
+compare('2007 05 12', Date_Calc::DaysToDate(2454233, "%Y %m %d"), '2454233');
+compare(2454233, Date_Calc::DateToDays(12, 5, 2007), '2007 05 12');
+compare('2007 05 13', Date_Calc::DaysToDate(2454234, "%Y %m %d"), '2454234');
+compare(2454234, Date_Calc::DateToDays(13, 5, 2007), '2007 05 13');
+compare('2007 05 14', Date_Calc::DaysToDate(2454235, "%Y %m %d"), '2454235');
+compare(2454235, Date_Calc::DateToDays(14, 5, 2007), '2007 05 14');
+compare('2007 05 15', Date_Calc::DaysToDate(2454236, "%Y %m %d"), '2454236');
+compare(2454236, Date_Calc::DateToDays(15, 5, 2007), '2007 05 15');
+compare('2007 05 16', Date_Calc::DaysToDate(2454237, "%Y %m %d"), '2454237');
+compare(2454237, Date_Calc::DateToDays(16, 5, 2007), '2007 05 16');
+compare('2007 05 17', Date_Calc::DaysToDate(2454238, "%Y %m %d"), '2454238');
+compare(2454238, Date_Calc::DateToDays(17, 5, 2007), '2007 05 17');
+compare('2007 05 18', Date_Calc::DaysToDate(2454239, "%Y %m %d"), '2454239');
+compare(2454239, Date_Calc::DateToDays(18, 5, 2007), '2007 05 18');
+compare('2007 05 19', Date_Calc::DaysToDate(2454240, "%Y %m %d"), '2454240');
+compare(2454240, Date_Calc::DateToDays(19, 5, 2007), '2007 05 19');
+compare('2007 05 20', Date_Calc::DaysToDate(2454241, "%Y %m %d"), '2454241');
+compare(2454241, Date_Calc::DateToDays(20, 5, 2007), '2007 05 20');
+compare('2007 05 21', Date_Calc::DaysToDate(2454242, "%Y %m %d"), '2454242');
+compare(2454242, Date_Calc::DateToDays(21, 5, 2007), '2007 05 21');
+compare('2007 05 22', Date_Calc::DaysToDate(2454243, "%Y %m %d"), '2454243');
+compare(2454243, Date_Calc::DateToDays(22, 5, 2007), '2007 05 22');
+compare('2007 05 23', Date_Calc::DaysToDate(2454244, "%Y %m %d"), '2454244');
+compare(2454244, Date_Calc::DateToDays(23, 5, 2007), '2007 05 23');
+compare('2007 05 24', Date_Calc::DaysToDate(2454245, "%Y %m %d"), '2454245');
+compare(2454245, Date_Calc::DateToDays(24, 5, 2007), '2007 05 24');
+compare('2007 05 25', Date_Calc::DaysToDate(2454246, "%Y %m %d"), '2454246');
+compare(2454246, Date_Calc::DateToDays(25, 5, 2007), '2007 05 25');
+compare('2007 05 26', Date_Calc::DaysToDate(2454247, "%Y %m %d"), '2454247');
+compare(2454247, Date_Calc::DateToDays(26, 5, 2007), '2007 05 26');
+compare('2007 05 27', Date_Calc::DaysToDate(2454248, "%Y %m %d"), '2454248');
+compare(2454248, Date_Calc::DateToDays(27, 5, 2007), '2007 05 27');
+compare('2007 05 28', Date_Calc::DaysToDate(2454249, "%Y %m %d"), '2454249');
+compare(2454249, Date_Calc::DateToDays(28, 5, 2007), '2007 05 28');
+compare('2007 05 29', Date_Calc::DaysToDate(2454250, "%Y %m %d"), '2454250');
+compare(2454250, Date_Calc::DateToDays(29, 5, 2007), '2007 05 29');
+compare('2007 05 30', Date_Calc::DaysToDate(2454251, "%Y %m %d"), '2454251');
+compare(2454251, Date_Calc::DateToDays(30, 5, 2007), '2007 05 30');
+compare('2007 05 31', Date_Calc::DaysToDate(2454252, "%Y %m %d"), '2454252');
+compare(2454252, Date_Calc::DateToDays(31, 5, 2007), '2007 05 31');
+compare('2007 06 01', Date_Calc::DaysToDate(2454253, "%Y %m %d"), '2454253');
+compare(2454253, Date_Calc::DateToDays(1, 6, 2007), '2007 06 01');
+compare('2007 06 02', Date_Calc::DaysToDate(2454254, "%Y %m %d"), '2454254');
+compare(2454254, Date_Calc::DateToDays(2, 6, 2007), '2007 06 02');
+compare('2007 06 03', Date_Calc::DaysToDate(2454255, "%Y %m %d"), '2454255');
+compare(2454255, Date_Calc::DateToDays(3, 6, 2007), '2007 06 03');
+compare('2007 06 04', Date_Calc::DaysToDate(2454256, "%Y %m %d"), '2454256');
+compare(2454256, Date_Calc::DateToDays(4, 6, 2007), '2007 06 04');
+compare('2007 06 05', Date_Calc::DaysToDate(2454257, "%Y %m %d"), '2454257');
+compare(2454257, Date_Calc::DateToDays(5, 6, 2007), '2007 06 05');
+compare('2007 06 06', Date_Calc::DaysToDate(2454258, "%Y %m %d"), '2454258');
+compare(2454258, Date_Calc::DateToDays(6, 6, 2007), '2007 06 06');
+compare('2007 06 07', Date_Calc::DaysToDate(2454259, "%Y %m %d"), '2454259');
+compare(2454259, Date_Calc::DateToDays(7, 6, 2007), '2007 06 07');
+compare('2007 06 08', Date_Calc::DaysToDate(2454260, "%Y %m %d"), '2454260');
+compare(2454260, Date_Calc::DateToDays(8, 6, 2007), '2007 06 08');
+compare('2007 06 09', Date_Calc::DaysToDate(2454261, "%Y %m %d"), '2454261');
+compare(2454261, Date_Calc::DateToDays(9, 6, 2007), '2007 06 09');
+compare('2007 06 10', Date_Calc::DaysToDate(2454262, "%Y %m %d"), '2454262');
+compare(2454262, Date_Calc::DateToDays(10, 6, 2007), '2007 06 10');
+compare('2007 06 11', Date_Calc::DaysToDate(2454263, "%Y %m %d"), '2454263');
+compare(2454263, Date_Calc::DateToDays(11, 6, 2007), '2007 06 11');
+compare('2007 06 12', Date_Calc::DaysToDate(2454264, "%Y %m %d"), '2454264');
+compare(2454264, Date_Calc::DateToDays(12, 6, 2007), '2007 06 12');
+compare('2007 06 13', Date_Calc::DaysToDate(2454265, "%Y %m %d"), '2454265');
+compare(2454265, Date_Calc::DateToDays(13, 6, 2007), '2007 06 13');
+compare('2007 06 14', Date_Calc::DaysToDate(2454266, "%Y %m %d"), '2454266');
+compare(2454266, Date_Calc::DateToDays(14, 6, 2007), '2007 06 14');
+compare('2007 06 15', Date_Calc::DaysToDate(2454267, "%Y %m %d"), '2454267');
+compare(2454267, Date_Calc::DateToDays(15, 6, 2007), '2007 06 15');
+compare('2007 06 16', Date_Calc::DaysToDate(2454268, "%Y %m %d"), '2454268');
+compare(2454268, Date_Calc::DateToDays(16, 6, 2007), '2007 06 16');
+compare('2007 06 17', Date_Calc::DaysToDate(2454269, "%Y %m %d"), '2454269');
+compare(2454269, Date_Calc::DateToDays(17, 6, 2007), '2007 06 17');
+compare('2007 06 18', Date_Calc::DaysToDate(2454270, "%Y %m %d"), '2454270');
+compare(2454270, Date_Calc::DateToDays(18, 6, 2007), '2007 06 18');
+compare('2007 06 19', Date_Calc::DaysToDate(2454271, "%Y %m %d"), '2454271');
+compare(2454271, Date_Calc::DateToDays(19, 6, 2007), '2007 06 19');
+compare('2007 06 20', Date_Calc::DaysToDate(2454272, "%Y %m %d"), '2454272');
+compare(2454272, Date_Calc::DateToDays(20, 6, 2007), '2007 06 20');
+compare('2007 06 21', Date_Calc::DaysToDate(2454273, "%Y %m %d"), '2454273');
+compare(2454273, Date_Calc::DateToDays(21, 6, 2007), '2007 06 21');
+compare('2007 06 22', Date_Calc::DaysToDate(2454274, "%Y %m %d"), '2454274');
+compare(2454274, Date_Calc::DateToDays(22, 6, 2007), '2007 06 22');
+compare('2007 06 23', Date_Calc::DaysToDate(2454275, "%Y %m %d"), '2454275');
+compare(2454275, Date_Calc::DateToDays(23, 6, 2007), '2007 06 23');
+compare('2007 06 24', Date_Calc::DaysToDate(2454276, "%Y %m %d"), '2454276');
+compare(2454276, Date_Calc::DateToDays(24, 6, 2007), '2007 06 24');
+compare('2007 06 25', Date_Calc::DaysToDate(2454277, "%Y %m %d"), '2454277');
+compare(2454277, Date_Calc::DateToDays(25, 6, 2007), '2007 06 25');
+compare('2007 06 26', Date_Calc::DaysToDate(2454278, "%Y %m %d"), '2454278');
+compare(2454278, Date_Calc::DateToDays(26, 6, 2007), '2007 06 26');
+compare('2007 06 27', Date_Calc::DaysToDate(2454279, "%Y %m %d"), '2454279');
+compare(2454279, Date_Calc::DateToDays(27, 6, 2007), '2007 06 27');
+compare('2007 06 28', Date_Calc::DaysToDate(2454280, "%Y %m %d"), '2454280');
+compare(2454280, Date_Calc::DateToDays(28, 6, 2007), '2007 06 28');
+compare('2007 06 29', Date_Calc::DaysToDate(2454281, "%Y %m %d"), '2454281');
+compare(2454281, Date_Calc::DateToDays(29, 6, 2007), '2007 06 29');
+compare('2007 06 30', Date_Calc::DaysToDate(2454282, "%Y %m %d"), '2454282');
+compare(2454282, Date_Calc::DateToDays(30, 6, 2007), '2007 06 30');
+compare('2007 07 01', Date_Calc::DaysToDate(2454283, "%Y %m %d"), '2454283');
+compare(2454283, Date_Calc::DateToDays(1, 7, 2007), '2007 07 01');
+compare('2007 07 02', Date_Calc::DaysToDate(2454284, "%Y %m %d"), '2454284');
+compare(2454284, Date_Calc::DateToDays(2, 7, 2007), '2007 07 02');
+compare('2007 07 03', Date_Calc::DaysToDate(2454285, "%Y %m %d"), '2454285');
+compare(2454285, Date_Calc::DateToDays(3, 7, 2007), '2007 07 03');
+compare('2007 07 04', Date_Calc::DaysToDate(2454286, "%Y %m %d"), '2454286');
+compare(2454286, Date_Calc::DateToDays(4, 7, 2007), '2007 07 04');
+compare('2007 07 05', Date_Calc::DaysToDate(2454287, "%Y %m %d"), '2454287');
+compare(2454287, Date_Calc::DateToDays(5, 7, 2007), '2007 07 05');
+compare('2007 07 06', Date_Calc::DaysToDate(2454288, "%Y %m %d"), '2454288');
+compare(2454288, Date_Calc::DateToDays(6, 7, 2007), '2007 07 06');
+compare('2007 07 07', Date_Calc::DaysToDate(2454289, "%Y %m %d"), '2454289');
+compare(2454289, Date_Calc::DateToDays(7, 7, 2007), '2007 07 07');
+compare('2007 07 08', Date_Calc::DaysToDate(2454290, "%Y %m %d"), '2454290');
+compare(2454290, Date_Calc::DateToDays(8, 7, 2007), '2007 07 08');
+compare('2007 07 09', Date_Calc::DaysToDate(2454291, "%Y %m %d"), '2454291');
+compare(2454291, Date_Calc::DateToDays(9, 7, 2007), '2007 07 09');
+compare('2007 07 10', Date_Calc::DaysToDate(2454292, "%Y %m %d"), '2454292');
+compare(2454292, Date_Calc::DateToDays(10, 7, 2007), '2007 07 10');
+compare('2007 07 11', Date_Calc::DaysToDate(2454293, "%Y %m %d"), '2454293');
+compare(2454293, Date_Calc::DateToDays(11, 7, 2007), '2007 07 11');
+compare('2007 07 12', Date_Calc::DaysToDate(2454294, "%Y %m %d"), '2454294');
+compare(2454294, Date_Calc::DateToDays(12, 7, 2007), '2007 07 12');
+compare('2007 07 13', Date_Calc::DaysToDate(2454295, "%Y %m %d"), '2454295');
+compare(2454295, Date_Calc::DateToDays(13, 7, 2007), '2007 07 13');
+compare('2007 07 14', Date_Calc::DaysToDate(2454296, "%Y %m %d"), '2454296');
+compare(2454296, Date_Calc::DateToDays(14, 7, 2007), '2007 07 14');
+compare('2007 07 15', Date_Calc::DaysToDate(2454297, "%Y %m %d"), '2454297');
+compare(2454297, Date_Calc::DateToDays(15, 7, 2007), '2007 07 15');
+compare('2007 07 16', Date_Calc::DaysToDate(2454298, "%Y %m %d"), '2454298');
+compare(2454298, Date_Calc::DateToDays(16, 7, 2007), '2007 07 16');
+compare('2007 07 17', Date_Calc::DaysToDate(2454299, "%Y %m %d"), '2454299');
+compare(2454299, Date_Calc::DateToDays(17, 7, 2007), '2007 07 17');
+compare('2007 07 18', Date_Calc::DaysToDate(2454300, "%Y %m %d"), '2454300');
+compare(2454300, Date_Calc::DateToDays(18, 7, 2007), '2007 07 18');
+compare('2007 07 19', Date_Calc::DaysToDate(2454301, "%Y %m %d"), '2454301');
+compare(2454301, Date_Calc::DateToDays(19, 7, 2007), '2007 07 19');
+compare('2007 07 20', Date_Calc::DaysToDate(2454302, "%Y %m %d"), '2454302');
+compare(2454302, Date_Calc::DateToDays(20, 7, 2007), '2007 07 20');
+compare('2007 07 21', Date_Calc::DaysToDate(2454303, "%Y %m %d"), '2454303');
+compare(2454303, Date_Calc::DateToDays(21, 7, 2007), '2007 07 21');
+compare('2007 07 22', Date_Calc::DaysToDate(2454304, "%Y %m %d"), '2454304');
+compare(2454304, Date_Calc::DateToDays(22, 7, 2007), '2007 07 22');
+compare('2007 07 23', Date_Calc::DaysToDate(2454305, "%Y %m %d"), '2454305');
+compare(2454305, Date_Calc::DateToDays(23, 7, 2007), '2007 07 23');
+compare('2007 07 24', Date_Calc::DaysToDate(2454306, "%Y %m %d"), '2454306');
+compare(2454306, Date_Calc::DateToDays(24, 7, 2007), '2007 07 24');
+compare('2007 07 25', Date_Calc::DaysToDate(2454307, "%Y %m %d"), '2454307');
+compare(2454307, Date_Calc::DateToDays(25, 7, 2007), '2007 07 25');
+compare('2007 07 26', Date_Calc::DaysToDate(2454308, "%Y %m %d"), '2454308');
+compare(2454308, Date_Calc::DateToDays(26, 7, 2007), '2007 07 26');
+compare('2007 07 27', Date_Calc::DaysToDate(2454309, "%Y %m %d"), '2454309');
+compare(2454309, Date_Calc::DateToDays(27, 7, 2007), '2007 07 27');
+compare('2007 07 28', Date_Calc::DaysToDate(2454310, "%Y %m %d"), '2454310');
+compare(2454310, Date_Calc::DateToDays(28, 7, 2007), '2007 07 28');
+compare('2007 07 29', Date_Calc::DaysToDate(2454311, "%Y %m %d"), '2454311');
+compare(2454311, Date_Calc::DateToDays(29, 7, 2007), '2007 07 29');
+compare('2007 07 30', Date_Calc::DaysToDate(2454312, "%Y %m %d"), '2454312');
+compare(2454312, Date_Calc::DateToDays(30, 7, 2007), '2007 07 30');
+compare('2007 07 31', Date_Calc::DaysToDate(2454313, "%Y %m %d"), '2454313');
+compare(2454313, Date_Calc::DateToDays(31, 7, 2007), '2007 07 31');
+compare('2007 08 01', Date_Calc::DaysToDate(2454314, "%Y %m %d"), '2454314');
+compare(2454314, Date_Calc::DateToDays(1, 8, 2007), '2007 08 01');
+compare('2007 08 02', Date_Calc::DaysToDate(2454315, "%Y %m %d"), '2454315');
+compare(2454315, Date_Calc::DateToDays(2, 8, 2007), '2007 08 02');
+compare('2007 08 03', Date_Calc::DaysToDate(2454316, "%Y %m %d"), '2454316');
+compare(2454316, Date_Calc::DateToDays(3, 8, 2007), '2007 08 03');
+compare('2007 08 04', Date_Calc::DaysToDate(2454317, "%Y %m %d"), '2454317');
+compare(2454317, Date_Calc::DateToDays(4, 8, 2007), '2007 08 04');
+compare('2007 08 05', Date_Calc::DaysToDate(2454318, "%Y %m %d"), '2454318');
+compare(2454318, Date_Calc::DateToDays(5, 8, 2007), '2007 08 05');
+compare('2007 08 06', Date_Calc::DaysToDate(2454319, "%Y %m %d"), '2454319');
+compare(2454319, Date_Calc::DateToDays(6, 8, 2007), '2007 08 06');
+compare('2007 08 07', Date_Calc::DaysToDate(2454320, "%Y %m %d"), '2454320');
+compare(2454320, Date_Calc::DateToDays(7, 8, 2007), '2007 08 07');
+compare('2007 08 08', Date_Calc::DaysToDate(2454321, "%Y %m %d"), '2454321');
+compare(2454321, Date_Calc::DateToDays(8, 8, 2007), '2007 08 08');
+compare('2007 08 09', Date_Calc::DaysToDate(2454322, "%Y %m %d"), '2454322');
+compare(2454322, Date_Calc::DateToDays(9, 8, 2007), '2007 08 09');
+compare('2007 08 10', Date_Calc::DaysToDate(2454323, "%Y %m %d"), '2454323');
+compare(2454323, Date_Calc::DateToDays(10, 8, 2007), '2007 08 10');
+compare('2007 08 11', Date_Calc::DaysToDate(2454324, "%Y %m %d"), '2454324');
+compare(2454324, Date_Calc::DateToDays(11, 8, 2007), '2007 08 11');
+compare('2007 08 12', Date_Calc::DaysToDate(2454325, "%Y %m %d"), '2454325');
+compare(2454325, Date_Calc::DateToDays(12, 8, 2007), '2007 08 12');
+compare('2007 08 13', Date_Calc::DaysToDate(2454326, "%Y %m %d"), '2454326');
+compare(2454326, Date_Calc::DateToDays(13, 8, 2007), '2007 08 13');
+compare('2007 08 14', Date_Calc::DaysToDate(2454327, "%Y %m %d"), '2454327');
+compare(2454327, Date_Calc::DateToDays(14, 8, 2007), '2007 08 14');
+compare('2007 08 15', Date_Calc::DaysToDate(2454328, "%Y %m %d"), '2454328');
+compare(2454328, Date_Calc::DateToDays(15, 8, 2007), '2007 08 15');
+compare('2007 08 16', Date_Calc::DaysToDate(2454329, "%Y %m %d"), '2454329');
+compare(2454329, Date_Calc::DateToDays(16, 8, 2007), '2007 08 16');
+compare('2007 08 17', Date_Calc::DaysToDate(2454330, "%Y %m %d"), '2454330');
+compare(2454330, Date_Calc::DateToDays(17, 8, 2007), '2007 08 17');
+compare('2007 08 18', Date_Calc::DaysToDate(2454331, "%Y %m %d"), '2454331');
+compare(2454331, Date_Calc::DateToDays(18, 8, 2007), '2007 08 18');
+compare('2007 08 19', Date_Calc::DaysToDate(2454332, "%Y %m %d"), '2454332');
+compare(2454332, Date_Calc::DateToDays(19, 8, 2007), '2007 08 19');
+compare('2007 08 20', Date_Calc::DaysToDate(2454333, "%Y %m %d"), '2454333');
+compare(2454333, Date_Calc::DateToDays(20, 8, 2007), '2007 08 20');
+compare('2007 08 21', Date_Calc::DaysToDate(2454334, "%Y %m %d"), '2454334');
+compare(2454334, Date_Calc::DateToDays(21, 8, 2007), '2007 08 21');
+compare('2007 08 22', Date_Calc::DaysToDate(2454335, "%Y %m %d"), '2454335');
+compare(2454335, Date_Calc::DateToDays(22, 8, 2007), '2007 08 22');
+compare('2007 08 23', Date_Calc::DaysToDate(2454336, "%Y %m %d"), '2454336');
+compare(2454336, Date_Calc::DateToDays(23, 8, 2007), '2007 08 23');
+compare('2007 08 24', Date_Calc::DaysToDate(2454337, "%Y %m %d"), '2454337');
+compare(2454337, Date_Calc::DateToDays(24, 8, 2007), '2007 08 24');
+compare('2007 08 25', Date_Calc::DaysToDate(2454338, "%Y %m %d"), '2454338');
+compare(2454338, Date_Calc::DateToDays(25, 8, 2007), '2007 08 25');
+compare('2007 08 26', Date_Calc::DaysToDate(2454339, "%Y %m %d"), '2454339');
+compare(2454339, Date_Calc::DateToDays(26, 8, 2007), '2007 08 26');
+compare('2007 08 27', Date_Calc::DaysToDate(2454340, "%Y %m %d"), '2454340');
+compare(2454340, Date_Calc::DateToDays(27, 8, 2007), '2007 08 27');
+compare('2007 08 28', Date_Calc::DaysToDate(2454341, "%Y %m %d"), '2454341');
+compare(2454341, Date_Calc::DateToDays(28, 8, 2007), '2007 08 28');
+compare('2007 08 29', Date_Calc::DaysToDate(2454342, "%Y %m %d"), '2454342');
+compare(2454342, Date_Calc::DateToDays(29, 8, 2007), '2007 08 29');
+compare('2007 08 30', Date_Calc::DaysToDate(2454343, "%Y %m %d"), '2454343');
+compare(2454343, Date_Calc::DateToDays(30, 8, 2007), '2007 08 30');
+compare('2007 08 31', Date_Calc::DaysToDate(2454344, "%Y %m %d"), '2454344');
+compare(2454344, Date_Calc::DateToDays(31, 8, 2007), '2007 08 31');
+compare('2007 09 01', Date_Calc::DaysToDate(2454345, "%Y %m %d"), '2454345');
+compare(2454345, Date_Calc::DateToDays(1, 9, 2007), '2007 09 01');
+compare('2007 09 02', Date_Calc::DaysToDate(2454346, "%Y %m %d"), '2454346');
+compare(2454346, Date_Calc::DateToDays(2, 9, 2007), '2007 09 02');
+compare('2007 09 03', Date_Calc::DaysToDate(2454347, "%Y %m %d"), '2454347');
+compare(2454347, Date_Calc::DateToDays(3, 9, 2007), '2007 09 03');
+compare('2007 09 04', Date_Calc::DaysToDate(2454348, "%Y %m %d"), '2454348');
+compare(2454348, Date_Calc::DateToDays(4, 9, 2007), '2007 09 04');
+compare('2007 09 05', Date_Calc::DaysToDate(2454349, "%Y %m %d"), '2454349');
+compare(2454349, Date_Calc::DateToDays(5, 9, 2007), '2007 09 05');
+compare('2007 09 06', Date_Calc::DaysToDate(2454350, "%Y %m %d"), '2454350');
+compare(2454350, Date_Calc::DateToDays(6, 9, 2007), '2007 09 06');
+compare('2007 09 07', Date_Calc::DaysToDate(2454351, "%Y %m %d"), '2454351');
+compare(2454351, Date_Calc::DateToDays(7, 9, 2007), '2007 09 07');
+compare('2007 09 08', Date_Calc::DaysToDate(2454352, "%Y %m %d"), '2454352');
+compare(2454352, Date_Calc::DateToDays(8, 9, 2007), '2007 09 08');
+compare('2007 09 09', Date_Calc::DaysToDate(2454353, "%Y %m %d"), '2454353');
+compare(2454353, Date_Calc::DateToDays(9, 9, 2007), '2007 09 09');
+compare('2007 09 10', Date_Calc::DaysToDate(2454354, "%Y %m %d"), '2454354');
+compare(2454354, Date_Calc::DateToDays(10, 9, 2007), '2007 09 10');
+compare('2007 09 11', Date_Calc::DaysToDate(2454355, "%Y %m %d"), '2454355');
+compare(2454355, Date_Calc::DateToDays(11, 9, 2007), '2007 09 11');
+compare('2007 09 12', Date_Calc::DaysToDate(2454356, "%Y %m %d"), '2454356');
+compare(2454356, Date_Calc::DateToDays(12, 9, 2007), '2007 09 12');
+compare('2007 09 13', Date_Calc::DaysToDate(2454357, "%Y %m %d"), '2454357');
+compare(2454357, Date_Calc::DateToDays(13, 9, 2007), '2007 09 13');
+compare('2007 09 14', Date_Calc::DaysToDate(2454358, "%Y %m %d"), '2454358');
+compare(2454358, Date_Calc::DateToDays(14, 9, 2007), '2007 09 14');
+compare('2007 09 15', Date_Calc::DaysToDate(2454359, "%Y %m %d"), '2454359');
+compare(2454359, Date_Calc::DateToDays(15, 9, 2007), '2007 09 15');
+compare('2007 09 16', Date_Calc::DaysToDate(2454360, "%Y %m %d"), '2454360');
+compare(2454360, Date_Calc::DateToDays(16, 9, 2007), '2007 09 16');
+compare('2007 09 17', Date_Calc::DaysToDate(2454361, "%Y %m %d"), '2454361');
+compare(2454361, Date_Calc::DateToDays(17, 9, 2007), '2007 09 17');
+compare('2007 09 18', Date_Calc::DaysToDate(2454362, "%Y %m %d"), '2454362');
+compare(2454362, Date_Calc::DateToDays(18, 9, 2007), '2007 09 18');
+compare('2007 09 19', Date_Calc::DaysToDate(2454363, "%Y %m %d"), '2454363');
+compare(2454363, Date_Calc::DateToDays(19, 9, 2007), '2007 09 19');
+compare('2007 09 20', Date_Calc::DaysToDate(2454364, "%Y %m %d"), '2454364');
+compare(2454364, Date_Calc::DateToDays(20, 9, 2007), '2007 09 20');
+compare('2007 09 21', Date_Calc::DaysToDate(2454365, "%Y %m %d"), '2454365');
+compare(2454365, Date_Calc::DateToDays(21, 9, 2007), '2007 09 21');
+compare('2007 09 22', Date_Calc::DaysToDate(2454366, "%Y %m %d"), '2454366');
+compare(2454366, Date_Calc::DateToDays(22, 9, 2007), '2007 09 22');
+compare('2007 09 23', Date_Calc::DaysToDate(2454367, "%Y %m %d"), '2454367');
+compare(2454367, Date_Calc::DateToDays(23, 9, 2007), '2007 09 23');
+compare('2007 09 24', Date_Calc::DaysToDate(2454368, "%Y %m %d"), '2454368');
+compare(2454368, Date_Calc::DateToDays(24, 9, 2007), '2007 09 24');
+compare('2007 09 25', Date_Calc::DaysToDate(2454369, "%Y %m %d"), '2454369');
+compare(2454369, Date_Calc::DateToDays(25, 9, 2007), '2007 09 25');
+compare('2007 09 26', Date_Calc::DaysToDate(2454370, "%Y %m %d"), '2454370');
+compare(2454370, Date_Calc::DateToDays(26, 9, 2007), '2007 09 26');
+compare('2007 09 27', Date_Calc::DaysToDate(2454371, "%Y %m %d"), '2454371');
+compare(2454371, Date_Calc::DateToDays(27, 9, 2007), '2007 09 27');
+compare('2007 09 28', Date_Calc::DaysToDate(2454372, "%Y %m %d"), '2454372');
+compare(2454372, Date_Calc::DateToDays(28, 9, 2007), '2007 09 28');
+compare('2007 09 29', Date_Calc::DaysToDate(2454373, "%Y %m %d"), '2454373');
+compare(2454373, Date_Calc::DateToDays(29, 9, 2007), '2007 09 29');
+compare('2007 09 30', Date_Calc::DaysToDate(2454374, "%Y %m %d"), '2454374');
+compare(2454374, Date_Calc::DateToDays(30, 9, 2007), '2007 09 30');
+compare('2007 10 01', Date_Calc::DaysToDate(2454375, "%Y %m %d"), '2454375');
+compare(2454375, Date_Calc::DateToDays(1, 10, 2007), '2007 10 01');
+compare('2007 10 02', Date_Calc::DaysToDate(2454376, "%Y %m %d"), '2454376');
+compare(2454376, Date_Calc::DateToDays(2, 10, 2007), '2007 10 02');
+compare('2007 10 03', Date_Calc::DaysToDate(2454377, "%Y %m %d"), '2454377');
+compare(2454377, Date_Calc::DateToDays(3, 10, 2007), '2007 10 03');
+compare('2007 10 04', Date_Calc::DaysToDate(2454378, "%Y %m %d"), '2454378');
+compare(2454378, Date_Calc::DateToDays(4, 10, 2007), '2007 10 04');
+compare('2007 10 05', Date_Calc::DaysToDate(2454379, "%Y %m %d"), '2454379');
+compare(2454379, Date_Calc::DateToDays(5, 10, 2007), '2007 10 05');
+compare('2007 10 06', Date_Calc::DaysToDate(2454380, "%Y %m %d"), '2454380');
+compare(2454380, Date_Calc::DateToDays(6, 10, 2007), '2007 10 06');
+compare('2007 10 07', Date_Calc::DaysToDate(2454381, "%Y %m %d"), '2454381');
+compare(2454381, Date_Calc::DateToDays(7, 10, 2007), '2007 10 07');
+compare('2007 10 08', Date_Calc::DaysToDate(2454382, "%Y %m %d"), '2454382');
+compare(2454382, Date_Calc::DateToDays(8, 10, 2007), '2007 10 08');
+compare('2007 10 09', Date_Calc::DaysToDate(2454383, "%Y %m %d"), '2454383');
+compare(2454383, Date_Calc::DateToDays(9, 10, 2007), '2007 10 09');
+compare('2007 10 10', Date_Calc::DaysToDate(2454384, "%Y %m %d"), '2454384');
+compare(2454384, Date_Calc::DateToDays(10, 10, 2007), '2007 10 10');
+compare('2007 10 11', Date_Calc::DaysToDate(2454385, "%Y %m %d"), '2454385');
+compare(2454385, Date_Calc::DateToDays(11, 10, 2007), '2007 10 11');
+compare('2007 10 12', Date_Calc::DaysToDate(2454386, "%Y %m %d"), '2454386');
+compare(2454386, Date_Calc::DateToDays(12, 10, 2007), '2007 10 12');
+compare('2007 10 13', Date_Calc::DaysToDate(2454387, "%Y %m %d"), '2454387');
+compare(2454387, Date_Calc::DateToDays(13, 10, 2007), '2007 10 13');
+compare('2007 10 14', Date_Calc::DaysToDate(2454388, "%Y %m %d"), '2454388');
+compare(2454388, Date_Calc::DateToDays(14, 10, 2007), '2007 10 14');
+compare('2007 10 15', Date_Calc::DaysToDate(2454389, "%Y %m %d"), '2454389');
+compare(2454389, Date_Calc::DateToDays(15, 10, 2007), '2007 10 15');
+compare('2007 10 16', Date_Calc::DaysToDate(2454390, "%Y %m %d"), '2454390');
+compare(2454390, Date_Calc::DateToDays(16, 10, 2007), '2007 10 16');
+compare('2007 10 17', Date_Calc::DaysToDate(2454391, "%Y %m %d"), '2454391');
+compare(2454391, Date_Calc::DateToDays(17, 10, 2007), '2007 10 17');
+compare('2007 10 18', Date_Calc::DaysToDate(2454392, "%Y %m %d"), '2454392');
+compare(2454392, Date_Calc::DateToDays(18, 10, 2007), '2007 10 18');
+compare('2007 10 19', Date_Calc::DaysToDate(2454393, "%Y %m %d"), '2454393');
+compare(2454393, Date_Calc::DateToDays(19, 10, 2007), '2007 10 19');
+compare('2007 10 20', Date_Calc::DaysToDate(2454394, "%Y %m %d"), '2454394');
+compare(2454394, Date_Calc::DateToDays(20, 10, 2007), '2007 10 20');
+compare('2007 10 21', Date_Calc::DaysToDate(2454395, "%Y %m %d"), '2454395');
+compare(2454395, Date_Calc::DateToDays(21, 10, 2007), '2007 10 21');
+compare('2007 10 22', Date_Calc::DaysToDate(2454396, "%Y %m %d"), '2454396');
+compare(2454396, Date_Calc::DateToDays(22, 10, 2007), '2007 10 22');
+compare('2007 10 23', Date_Calc::DaysToDate(2454397, "%Y %m %d"), '2454397');
+compare(2454397, Date_Calc::DateToDays(23, 10, 2007), '2007 10 23');
+compare('2007 10 24', Date_Calc::DaysToDate(2454398, "%Y %m %d"), '2454398');
+compare(2454398, Date_Calc::DateToDays(24, 10, 2007), '2007 10 24');
+compare('2007 10 25', Date_Calc::DaysToDate(2454399, "%Y %m %d"), '2454399');
+compare(2454399, Date_Calc::DateToDays(25, 10, 2007), '2007 10 25');
+compare('2007 10 26', Date_Calc::DaysToDate(2454400, "%Y %m %d"), '2454400');
+compare(2454400, Date_Calc::DateToDays(26, 10, 2007), '2007 10 26');
+compare('2007 10 27', Date_Calc::DaysToDate(2454401, "%Y %m %d"), '2454401');
+compare(2454401, Date_Calc::DateToDays(27, 10, 2007), '2007 10 27');
+compare('2007 10 28', Date_Calc::DaysToDate(2454402, "%Y %m %d"), '2454402');
+compare(2454402, Date_Calc::DateToDays(28, 10, 2007), '2007 10 28');
+compare('2007 10 29', Date_Calc::DaysToDate(2454403, "%Y %m %d"), '2454403');
+compare(2454403, Date_Calc::DateToDays(29, 10, 2007), '2007 10 29');
+compare('2007 10 30', Date_Calc::DaysToDate(2454404, "%Y %m %d"), '2454404');
+compare(2454404, Date_Calc::DateToDays(30, 10, 2007), '2007 10 30');
+compare('2007 10 31', Date_Calc::DaysToDate(2454405, "%Y %m %d"), '2454405');
+compare(2454405, Date_Calc::DateToDays(31, 10, 2007), '2007 10 31');
+compare('2007 11 01', Date_Calc::DaysToDate(2454406, "%Y %m %d"), '2454406');
+compare(2454406, Date_Calc::DateToDays(1, 11, 2007), '2007 11 01');
+compare('2007 11 02', Date_Calc::DaysToDate(2454407, "%Y %m %d"), '2454407');
+compare(2454407, Date_Calc::DateToDays(2, 11, 2007), '2007 11 02');
+compare('2007 11 03', Date_Calc::DaysToDate(2454408, "%Y %m %d"), '2454408');
+compare(2454408, Date_Calc::DateToDays(3, 11, 2007), '2007 11 03');
+compare('2007 11 04', Date_Calc::DaysToDate(2454409, "%Y %m %d"), '2454409');
+compare(2454409, Date_Calc::DateToDays(4, 11, 2007), '2007 11 04');
+compare('2007 11 05', Date_Calc::DaysToDate(2454410, "%Y %m %d"), '2454410');
+compare(2454410, Date_Calc::DateToDays(5, 11, 2007), '2007 11 05');
+compare('2007 11 06', Date_Calc::DaysToDate(2454411, "%Y %m %d"), '2454411');
+compare(2454411, Date_Calc::DateToDays(6, 11, 2007), '2007 11 06');
+compare('2007 11 07', Date_Calc::DaysToDate(2454412, "%Y %m %d"), '2454412');
+compare(2454412, Date_Calc::DateToDays(7, 11, 2007), '2007 11 07');
+compare('2007 11 08', Date_Calc::DaysToDate(2454413, "%Y %m %d"), '2454413');
+compare(2454413, Date_Calc::DateToDays(8, 11, 2007), '2007 11 08');
+compare('2007 11 09', Date_Calc::DaysToDate(2454414, "%Y %m %d"), '2454414');
+compare(2454414, Date_Calc::DateToDays(9, 11, 2007), '2007 11 09');
+compare('2007 11 10', Date_Calc::DaysToDate(2454415, "%Y %m %d"), '2454415');
+compare(2454415, Date_Calc::DateToDays(10, 11, 2007), '2007 11 10');
+compare('2007 11 11', Date_Calc::DaysToDate(2454416, "%Y %m %d"), '2454416');
+compare(2454416, Date_Calc::DateToDays(11, 11, 2007), '2007 11 11');
+compare('2007 11 12', Date_Calc::DaysToDate(2454417, "%Y %m %d"), '2454417');
+compare(2454417, Date_Calc::DateToDays(12, 11, 2007), '2007 11 12');
+compare('2007 11 13', Date_Calc::DaysToDate(2454418, "%Y %m %d"), '2454418');
+compare(2454418, Date_Calc::DateToDays(13, 11, 2007), '2007 11 13');
+compare('2007 11 14', Date_Calc::DaysToDate(2454419, "%Y %m %d"), '2454419');
+compare(2454419, Date_Calc::DateToDays(14, 11, 2007), '2007 11 14');
+compare('2007 11 15', Date_Calc::DaysToDate(2454420, "%Y %m %d"), '2454420');
+compare(2454420, Date_Calc::DateToDays(15, 11, 2007), '2007 11 15');
+compare('2007 11 16', Date_Calc::DaysToDate(2454421, "%Y %m %d"), '2454421');
+compare(2454421, Date_Calc::DateToDays(16, 11, 2007), '2007 11 16');
+compare('2007 11 17', Date_Calc::DaysToDate(2454422, "%Y %m %d"), '2454422');
+compare(2454422, Date_Calc::DateToDays(17, 11, 2007), '2007 11 17');
+compare('2007 11 18', Date_Calc::DaysToDate(2454423, "%Y %m %d"), '2454423');
+compare(2454423, Date_Calc::DateToDays(18, 11, 2007), '2007 11 18');
+compare('2007 11 19', Date_Calc::DaysToDate(2454424, "%Y %m %d"), '2454424');
+compare(2454424, Date_Calc::DateToDays(19, 11, 2007), '2007 11 19');
+compare('2007 11 20', Date_Calc::DaysToDate(2454425, "%Y %m %d"), '2454425');
+compare(2454425, Date_Calc::DateToDays(20, 11, 2007), '2007 11 20');
+compare('2007 11 21', Date_Calc::DaysToDate(2454426, "%Y %m %d"), '2454426');
+compare(2454426, Date_Calc::DateToDays(21, 11, 2007), '2007 11 21');
+compare('2007 11 22', Date_Calc::DaysToDate(2454427, "%Y %m %d"), '2454427');
+compare(2454427, Date_Calc::DateToDays(22, 11, 2007), '2007 11 22');
+compare('2007 11 23', Date_Calc::DaysToDate(2454428, "%Y %m %d"), '2454428');
+compare(2454428, Date_Calc::DateToDays(23, 11, 2007), '2007 11 23');
+compare('2007 11 24', Date_Calc::DaysToDate(2454429, "%Y %m %d"), '2454429');
+compare(2454429, Date_Calc::DateToDays(24, 11, 2007), '2007 11 24');
+compare('2007 11 25', Date_Calc::DaysToDate(2454430, "%Y %m %d"), '2454430');
+compare(2454430, Date_Calc::DateToDays(25, 11, 2007), '2007 11 25');
+compare('2007 11 26', Date_Calc::DaysToDate(2454431, "%Y %m %d"), '2454431');
+compare(2454431, Date_Calc::DateToDays(26, 11, 2007), '2007 11 26');
+compare('2007 11 27', Date_Calc::DaysToDate(2454432, "%Y %m %d"), '2454432');
+compare(2454432, Date_Calc::DateToDays(27, 11, 2007), '2007 11 27');
+compare('2007 11 28', Date_Calc::DaysToDate(2454433, "%Y %m %d"), '2454433');
+compare(2454433, Date_Calc::DateToDays(28, 11, 2007), '2007 11 28');
+compare('2007 11 29', Date_Calc::DaysToDate(2454434, "%Y %m %d"), '2454434');
+compare(2454434, Date_Calc::DateToDays(29, 11, 2007), '2007 11 29');
+compare('2007 11 30', Date_Calc::DaysToDate(2454435, "%Y %m %d"), '2454435');
+compare(2454435, Date_Calc::DateToDays(30, 11, 2007), '2007 11 30');
+compare('2007 12 01', Date_Calc::DaysToDate(2454436, "%Y %m %d"), '2454436');
+compare(2454436, Date_Calc::DateToDays(1, 12, 2007), '2007 12 01');
+compare('2007 12 02', Date_Calc::DaysToDate(2454437, "%Y %m %d"), '2454437');
+compare(2454437, Date_Calc::DateToDays(2, 12, 2007), '2007 12 02');
+compare('2007 12 03', Date_Calc::DaysToDate(2454438, "%Y %m %d"), '2454438');
+compare(2454438, Date_Calc::DateToDays(3, 12, 2007), '2007 12 03');
+compare('2007 12 04', Date_Calc::DaysToDate(2454439, "%Y %m %d"), '2454439');
+compare(2454439, Date_Calc::DateToDays(4, 12, 2007), '2007 12 04');
+compare('2007 12 05', Date_Calc::DaysToDate(2454440, "%Y %m %d"), '2454440');
+compare(2454440, Date_Calc::DateToDays(5, 12, 2007), '2007 12 05');
+compare('2007 12 06', Date_Calc::DaysToDate(2454441, "%Y %m %d"), '2454441');
+compare(2454441, Date_Calc::DateToDays(6, 12, 2007), '2007 12 06');
+compare('2007 12 07', Date_Calc::DaysToDate(2454442, "%Y %m %d"), '2454442');
+compare(2454442, Date_Calc::DateToDays(7, 12, 2007), '2007 12 07');
+compare('2007 12 08', Date_Calc::DaysToDate(2454443, "%Y %m %d"), '2454443');
+compare(2454443, Date_Calc::DateToDays(8, 12, 2007), '2007 12 08');
+compare('2007 12 09', Date_Calc::DaysToDate(2454444, "%Y %m %d"), '2454444');
+compare(2454444, Date_Calc::DateToDays(9, 12, 2007), '2007 12 09');
+compare('2007 12 10', Date_Calc::DaysToDate(2454445, "%Y %m %d"), '2454445');
+compare(2454445, Date_Calc::DateToDays(10, 12, 2007), '2007 12 10');
+compare('2007 12 11', Date_Calc::DaysToDate(2454446, "%Y %m %d"), '2454446');
+compare(2454446, Date_Calc::DateToDays(11, 12, 2007), '2007 12 11');
+compare('2007 12 12', Date_Calc::DaysToDate(2454447, "%Y %m %d"), '2454447');
+compare(2454447, Date_Calc::DateToDays(12, 12, 2007), '2007 12 12');
+compare('2007 12 13', Date_Calc::DaysToDate(2454448, "%Y %m %d"), '2454448');
+compare(2454448, Date_Calc::DateToDays(13, 12, 2007), '2007 12 13');
+compare('2007 12 14', Date_Calc::DaysToDate(2454449, "%Y %m %d"), '2454449');
+compare(2454449, Date_Calc::DateToDays(14, 12, 2007), '2007 12 14');
+compare('2007 12 15', Date_Calc::DaysToDate(2454450, "%Y %m %d"), '2454450');
+compare(2454450, Date_Calc::DateToDays(15, 12, 2007), '2007 12 15');
+compare('2007 12 16', Date_Calc::DaysToDate(2454451, "%Y %m %d"), '2454451');
+compare(2454451, Date_Calc::DateToDays(16, 12, 2007), '2007 12 16');
+compare('2007 12 17', Date_Calc::DaysToDate(2454452, "%Y %m %d"), '2454452');
+compare(2454452, Date_Calc::DateToDays(17, 12, 2007), '2007 12 17');
+compare('2007 12 18', Date_Calc::DaysToDate(2454453, "%Y %m %d"), '2454453');
+compare(2454453, Date_Calc::DateToDays(18, 12, 2007), '2007 12 18');
+compare('2007 12 19', Date_Calc::DaysToDate(2454454, "%Y %m %d"), '2454454');
+compare(2454454, Date_Calc::DateToDays(19, 12, 2007), '2007 12 19');
+compare('2007 12 20', Date_Calc::DaysToDate(2454455, "%Y %m %d"), '2454455');
+compare(2454455, Date_Calc::DateToDays(20, 12, 2007), '2007 12 20');
+compare('2007 12 21', Date_Calc::DaysToDate(2454456, "%Y %m %d"), '2454456');
+compare(2454456, Date_Calc::DateToDays(21, 12, 2007), '2007 12 21');
+compare('2007 12 22', Date_Calc::DaysToDate(2454457, "%Y %m %d"), '2454457');
+compare(2454457, Date_Calc::DateToDays(22, 12, 2007), '2007 12 22');
+compare('2007 12 23', Date_Calc::DaysToDate(2454458, "%Y %m %d"), '2454458');
+compare(2454458, Date_Calc::DateToDays(23, 12, 2007), '2007 12 23');
+compare('2007 12 24', Date_Calc::DaysToDate(2454459, "%Y %m %d"), '2454459');
+compare(2454459, Date_Calc::DateToDays(24, 12, 2007), '2007 12 24');
+compare('2007 12 25', Date_Calc::DaysToDate(2454460, "%Y %m %d"), '2454460');
+compare(2454460, Date_Calc::DateToDays(25, 12, 2007), '2007 12 25');
+compare('2007 12 26', Date_Calc::DaysToDate(2454461, "%Y %m %d"), '2454461');
+compare(2454461, Date_Calc::DateToDays(26, 12, 2007), '2007 12 26');
+compare('2007 12 27', Date_Calc::DaysToDate(2454462, "%Y %m %d"), '2454462');
+compare(2454462, Date_Calc::DateToDays(27, 12, 2007), '2007 12 27');
+compare('2007 12 28', Date_Calc::DaysToDate(2454463, "%Y %m %d"), '2454463');
+compare(2454463, Date_Calc::DateToDays(28, 12, 2007), '2007 12 28');
+compare('2007 12 29', Date_Calc::DaysToDate(2454464, "%Y %m %d"), '2454464');
+compare(2454464, Date_Calc::DateToDays(29, 12, 2007), '2007 12 29');
+compare('2007 12 30', Date_Calc::DaysToDate(2454465, "%Y %m %d"), '2454465');
+compare(2454465, Date_Calc::DateToDays(30, 12, 2007), '2007 12 30');
+compare('2007 12 31', Date_Calc::DaysToDate(2454466, "%Y %m %d"), '2454466');
+compare(2454466, Date_Calc::DateToDays(31, 12, 2007), '2007 12 31');
+compare('2008 01 01', Date_Calc::DaysToDate(2454467, "%Y %m %d"), '2454467');
+compare(2454467, Date_Calc::DateToDays(1, 1, 2008), '2008 01 01');
+compare('2008 01 02', Date_Calc::DaysToDate(2454468, "%Y %m %d"), '2454468');
+compare(2454468, Date_Calc::DateToDays(2, 1, 2008), '2008 01 02');
+compare('2008 01 03', Date_Calc::DaysToDate(2454469, "%Y %m %d"), '2454469');
+compare(2454469, Date_Calc::DateToDays(3, 1, 2008), '2008 01 03');
+compare('2008 01 04', Date_Calc::DaysToDate(2454470, "%Y %m %d"), '2454470');
+compare(2454470, Date_Calc::DateToDays(4, 1, 2008), '2008 01 04');
+compare('2008 01 05', Date_Calc::DaysToDate(2454471, "%Y %m %d"), '2454471');
+compare(2454471, Date_Calc::DateToDays(5, 1, 2008), '2008 01 05');
+compare('2008 01 06', Date_Calc::DaysToDate(2454472, "%Y %m %d"), '2454472');
+compare(2454472, Date_Calc::DateToDays(6, 1, 2008), '2008 01 06');
+compare('2008 01 07', Date_Calc::DaysToDate(2454473, "%Y %m %d"), '2454473');
+compare(2454473, Date_Calc::DateToDays(7, 1, 2008), '2008 01 07');
+compare('2008 01 08', Date_Calc::DaysToDate(2454474, "%Y %m %d"), '2454474');
+compare(2454474, Date_Calc::DateToDays(8, 1, 2008), '2008 01 08');
+compare('2008 01 09', Date_Calc::DaysToDate(2454475, "%Y %m %d"), '2454475');
+compare(2454475, Date_Calc::DateToDays(9, 1, 2008), '2008 01 09');
+compare('2008 01 10', Date_Calc::DaysToDate(2454476, "%Y %m %d"), '2454476');
+compare(2454476, Date_Calc::DateToDays(10, 1, 2008), '2008 01 10');
+compare('2008 01 11', Date_Calc::DaysToDate(2454477, "%Y %m %d"), '2454477');
+compare(2454477, Date_Calc::DateToDays(11, 1, 2008), '2008 01 11');
+compare('2008 01 12', Date_Calc::DaysToDate(2454478, "%Y %m %d"), '2454478');
+compare(2454478, Date_Calc::DateToDays(12, 1, 2008), '2008 01 12');
+compare('2008 01 13', Date_Calc::DaysToDate(2454479, "%Y %m %d"), '2454479');
+compare(2454479, Date_Calc::DateToDays(13, 1, 2008), '2008 01 13');
+compare('2008 01 14', Date_Calc::DaysToDate(2454480, "%Y %m %d"), '2454480');
+compare(2454480, Date_Calc::DateToDays(14, 1, 2008), '2008 01 14');
+compare('2008 01 15', Date_Calc::DaysToDate(2454481, "%Y %m %d"), '2454481');
+compare(2454481, Date_Calc::DateToDays(15, 1, 2008), '2008 01 15');
+compare('2008 01 16', Date_Calc::DaysToDate(2454482, "%Y %m %d"), '2454482');
+compare(2454482, Date_Calc::DateToDays(16, 1, 2008), '2008 01 16');
+compare('2008 01 17', Date_Calc::DaysToDate(2454483, "%Y %m %d"), '2454483');
+compare(2454483, Date_Calc::DateToDays(17, 1, 2008), '2008 01 17');
+compare('2008 01 18', Date_Calc::DaysToDate(2454484, "%Y %m %d"), '2454484');
+compare(2454484, Date_Calc::DateToDays(18, 1, 2008), '2008 01 18');
+compare('2008 01 19', Date_Calc::DaysToDate(2454485, "%Y %m %d"), '2454485');
+compare(2454485, Date_Calc::DateToDays(19, 1, 2008), '2008 01 19');
+compare('2008 01 20', Date_Calc::DaysToDate(2454486, "%Y %m %d"), '2454486');
+compare(2454486, Date_Calc::DateToDays(20, 1, 2008), '2008 01 20');
+compare('2008 01 21', Date_Calc::DaysToDate(2454487, "%Y %m %d"), '2454487');
+compare(2454487, Date_Calc::DateToDays(21, 1, 2008), '2008 01 21');
+compare('2008 01 22', Date_Calc::DaysToDate(2454488, "%Y %m %d"), '2454488');
+compare(2454488, Date_Calc::DateToDays(22, 1, 2008), '2008 01 22');
+compare('2008 01 23', Date_Calc::DaysToDate(2454489, "%Y %m %d"), '2454489');
+compare(2454489, Date_Calc::DateToDays(23, 1, 2008), '2008 01 23');
+compare('2008 01 24', Date_Calc::DaysToDate(2454490, "%Y %m %d"), '2454490');
+compare(2454490, Date_Calc::DateToDays(24, 1, 2008), '2008 01 24');
+compare('2008 01 25', Date_Calc::DaysToDate(2454491, "%Y %m %d"), '2454491');
+compare(2454491, Date_Calc::DateToDays(25, 1, 2008), '2008 01 25');
+compare('2008 01 26', Date_Calc::DaysToDate(2454492, "%Y %m %d"), '2454492');
+compare(2454492, Date_Calc::DateToDays(26, 1, 2008), '2008 01 26');
+compare('2008 01 27', Date_Calc::DaysToDate(2454493, "%Y %m %d"), '2454493');
+compare(2454493, Date_Calc::DateToDays(27, 1, 2008), '2008 01 27');
+compare('2008 01 28', Date_Calc::DaysToDate(2454494, "%Y %m %d"), '2454494');
+compare(2454494, Date_Calc::DateToDays(28, 1, 2008), '2008 01 28');
+compare('2008 01 29', Date_Calc::DaysToDate(2454495, "%Y %m %d"), '2454495');
+compare(2454495, Date_Calc::DateToDays(29, 1, 2008), '2008 01 29');
+compare('2008 01 30', Date_Calc::DaysToDate(2454496, "%Y %m %d"), '2454496');
+compare(2454496, Date_Calc::DateToDays(30, 1, 2008), '2008 01 30');
+compare('2008 01 31', Date_Calc::DaysToDate(2454497, "%Y %m %d"), '2454497');
+compare(2454497, Date_Calc::DateToDays(31, 1, 2008), '2008 01 31');
+compare('2008 02 01', Date_Calc::DaysToDate(2454498, "%Y %m %d"), '2454498');
+compare(2454498, Date_Calc::DateToDays(1, 2, 2008), '2008 02 01');
+compare('2008 02 02', Date_Calc::DaysToDate(2454499, "%Y %m %d"), '2454499');
+compare(2454499, Date_Calc::DateToDays(2, 2, 2008), '2008 02 02');
+compare('2008 02 03', Date_Calc::DaysToDate(2454500, "%Y %m %d"), '2454500');
+compare(2454500, Date_Calc::DateToDays(3, 2, 2008), '2008 02 03');
+compare('2008 02 04', Date_Calc::DaysToDate(2454501, "%Y %m %d"), '2454501');
+compare(2454501, Date_Calc::DateToDays(4, 2, 2008), '2008 02 04');
+compare('2008 02 05', Date_Calc::DaysToDate(2454502, "%Y %m %d"), '2454502');
+compare(2454502, Date_Calc::DateToDays(5, 2, 2008), '2008 02 05');
+compare('2008 02 06', Date_Calc::DaysToDate(2454503, "%Y %m %d"), '2454503');
+compare(2454503, Date_Calc::DateToDays(6, 2, 2008), '2008 02 06');
+compare('2008 02 07', Date_Calc::DaysToDate(2454504, "%Y %m %d"), '2454504');
+compare(2454504, Date_Calc::DateToDays(7, 2, 2008), '2008 02 07');
+compare('2008 02 08', Date_Calc::DaysToDate(2454505, "%Y %m %d"), '2454505');
+compare(2454505, Date_Calc::DateToDays(8, 2, 2008), '2008 02 08');
+compare('2008 02 09', Date_Calc::DaysToDate(2454506, "%Y %m %d"), '2454506');
+compare(2454506, Date_Calc::DateToDays(9, 2, 2008), '2008 02 09');
+compare('2008 02 10', Date_Calc::DaysToDate(2454507, "%Y %m %d"), '2454507');
+compare(2454507, Date_Calc::DateToDays(10, 2, 2008), '2008 02 10');
+compare('2008 02 11', Date_Calc::DaysToDate(2454508, "%Y %m %d"), '2454508');
+compare(2454508, Date_Calc::DateToDays(11, 2, 2008), '2008 02 11');
+compare('2008 02 12', Date_Calc::DaysToDate(2454509, "%Y %m %d"), '2454509');
+compare(2454509, Date_Calc::DateToDays(12, 2, 2008), '2008 02 12');
+compare('2008 02 13', Date_Calc::DaysToDate(2454510, "%Y %m %d"), '2454510');
+compare(2454510, Date_Calc::DateToDays(13, 2, 2008), '2008 02 13');
+compare('2008 02 14', Date_Calc::DaysToDate(2454511, "%Y %m %d"), '2454511');
+compare(2454511, Date_Calc::DateToDays(14, 2, 2008), '2008 02 14');
+compare('2008 02 15', Date_Calc::DaysToDate(2454512, "%Y %m %d"), '2454512');
+compare(2454512, Date_Calc::DateToDays(15, 2, 2008), '2008 02 15');
+compare('2008 02 16', Date_Calc::DaysToDate(2454513, "%Y %m %d"), '2454513');
+compare(2454513, Date_Calc::DateToDays(16, 2, 2008), '2008 02 16');
+compare('2008 02 17', Date_Calc::DaysToDate(2454514, "%Y %m %d"), '2454514');
+compare(2454514, Date_Calc::DateToDays(17, 2, 2008), '2008 02 17');
+compare('2008 02 18', Date_Calc::DaysToDate(2454515, "%Y %m %d"), '2454515');
+compare(2454515, Date_Calc::DateToDays(18, 2, 2008), '2008 02 18');
+compare('2008 02 19', Date_Calc::DaysToDate(2454516, "%Y %m %d"), '2454516');
+compare(2454516, Date_Calc::DateToDays(19, 2, 2008), '2008 02 19');
+compare('2008 02 20', Date_Calc::DaysToDate(2454517, "%Y %m %d"), '2454517');
+compare(2454517, Date_Calc::DateToDays(20, 2, 2008), '2008 02 20');
+compare('2008 02 21', Date_Calc::DaysToDate(2454518, "%Y %m %d"), '2454518');
+compare(2454518, Date_Calc::DateToDays(21, 2, 2008), '2008 02 21');
+compare('2008 02 22', Date_Calc::DaysToDate(2454519, "%Y %m %d"), '2454519');
+compare(2454519, Date_Calc::DateToDays(22, 2, 2008), '2008 02 22');
+compare('2008 02 23', Date_Calc::DaysToDate(2454520, "%Y %m %d"), '2454520');
+compare(2454520, Date_Calc::DateToDays(23, 2, 2008), '2008 02 23');
+compare('2008 02 24', Date_Calc::DaysToDate(2454521, "%Y %m %d"), '2454521');
+compare(2454521, Date_Calc::DateToDays(24, 2, 2008), '2008 02 24');
+compare('2008 02 25', Date_Calc::DaysToDate(2454522, "%Y %m %d"), '2454522');
+compare(2454522, Date_Calc::DateToDays(25, 2, 2008), '2008 02 25');
+compare('2008 02 26', Date_Calc::DaysToDate(2454523, "%Y %m %d"), '2454523');
+compare(2454523, Date_Calc::DateToDays(26, 2, 2008), '2008 02 26');
+compare('2008 02 27', Date_Calc::DaysToDate(2454524, "%Y %m %d"), '2454524');
+compare(2454524, Date_Calc::DateToDays(27, 2, 2008), '2008 02 27');
+compare('2008 02 28', Date_Calc::DaysToDate(2454525, "%Y %m %d"), '2454525');
+compare(2454525, Date_Calc::DateToDays(28, 2, 2008), '2008 02 28');
+compare('2008 02 29', Date_Calc::DaysToDate(2454526, "%Y %m %d"), '2454526');
+compare(2454526, Date_Calc::DateToDays(29, 2, 2008), '2008 02 29');
+compare('2008 03 01', Date_Calc::DaysToDate(2454527, "%Y %m %d"), '2454527');
+compare(2454527, Date_Calc::DateToDays(1, 3, 2008), '2008 03 01');
+compare('2008 03 02', Date_Calc::DaysToDate(2454528, "%Y %m %d"), '2454528');
+compare(2454528, Date_Calc::DateToDays(2, 3, 2008), '2008 03 02');
+compare('2008 03 03', Date_Calc::DaysToDate(2454529, "%Y %m %d"), '2454529');
+compare(2454529, Date_Calc::DateToDays(3, 3, 2008), '2008 03 03');
+compare('2008 03 04', Date_Calc::DaysToDate(2454530, "%Y %m %d"), '2454530');
+compare(2454530, Date_Calc::DateToDays(4, 3, 2008), '2008 03 04');
+compare('2008 03 05', Date_Calc::DaysToDate(2454531, "%Y %m %d"), '2454531');
+compare(2454531, Date_Calc::DateToDays(5, 3, 2008), '2008 03 05');
+compare('2008 03 06', Date_Calc::DaysToDate(2454532, "%Y %m %d"), '2454532');
+compare(2454532, Date_Calc::DateToDays(6, 3, 2008), '2008 03 06');
+compare('2008 03 07', Date_Calc::DaysToDate(2454533, "%Y %m %d"), '2454533');
+compare(2454533, Date_Calc::DateToDays(7, 3, 2008), '2008 03 07');
+compare('2008 03 08', Date_Calc::DaysToDate(2454534, "%Y %m %d"), '2454534');
+compare(2454534, Date_Calc::DateToDays(8, 3, 2008), '2008 03 08');
+compare('2008 03 09', Date_Calc::DaysToDate(2454535, "%Y %m %d"), '2454535');
+compare(2454535, Date_Calc::DateToDays(9, 3, 2008), '2008 03 09');
+compare('2008 03 10', Date_Calc::DaysToDate(2454536, "%Y %m %d"), '2454536');
+compare(2454536, Date_Calc::DateToDays(10, 3, 2008), '2008 03 10');
+compare('2008 03 11', Date_Calc::DaysToDate(2454537, "%Y %m %d"), '2454537');
+compare(2454537, Date_Calc::DateToDays(11, 3, 2008), '2008 03 11');
+compare('2008 03 12', Date_Calc::DaysToDate(2454538, "%Y %m %d"), '2454538');
+compare(2454538, Date_Calc::DateToDays(12, 3, 2008), '2008 03 12');
+compare('2008 03 13', Date_Calc::DaysToDate(2454539, "%Y %m %d"), '2454539');
+compare(2454539, Date_Calc::DateToDays(13, 3, 2008), '2008 03 13');
+compare('2008 03 14', Date_Calc::DaysToDate(2454540, "%Y %m %d"), '2454540');
+compare(2454540, Date_Calc::DateToDays(14, 3, 2008), '2008 03 14');
+compare('2008 03 15', Date_Calc::DaysToDate(2454541, "%Y %m %d"), '2454541');
+compare(2454541, Date_Calc::DateToDays(15, 3, 2008), '2008 03 15');
+compare('2008 03 16', Date_Calc::DaysToDate(2454542, "%Y %m %d"), '2454542');
+compare(2454542, Date_Calc::DateToDays(16, 3, 2008), '2008 03 16');
+compare('2008 03 17', Date_Calc::DaysToDate(2454543, "%Y %m %d"), '2454543');
+compare(2454543, Date_Calc::DateToDays(17, 3, 2008), '2008 03 17');
+compare('2008 03 18', Date_Calc::DaysToDate(2454544, "%Y %m %d"), '2454544');
+compare(2454544, Date_Calc::DateToDays(18, 3, 2008), '2008 03 18');
+compare('2008 03 19', Date_Calc::DaysToDate(2454545, "%Y %m %d"), '2454545');
+compare(2454545, Date_Calc::DateToDays(19, 3, 2008), '2008 03 19');
+compare('2008 03 20', Date_Calc::DaysToDate(2454546, "%Y %m %d"), '2454546');
+compare(2454546, Date_Calc::DateToDays(20, 3, 2008), '2008 03 20');
+compare('2008 03 21', Date_Calc::DaysToDate(2454547, "%Y %m %d"), '2454547');
+compare(2454547, Date_Calc::DateToDays(21, 3, 2008), '2008 03 21');
+compare('2008 03 22', Date_Calc::DaysToDate(2454548, "%Y %m %d"), '2454548');
+compare(2454548, Date_Calc::DateToDays(22, 3, 2008), '2008 03 22');
+compare('2008 03 23', Date_Calc::DaysToDate(2454549, "%Y %m %d"), '2454549');
+compare(2454549, Date_Calc::DateToDays(23, 3, 2008), '2008 03 23');
+compare('2008 03 24', Date_Calc::DaysToDate(2454550, "%Y %m %d"), '2454550');
+compare(2454550, Date_Calc::DateToDays(24, 3, 2008), '2008 03 24');
+compare('2008 03 25', Date_Calc::DaysToDate(2454551, "%Y %m %d"), '2454551');
+compare(2454551, Date_Calc::DateToDays(25, 3, 2008), '2008 03 25');
+compare('2008 03 26', Date_Calc::DaysToDate(2454552, "%Y %m %d"), '2454552');
+compare(2454552, Date_Calc::DateToDays(26, 3, 2008), '2008 03 26');
+compare('2008 03 27', Date_Calc::DaysToDate(2454553, "%Y %m %d"), '2454553');
+compare(2454553, Date_Calc::DateToDays(27, 3, 2008), '2008 03 27');
+compare('2008 03 28', Date_Calc::DaysToDate(2454554, "%Y %m %d"), '2454554');
+compare(2454554, Date_Calc::DateToDays(28, 3, 2008), '2008 03 28');
+compare('2008 03 29', Date_Calc::DaysToDate(2454555, "%Y %m %d"), '2454555');
+compare(2454555, Date_Calc::DateToDays(29, 3, 2008), '2008 03 29');
+compare('2008 03 30', Date_Calc::DaysToDate(2454556, "%Y %m %d"), '2454556');
+compare(2454556, Date_Calc::DateToDays(30, 3, 2008), '2008 03 30');
+compare('2008 03 31', Date_Calc::DaysToDate(2454557, "%Y %m %d"), '2454557');
+compare(2454557, Date_Calc::DateToDays(31, 3, 2008), '2008 03 31');
+compare('2008 04 01', Date_Calc::DaysToDate(2454558, "%Y %m %d"), '2454558');
+compare(2454558, Date_Calc::DateToDays(1, 4, 2008), '2008 04 01');
+compare('2008 04 02', Date_Calc::DaysToDate(2454559, "%Y %m %d"), '2454559');
+compare(2454559, Date_Calc::DateToDays(2, 4, 2008), '2008 04 02');
+compare('2008 04 03', Date_Calc::DaysToDate(2454560, "%Y %m %d"), '2454560');
+compare(2454560, Date_Calc::DateToDays(3, 4, 2008), '2008 04 03');
+compare('2008 04 04', Date_Calc::DaysToDate(2454561, "%Y %m %d"), '2454561');
+compare(2454561, Date_Calc::DateToDays(4, 4, 2008), '2008 04 04');
+compare('2008 04 05', Date_Calc::DaysToDate(2454562, "%Y %m %d"), '2454562');
+compare(2454562, Date_Calc::DateToDays(5, 4, 2008), '2008 04 05');
+compare('2008 04 06', Date_Calc::DaysToDate(2454563, "%Y %m %d"), '2454563');
+compare(2454563, Date_Calc::DateToDays(6, 4, 2008), '2008 04 06');
+compare('2008 04 07', Date_Calc::DaysToDate(2454564, "%Y %m %d"), '2454564');
+compare(2454564, Date_Calc::DateToDays(7, 4, 2008), '2008 04 07');
+compare('2008 04 08', Date_Calc::DaysToDate(2454565, "%Y %m %d"), '2454565');
+compare(2454565, Date_Calc::DateToDays(8, 4, 2008), '2008 04 08');
+compare('2008 04 09', Date_Calc::DaysToDate(2454566, "%Y %m %d"), '2454566');
+compare(2454566, Date_Calc::DateToDays(9, 4, 2008), '2008 04 09');
+compare('2008 04 10', Date_Calc::DaysToDate(2454567, "%Y %m %d"), '2454567');
+compare(2454567, Date_Calc::DateToDays(10, 4, 2008), '2008 04 10');
+compare('2008 04 11', Date_Calc::DaysToDate(2454568, "%Y %m %d"), '2454568');
+compare(2454568, Date_Calc::DateToDays(11, 4, 2008), '2008 04 11');
+compare('2008 04 12', Date_Calc::DaysToDate(2454569, "%Y %m %d"), '2454569');
+compare(2454569, Date_Calc::DateToDays(12, 4, 2008), '2008 04 12');
+compare('2008 04 13', Date_Calc::DaysToDate(2454570, "%Y %m %d"), '2454570');
+compare(2454570, Date_Calc::DateToDays(13, 4, 2008), '2008 04 13');
+compare('2008 04 14', Date_Calc::DaysToDate(2454571, "%Y %m %d"), '2454571');
+compare(2454571, Date_Calc::DateToDays(14, 4, 2008), '2008 04 14');
+compare('2008 04 15', Date_Calc::DaysToDate(2454572, "%Y %m %d"), '2454572');
+compare(2454572, Date_Calc::DateToDays(15, 4, 2008), '2008 04 15');
+compare('2008 04 16', Date_Calc::DaysToDate(2454573, "%Y %m %d"), '2454573');
+compare(2454573, Date_Calc::DateToDays(16, 4, 2008), '2008 04 16');
+compare('2008 04 17', Date_Calc::DaysToDate(2454574, "%Y %m %d"), '2454574');
+compare(2454574, Date_Calc::DateToDays(17, 4, 2008), '2008 04 17');
+compare('2008 04 18', Date_Calc::DaysToDate(2454575, "%Y %m %d"), '2454575');
+compare(2454575, Date_Calc::DateToDays(18, 4, 2008), '2008 04 18');
+compare('2008 04 19', Date_Calc::DaysToDate(2454576, "%Y %m %d"), '2454576');
+compare(2454576, Date_Calc::DateToDays(19, 4, 2008), '2008 04 19');
+compare('2008 04 20', Date_Calc::DaysToDate(2454577, "%Y %m %d"), '2454577');
+compare(2454577, Date_Calc::DateToDays(20, 4, 2008), '2008 04 20');
+compare('2008 04 21', Date_Calc::DaysToDate(2454578, "%Y %m %d"), '2454578');
+compare(2454578, Date_Calc::DateToDays(21, 4, 2008), '2008 04 21');
+compare('2008 04 22', Date_Calc::DaysToDate(2454579, "%Y %m %d"), '2454579');
+compare(2454579, Date_Calc::DateToDays(22, 4, 2008), '2008 04 22');
+compare('2008 04 23', Date_Calc::DaysToDate(2454580, "%Y %m %d"), '2454580');
+compare(2454580, Date_Calc::DateToDays(23, 4, 2008), '2008 04 23');
+compare('2008 04 24', Date_Calc::DaysToDate(2454581, "%Y %m %d"), '2454581');
+compare(2454581, Date_Calc::DateToDays(24, 4, 2008), '2008 04 24');
+compare('2008 04 25', Date_Calc::DaysToDate(2454582, "%Y %m %d"), '2454582');
+compare(2454582, Date_Calc::DateToDays(25, 4, 2008), '2008 04 25');
+compare('2008 04 26', Date_Calc::DaysToDate(2454583, "%Y %m %d"), '2454583');
+compare(2454583, Date_Calc::DateToDays(26, 4, 2008), '2008 04 26');
+compare('2008 04 27', Date_Calc::DaysToDate(2454584, "%Y %m %d"), '2454584');
+compare(2454584, Date_Calc::DateToDays(27, 4, 2008), '2008 04 27');
+compare('2008 04 28', Date_Calc::DaysToDate(2454585, "%Y %m %d"), '2454585');
+compare(2454585, Date_Calc::DateToDays(28, 4, 2008), '2008 04 28');
+compare('2008 04 29', Date_Calc::DaysToDate(2454586, "%Y %m %d"), '2454586');
+compare(2454586, Date_Calc::DateToDays(29, 4, 2008), '2008 04 29');
+compare('2008 04 30', Date_Calc::DaysToDate(2454587, "%Y %m %d"), '2454587');
+compare(2454587, Date_Calc::DateToDays(30, 4, 2008), '2008 04 30');
+compare('2008 05 01', Date_Calc::DaysToDate(2454588, "%Y %m %d"), '2454588');
+compare(2454588, Date_Calc::DateToDays(1, 5, 2008), '2008 05 01');
+compare('2008 05 02', Date_Calc::DaysToDate(2454589, "%Y %m %d"), '2454589');
+compare(2454589, Date_Calc::DateToDays(2, 5, 2008), '2008 05 02');
+compare('2008 05 03', Date_Calc::DaysToDate(2454590, "%Y %m %d"), '2454590');
+compare(2454590, Date_Calc::DateToDays(3, 5, 2008), '2008 05 03');
+compare('2008 05 04', Date_Calc::DaysToDate(2454591, "%Y %m %d"), '2454591');
+compare(2454591, Date_Calc::DateToDays(4, 5, 2008), '2008 05 04');
+compare('2008 05 05', Date_Calc::DaysToDate(2454592, "%Y %m %d"), '2454592');
+compare(2454592, Date_Calc::DateToDays(5, 5, 2008), '2008 05 05');
+compare('2008 05 06', Date_Calc::DaysToDate(2454593, "%Y %m %d"), '2454593');
+compare(2454593, Date_Calc::DateToDays(6, 5, 2008), '2008 05 06');
+compare('2008 05 07', Date_Calc::DaysToDate(2454594, "%Y %m %d"), '2454594');
+compare(2454594, Date_Calc::DateToDays(7, 5, 2008), '2008 05 07');
+compare('2008 05 08', Date_Calc::DaysToDate(2454595, "%Y %m %d"), '2454595');
+compare(2454595, Date_Calc::DateToDays(8, 5, 2008), '2008 05 08');
+compare('2008 05 09', Date_Calc::DaysToDate(2454596, "%Y %m %d"), '2454596');
+compare(2454596, Date_Calc::DateToDays(9, 5, 2008), '2008 05 09');
+compare('2008 05 10', Date_Calc::DaysToDate(2454597, "%Y %m %d"), '2454597');
+compare(2454597, Date_Calc::DateToDays(10, 5, 2008), '2008 05 10');
+compare('2008 05 11', Date_Calc::DaysToDate(2454598, "%Y %m %d"), '2454598');
+compare(2454598, Date_Calc::DateToDays(11, 5, 2008), '2008 05 11');
+compare('2008 05 12', Date_Calc::DaysToDate(2454599, "%Y %m %d"), '2454599');
+compare(2454599, Date_Calc::DateToDays(12, 5, 2008), '2008 05 12');
+compare('2008 05 13', Date_Calc::DaysToDate(2454600, "%Y %m %d"), '2454600');
+compare(2454600, Date_Calc::DateToDays(13, 5, 2008), '2008 05 13');
+compare('2008 05 14', Date_Calc::DaysToDate(2454601, "%Y %m %d"), '2454601');
+compare(2454601, Date_Calc::DateToDays(14, 5, 2008), '2008 05 14');
+compare('2008 05 15', Date_Calc::DaysToDate(2454602, "%Y %m %d"), '2454602');
+compare(2454602, Date_Calc::DateToDays(15, 5, 2008), '2008 05 15');
+compare('2008 05 16', Date_Calc::DaysToDate(2454603, "%Y %m %d"), '2454603');
+compare(2454603, Date_Calc::DateToDays(16, 5, 2008), '2008 05 16');
+compare('2008 05 17', Date_Calc::DaysToDate(2454604, "%Y %m %d"), '2454604');
+compare(2454604, Date_Calc::DateToDays(17, 5, 2008), '2008 05 17');
+compare('2008 05 18', Date_Calc::DaysToDate(2454605, "%Y %m %d"), '2454605');
+compare(2454605, Date_Calc::DateToDays(18, 5, 2008), '2008 05 18');
+compare('2008 05 19', Date_Calc::DaysToDate(2454606, "%Y %m %d"), '2454606');
+compare(2454606, Date_Calc::DateToDays(19, 5, 2008), '2008 05 19');
+compare('2008 05 20', Date_Calc::DaysToDate(2454607, "%Y %m %d"), '2454607');
+compare(2454607, Date_Calc::DateToDays(20, 5, 2008), '2008 05 20');
+compare('2008 05 21', Date_Calc::DaysToDate(2454608, "%Y %m %d"), '2454608');
+compare(2454608, Date_Calc::DateToDays(21, 5, 2008), '2008 05 21');
+compare('2008 05 22', Date_Calc::DaysToDate(2454609, "%Y %m %d"), '2454609');
+compare(2454609, Date_Calc::DateToDays(22, 5, 2008), '2008 05 22');
+compare('2008 05 23', Date_Calc::DaysToDate(2454610, "%Y %m %d"), '2454610');
+compare(2454610, Date_Calc::DateToDays(23, 5, 2008), '2008 05 23');
+compare('2008 05 24', Date_Calc::DaysToDate(2454611, "%Y %m %d"), '2454611');
+compare(2454611, Date_Calc::DateToDays(24, 5, 2008), '2008 05 24');
+compare('2008 05 25', Date_Calc::DaysToDate(2454612, "%Y %m %d"), '2454612');
+compare(2454612, Date_Calc::DateToDays(25, 5, 2008), '2008 05 25');
+compare('2008 05 26', Date_Calc::DaysToDate(2454613, "%Y %m %d"), '2454613');
+compare(2454613, Date_Calc::DateToDays(26, 5, 2008), '2008 05 26');
+compare('2008 05 27', Date_Calc::DaysToDate(2454614, "%Y %m %d"), '2454614');
+compare(2454614, Date_Calc::DateToDays(27, 5, 2008), '2008 05 27');
+compare('2008 05 28', Date_Calc::DaysToDate(2454615, "%Y %m %d"), '2454615');
+compare(2454615, Date_Calc::DateToDays(28, 5, 2008), '2008 05 28');
+compare('2008 05 29', Date_Calc::DaysToDate(2454616, "%Y %m %d"), '2454616');
+compare(2454616, Date_Calc::DateToDays(29, 5, 2008), '2008 05 29');
+compare('2008 05 30', Date_Calc::DaysToDate(2454617, "%Y %m %d"), '2454617');
+compare(2454617, Date_Calc::DateToDays(30, 5, 2008), '2008 05 30');
+compare('2008 05 31', Date_Calc::DaysToDate(2454618, "%Y %m %d"), '2454618');
+compare(2454618, Date_Calc::DateToDays(31, 5, 2008), '2008 05 31');
+compare('2008 06 01', Date_Calc::DaysToDate(2454619, "%Y %m %d"), '2454619');
+compare(2454619, Date_Calc::DateToDays(1, 6, 2008), '2008 06 01');
+compare('2008 06 02', Date_Calc::DaysToDate(2454620, "%Y %m %d"), '2454620');
+compare(2454620, Date_Calc::DateToDays(2, 6, 2008), '2008 06 02');
+compare('2008 06 03', Date_Calc::DaysToDate(2454621, "%Y %m %d"), '2454621');
+compare(2454621, Date_Calc::DateToDays(3, 6, 2008), '2008 06 03');
+compare('2008 06 04', Date_Calc::DaysToDate(2454622, "%Y %m %d"), '2454622');
+compare(2454622, Date_Calc::DateToDays(4, 6, 2008), '2008 06 04');
+compare('2008 06 05', Date_Calc::DaysToDate(2454623, "%Y %m %d"), '2454623');
+compare(2454623, Date_Calc::DateToDays(5, 6, 2008), '2008 06 05');
+compare('2008 06 06', Date_Calc::DaysToDate(2454624, "%Y %m %d"), '2454624');
+compare(2454624, Date_Calc::DateToDays(6, 6, 2008), '2008 06 06');
+compare('2008 06 07', Date_Calc::DaysToDate(2454625, "%Y %m %d"), '2454625');
+compare(2454625, Date_Calc::DateToDays(7, 6, 2008), '2008 06 07');
+compare('2008 06 08', Date_Calc::DaysToDate(2454626, "%Y %m %d"), '2454626');
+compare(2454626, Date_Calc::DateToDays(8, 6, 2008), '2008 06 08');
+compare('2008 06 09', Date_Calc::DaysToDate(2454627, "%Y %m %d"), '2454627');
+compare(2454627, Date_Calc::DateToDays(9, 6, 2008), '2008 06 09');
+compare('2008 06 10', Date_Calc::DaysToDate(2454628, "%Y %m %d"), '2454628');
+compare(2454628, Date_Calc::DateToDays(10, 6, 2008), '2008 06 10');
+compare('2008 06 11', Date_Calc::DaysToDate(2454629, "%Y %m %d"), '2454629');
+compare(2454629, Date_Calc::DateToDays(11, 6, 2008), '2008 06 11');
+compare('2008 06 12', Date_Calc::DaysToDate(2454630, "%Y %m %d"), '2454630');
+compare(2454630, Date_Calc::DateToDays(12, 6, 2008), '2008 06 12');
+compare('2008 06 13', Date_Calc::DaysToDate(2454631, "%Y %m %d"), '2454631');
+compare(2454631, Date_Calc::DateToDays(13, 6, 2008), '2008 06 13');
+compare('2008 06 14', Date_Calc::DaysToDate(2454632, "%Y %m %d"), '2454632');
+compare(2454632, Date_Calc::DateToDays(14, 6, 2008), '2008 06 14');
+compare('2008 06 15', Date_Calc::DaysToDate(2454633, "%Y %m %d"), '2454633');
+compare(2454633, Date_Calc::DateToDays(15, 6, 2008), '2008 06 15');
+compare('2008 06 16', Date_Calc::DaysToDate(2454634, "%Y %m %d"), '2454634');
+compare(2454634, Date_Calc::DateToDays(16, 6, 2008), '2008 06 16');
+compare('2008 06 17', Date_Calc::DaysToDate(2454635, "%Y %m %d"), '2454635');
+compare(2454635, Date_Calc::DateToDays(17, 6, 2008), '2008 06 17');
+compare('2008 06 18', Date_Calc::DaysToDate(2454636, "%Y %m %d"), '2454636');
+compare(2454636, Date_Calc::DateToDays(18, 6, 2008), '2008 06 18');
+compare('2008 06 19', Date_Calc::DaysToDate(2454637, "%Y %m %d"), '2454637');
+compare(2454637, Date_Calc::DateToDays(19, 6, 2008), '2008 06 19');
+compare('2008 06 20', Date_Calc::DaysToDate(2454638, "%Y %m %d"), '2454638');
+compare(2454638, Date_Calc::DateToDays(20, 6, 2008), '2008 06 20');
+compare('2008 06 21', Date_Calc::DaysToDate(2454639, "%Y %m %d"), '2454639');
+compare(2454639, Date_Calc::DateToDays(21, 6, 2008), '2008 06 21');
+compare('2008 06 22', Date_Calc::DaysToDate(2454640, "%Y %m %d"), '2454640');
+compare(2454640, Date_Calc::DateToDays(22, 6, 2008), '2008 06 22');
+compare('2008 06 23', Date_Calc::DaysToDate(2454641, "%Y %m %d"), '2454641');
+compare(2454641, Date_Calc::DateToDays(23, 6, 2008), '2008 06 23');
+compare('2008 06 24', Date_Calc::DaysToDate(2454642, "%Y %m %d"), '2454642');
+compare(2454642, Date_Calc::DateToDays(24, 6, 2008), '2008 06 24');
+compare('2008 06 25', Date_Calc::DaysToDate(2454643, "%Y %m %d"), '2454643');
+compare(2454643, Date_Calc::DateToDays(25, 6, 2008), '2008 06 25');
+compare('2008 06 26', Date_Calc::DaysToDate(2454644, "%Y %m %d"), '2454644');
+compare(2454644, Date_Calc::DateToDays(26, 6, 2008), '2008 06 26');
+compare('2008 06 27', Date_Calc::DaysToDate(2454645, "%Y %m %d"), '2454645');
+compare(2454645, Date_Calc::DateToDays(27, 6, 2008), '2008 06 27');
+compare('2008 06 28', Date_Calc::DaysToDate(2454646, "%Y %m %d"), '2454646');
+compare(2454646, Date_Calc::DateToDays(28, 6, 2008), '2008 06 28');
+compare('2008 06 29', Date_Calc::DaysToDate(2454647, "%Y %m %d"), '2454647');
+compare(2454647, Date_Calc::DateToDays(29, 6, 2008), '2008 06 29');
+compare('2008 06 30', Date_Calc::DaysToDate(2454648, "%Y %m %d"), '2454648');
+compare(2454648, Date_Calc::DateToDays(30, 6, 2008), '2008 06 30');
+compare('2008 07 01', Date_Calc::DaysToDate(2454649, "%Y %m %d"), '2454649');
+compare(2454649, Date_Calc::DateToDays(1, 7, 2008), '2008 07 01');
+compare('2008 07 02', Date_Calc::DaysToDate(2454650, "%Y %m %d"), '2454650');
+compare(2454650, Date_Calc::DateToDays(2, 7, 2008), '2008 07 02');
+compare('2008 07 03', Date_Calc::DaysToDate(2454651, "%Y %m %d"), '2454651');
+compare(2454651, Date_Calc::DateToDays(3, 7, 2008), '2008 07 03');
+compare('2008 07 04', Date_Calc::DaysToDate(2454652, "%Y %m %d"), '2454652');
+compare(2454652, Date_Calc::DateToDays(4, 7, 2008), '2008 07 04');
+compare('2008 07 05', Date_Calc::DaysToDate(2454653, "%Y %m %d"), '2454653');
+compare(2454653, Date_Calc::DateToDays(5, 7, 2008), '2008 07 05');
+compare('2008 07 06', Date_Calc::DaysToDate(2454654, "%Y %m %d"), '2454654');
+compare(2454654, Date_Calc::DateToDays(6, 7, 2008), '2008 07 06');
+compare('2008 07 07', Date_Calc::DaysToDate(2454655, "%Y %m %d"), '2454655');
+compare(2454655, Date_Calc::DateToDays(7, 7, 2008), '2008 07 07');
+compare('2008 07 08', Date_Calc::DaysToDate(2454656, "%Y %m %d"), '2454656');
+compare(2454656, Date_Calc::DateToDays(8, 7, 2008), '2008 07 08');
+compare('2008 07 09', Date_Calc::DaysToDate(2454657, "%Y %m %d"), '2454657');
+compare(2454657, Date_Calc::DateToDays(9, 7, 2008), '2008 07 09');
+compare('2008 07 10', Date_Calc::DaysToDate(2454658, "%Y %m %d"), '2454658');
+compare(2454658, Date_Calc::DateToDays(10, 7, 2008), '2008 07 10');
+compare('2008 07 11', Date_Calc::DaysToDate(2454659, "%Y %m %d"), '2454659');
+compare(2454659, Date_Calc::DateToDays(11, 7, 2008), '2008 07 11');
+compare('2008 07 12', Date_Calc::DaysToDate(2454660, "%Y %m %d"), '2454660');
+compare(2454660, Date_Calc::DateToDays(12, 7, 2008), '2008 07 12');
+compare('2008 07 13', Date_Calc::DaysToDate(2454661, "%Y %m %d"), '2454661');
+compare(2454661, Date_Calc::DateToDays(13, 7, 2008), '2008 07 13');
+compare('2008 07 14', Date_Calc::DaysToDate(2454662, "%Y %m %d"), '2454662');
+compare(2454662, Date_Calc::DateToDays(14, 7, 2008), '2008 07 14');
+compare('2008 07 15', Date_Calc::DaysToDate(2454663, "%Y %m %d"), '2454663');
+compare(2454663, Date_Calc::DateToDays(15, 7, 2008), '2008 07 15');
+compare('2008 07 16', Date_Calc::DaysToDate(2454664, "%Y %m %d"), '2454664');
+compare(2454664, Date_Calc::DateToDays(16, 7, 2008), '2008 07 16');
+compare('2008 07 17', Date_Calc::DaysToDate(2454665, "%Y %m %d"), '2454665');
+compare(2454665, Date_Calc::DateToDays(17, 7, 2008), '2008 07 17');
+compare('2008 07 18', Date_Calc::DaysToDate(2454666, "%Y %m %d"), '2454666');
+compare(2454666, Date_Calc::DateToDays(18, 7, 2008), '2008 07 18');
+compare('2008 07 19', Date_Calc::DaysToDate(2454667, "%Y %m %d"), '2454667');
+compare(2454667, Date_Calc::DateToDays(19, 7, 2008), '2008 07 19');
+compare('2008 07 20', Date_Calc::DaysToDate(2454668, "%Y %m %d"), '2454668');
+compare(2454668, Date_Calc::DateToDays(20, 7, 2008), '2008 07 20');
+compare('2008 07 21', Date_Calc::DaysToDate(2454669, "%Y %m %d"), '2454669');
+compare(2454669, Date_Calc::DateToDays(21, 7, 2008), '2008 07 21');
+compare('2008 07 22', Date_Calc::DaysToDate(2454670, "%Y %m %d"), '2454670');
+compare(2454670, Date_Calc::DateToDays(22, 7, 2008), '2008 07 22');
+compare('2008 07 23', Date_Calc::DaysToDate(2454671, "%Y %m %d"), '2454671');
+compare(2454671, Date_Calc::DateToDays(23, 7, 2008), '2008 07 23');
+compare('2008 07 24', Date_Calc::DaysToDate(2454672, "%Y %m %d"), '2454672');
+compare(2454672, Date_Calc::DateToDays(24, 7, 2008), '2008 07 24');
+compare('2008 07 25', Date_Calc::DaysToDate(2454673, "%Y %m %d"), '2454673');
+compare(2454673, Date_Calc::DateToDays(25, 7, 2008), '2008 07 25');
+compare('2008 07 26', Date_Calc::DaysToDate(2454674, "%Y %m %d"), '2454674');
+compare(2454674, Date_Calc::DateToDays(26, 7, 2008), '2008 07 26');
+compare('2008 07 27', Date_Calc::DaysToDate(2454675, "%Y %m %d"), '2454675');
+compare(2454675, Date_Calc::DateToDays(27, 7, 2008), '2008 07 27');
+compare('2008 07 28', Date_Calc::DaysToDate(2454676, "%Y %m %d"), '2454676');
+compare(2454676, Date_Calc::DateToDays(28, 7, 2008), '2008 07 28');
+compare('2008 07 29', Date_Calc::DaysToDate(2454677, "%Y %m %d"), '2454677');
+compare(2454677, Date_Calc::DateToDays(29, 7, 2008), '2008 07 29');
+compare('2008 07 30', Date_Calc::DaysToDate(2454678, "%Y %m %d"), '2454678');
+compare(2454678, Date_Calc::DateToDays(30, 7, 2008), '2008 07 30');
+compare('2008 07 31', Date_Calc::DaysToDate(2454679, "%Y %m %d"), '2454679');
+compare(2454679, Date_Calc::DateToDays(31, 7, 2008), '2008 07 31');
+compare('2008 08 01', Date_Calc::DaysToDate(2454680, "%Y %m %d"), '2454680');
+compare(2454680, Date_Calc::DateToDays(1, 8, 2008), '2008 08 01');
+compare('2008 08 02', Date_Calc::DaysToDate(2454681, "%Y %m %d"), '2454681');
+compare(2454681, Date_Calc::DateToDays(2, 8, 2008), '2008 08 02');
+compare('2008 08 03', Date_Calc::DaysToDate(2454682, "%Y %m %d"), '2454682');
+compare(2454682, Date_Calc::DateToDays(3, 8, 2008), '2008 08 03');
+compare('2008 08 04', Date_Calc::DaysToDate(2454683, "%Y %m %d"), '2454683');
+compare(2454683, Date_Calc::DateToDays(4, 8, 2008), '2008 08 04');
+compare('2008 08 05', Date_Calc::DaysToDate(2454684, "%Y %m %d"), '2454684');
+compare(2454684, Date_Calc::DateToDays(5, 8, 2008), '2008 08 05');
+compare('2008 08 06', Date_Calc::DaysToDate(2454685, "%Y %m %d"), '2454685');
+compare(2454685, Date_Calc::DateToDays(6, 8, 2008), '2008 08 06');
+compare('2008 08 07', Date_Calc::DaysToDate(2454686, "%Y %m %d"), '2454686');
+compare(2454686, Date_Calc::DateToDays(7, 8, 2008), '2008 08 07');
+compare('2008 08 08', Date_Calc::DaysToDate(2454687, "%Y %m %d"), '2454687');
+compare(2454687, Date_Calc::DateToDays(8, 8, 2008), '2008 08 08');
+compare('2008 08 09', Date_Calc::DaysToDate(2454688, "%Y %m %d"), '2454688');
+compare(2454688, Date_Calc::DateToDays(9, 8, 2008), '2008 08 09');
+compare('2008 08 10', Date_Calc::DaysToDate(2454689, "%Y %m %d"), '2454689');
+compare(2454689, Date_Calc::DateToDays(10, 8, 2008), '2008 08 10');
+compare('2008 08 11', Date_Calc::DaysToDate(2454690, "%Y %m %d"), '2454690');
+compare(2454690, Date_Calc::DateToDays(11, 8, 2008), '2008 08 11');
+compare('2008 08 12', Date_Calc::DaysToDate(2454691, "%Y %m %d"), '2454691');
+compare(2454691, Date_Calc::DateToDays(12, 8, 2008), '2008 08 12');
+compare('2008 08 13', Date_Calc::DaysToDate(2454692, "%Y %m %d"), '2454692');
+compare(2454692, Date_Calc::DateToDays(13, 8, 2008), '2008 08 13');
+compare('2008 08 14', Date_Calc::DaysToDate(2454693, "%Y %m %d"), '2454693');
+compare(2454693, Date_Calc::DateToDays(14, 8, 2008), '2008 08 14');
+compare('2008 08 15', Date_Calc::DaysToDate(2454694, "%Y %m %d"), '2454694');
+compare(2454694, Date_Calc::DateToDays(15, 8, 2008), '2008 08 15');
+compare('2008 08 16', Date_Calc::DaysToDate(2454695, "%Y %m %d"), '2454695');
+compare(2454695, Date_Calc::DateToDays(16, 8, 2008), '2008 08 16');
+compare('2008 08 17', Date_Calc::DaysToDate(2454696, "%Y %m %d"), '2454696');
+compare(2454696, Date_Calc::DateToDays(17, 8, 2008), '2008 08 17');
+compare('2008 08 18', Date_Calc::DaysToDate(2454697, "%Y %m %d"), '2454697');
+compare(2454697, Date_Calc::DateToDays(18, 8, 2008), '2008 08 18');
+compare('2008 08 19', Date_Calc::DaysToDate(2454698, "%Y %m %d"), '2454698');
+compare(2454698, Date_Calc::DateToDays(19, 8, 2008), '2008 08 19');
+compare('2008 08 20', Date_Calc::DaysToDate(2454699, "%Y %m %d"), '2454699');
+compare(2454699, Date_Calc::DateToDays(20, 8, 2008), '2008 08 20');
+compare('2008 08 21', Date_Calc::DaysToDate(2454700, "%Y %m %d"), '2454700');
+compare(2454700, Date_Calc::DateToDays(21, 8, 2008), '2008 08 21');
+compare('2008 08 22', Date_Calc::DaysToDate(2454701, "%Y %m %d"), '2454701');
+compare(2454701, Date_Calc::DateToDays(22, 8, 2008), '2008 08 22');
+compare('2008 08 23', Date_Calc::DaysToDate(2454702, "%Y %m %d"), '2454702');
+compare(2454702, Date_Calc::DateToDays(23, 8, 2008), '2008 08 23');
+compare('2008 08 24', Date_Calc::DaysToDate(2454703, "%Y %m %d"), '2454703');
+compare(2454703, Date_Calc::DateToDays(24, 8, 2008), '2008 08 24');
+compare('2008 08 25', Date_Calc::DaysToDate(2454704, "%Y %m %d"), '2454704');
+compare(2454704, Date_Calc::DateToDays(25, 8, 2008), '2008 08 25');
+compare('2008 08 26', Date_Calc::DaysToDate(2454705, "%Y %m %d"), '2454705');
+compare(2454705, Date_Calc::DateToDays(26, 8, 2008), '2008 08 26');
+compare('2008 08 27', Date_Calc::DaysToDate(2454706, "%Y %m %d"), '2454706');
+compare(2454706, Date_Calc::DateToDays(27, 8, 2008), '2008 08 27');
+compare('2008 08 28', Date_Calc::DaysToDate(2454707, "%Y %m %d"), '2454707');
+compare(2454707, Date_Calc::DateToDays(28, 8, 2008), '2008 08 28');
+compare('2008 08 29', Date_Calc::DaysToDate(2454708, "%Y %m %d"), '2454708');
+compare(2454708, Date_Calc::DateToDays(29, 8, 2008), '2008 08 29');
+compare('2008 08 30', Date_Calc::DaysToDate(2454709, "%Y %m %d"), '2454709');
+compare(2454709, Date_Calc::DateToDays(30, 8, 2008), '2008 08 30');
+compare('2008 08 31', Date_Calc::DaysToDate(2454710, "%Y %m %d"), '2454710');
+compare(2454710, Date_Calc::DateToDays(31, 8, 2008), '2008 08 31');
+compare('2008 09 01', Date_Calc::DaysToDate(2454711, "%Y %m %d"), '2454711');
+compare(2454711, Date_Calc::DateToDays(1, 9, 2008), '2008 09 01');
+compare('2008 09 02', Date_Calc::DaysToDate(2454712, "%Y %m %d"), '2454712');
+compare(2454712, Date_Calc::DateToDays(2, 9, 2008), '2008 09 02');
+compare('2008 09 03', Date_Calc::DaysToDate(2454713, "%Y %m %d"), '2454713');
+compare(2454713, Date_Calc::DateToDays(3, 9, 2008), '2008 09 03');
+compare('2008 09 04', Date_Calc::DaysToDate(2454714, "%Y %m %d"), '2454714');
+compare(2454714, Date_Calc::DateToDays(4, 9, 2008), '2008 09 04');
+compare('2008 09 05', Date_Calc::DaysToDate(2454715, "%Y %m %d"), '2454715');
+compare(2454715, Date_Calc::DateToDays(5, 9, 2008), '2008 09 05');
+compare('2008 09 06', Date_Calc::DaysToDate(2454716, "%Y %m %d"), '2454716');
+compare(2454716, Date_Calc::DateToDays(6, 9, 2008), '2008 09 06');
+compare('2008 09 07', Date_Calc::DaysToDate(2454717, "%Y %m %d"), '2454717');
+compare(2454717, Date_Calc::DateToDays(7, 9, 2008), '2008 09 07');
+compare('2008 09 08', Date_Calc::DaysToDate(2454718, "%Y %m %d"), '2454718');
+compare(2454718, Date_Calc::DateToDays(8, 9, 2008), '2008 09 08');
+compare('2008 09 09', Date_Calc::DaysToDate(2454719, "%Y %m %d"), '2454719');
+compare(2454719, Date_Calc::DateToDays(9, 9, 2008), '2008 09 09');
+compare('2008 09 10', Date_Calc::DaysToDate(2454720, "%Y %m %d"), '2454720');
+compare(2454720, Date_Calc::DateToDays(10, 9, 2008), '2008 09 10');
+compare('2008 09 11', Date_Calc::DaysToDate(2454721, "%Y %m %d"), '2454721');
+compare(2454721, Date_Calc::DateToDays(11, 9, 2008), '2008 09 11');
+compare('2008 09 12', Date_Calc::DaysToDate(2454722, "%Y %m %d"), '2454722');
+compare(2454722, Date_Calc::DateToDays(12, 9, 2008), '2008 09 12');
+compare('2008 09 13', Date_Calc::DaysToDate(2454723, "%Y %m %d"), '2454723');
+compare(2454723, Date_Calc::DateToDays(13, 9, 2008), '2008 09 13');
+compare('2008 09 14', Date_Calc::DaysToDate(2454724, "%Y %m %d"), '2454724');
+compare(2454724, Date_Calc::DateToDays(14, 9, 2008), '2008 09 14');
+compare('2008 09 15', Date_Calc::DaysToDate(2454725, "%Y %m %d"), '2454725');
+compare(2454725, Date_Calc::DateToDays(15, 9, 2008), '2008 09 15');
+compare('2008 09 16', Date_Calc::DaysToDate(2454726, "%Y %m %d"), '2454726');
+compare(2454726, Date_Calc::DateToDays(16, 9, 2008), '2008 09 16');
+compare('2008 09 17', Date_Calc::DaysToDate(2454727, "%Y %m %d"), '2454727');
+compare(2454727, Date_Calc::DateToDays(17, 9, 2008), '2008 09 17');
+compare('2008 09 18', Date_Calc::DaysToDate(2454728, "%Y %m %d"), '2454728');
+compare(2454728, Date_Calc::DateToDays(18, 9, 2008), '2008 09 18');
+compare('2008 09 19', Date_Calc::DaysToDate(2454729, "%Y %m %d"), '2454729');
+compare(2454729, Date_Calc::DateToDays(19, 9, 2008), '2008 09 19');
+compare('2008 09 20', Date_Calc::DaysToDate(2454730, "%Y %m %d"), '2454730');
+compare(2454730, Date_Calc::DateToDays(20, 9, 2008), '2008 09 20');
+compare('2008 09 21', Date_Calc::DaysToDate(2454731, "%Y %m %d"), '2454731');
+compare(2454731, Date_Calc::DateToDays(21, 9, 2008), '2008 09 21');
+compare('2008 09 22', Date_Calc::DaysToDate(2454732, "%Y %m %d"), '2454732');
+compare(2454732, Date_Calc::DateToDays(22, 9, 2008), '2008 09 22');
+compare('2008 09 23', Date_Calc::DaysToDate(2454733, "%Y %m %d"), '2454733');
+compare(2454733, Date_Calc::DateToDays(23, 9, 2008), '2008 09 23');
+compare('2008 09 24', Date_Calc::DaysToDate(2454734, "%Y %m %d"), '2454734');
+compare(2454734, Date_Calc::DateToDays(24, 9, 2008), '2008 09 24');
+compare('2008 09 25', Date_Calc::DaysToDate(2454735, "%Y %m %d"), '2454735');
+compare(2454735, Date_Calc::DateToDays(25, 9, 2008), '2008 09 25');
+compare('2008 09 26', Date_Calc::DaysToDate(2454736, "%Y %m %d"), '2454736');
+compare(2454736, Date_Calc::DateToDays(26, 9, 2008), '2008 09 26');
+compare('2008 09 27', Date_Calc::DaysToDate(2454737, "%Y %m %d"), '2454737');
+compare(2454737, Date_Calc::DateToDays(27, 9, 2008), '2008 09 27');
+compare('2008 09 28', Date_Calc::DaysToDate(2454738, "%Y %m %d"), '2454738');
+compare(2454738, Date_Calc::DateToDays(28, 9, 2008), '2008 09 28');
+compare('2008 09 29', Date_Calc::DaysToDate(2454739, "%Y %m %d"), '2454739');
+compare(2454739, Date_Calc::DateToDays(29, 9, 2008), '2008 09 29');
+compare('2008 09 30', Date_Calc::DaysToDate(2454740, "%Y %m %d"), '2454740');
+compare(2454740, Date_Calc::DateToDays(30, 9, 2008), '2008 09 30');
+compare('2008 10 01', Date_Calc::DaysToDate(2454741, "%Y %m %d"), '2454741');
+compare(2454741, Date_Calc::DateToDays(1, 10, 2008), '2008 10 01');
+compare('2008 10 02', Date_Calc::DaysToDate(2454742, "%Y %m %d"), '2454742');
+compare(2454742, Date_Calc::DateToDays(2, 10, 2008), '2008 10 02');
+compare('2008 10 03', Date_Calc::DaysToDate(2454743, "%Y %m %d"), '2454743');
+compare(2454743, Date_Calc::DateToDays(3, 10, 2008), '2008 10 03');
+compare('2008 10 04', Date_Calc::DaysToDate(2454744, "%Y %m %d"), '2454744');
+compare(2454744, Date_Calc::DateToDays(4, 10, 2008), '2008 10 04');
+compare('2008 10 05', Date_Calc::DaysToDate(2454745, "%Y %m %d"), '2454745');
+compare(2454745, Date_Calc::DateToDays(5, 10, 2008), '2008 10 05');
+compare('2008 10 06', Date_Calc::DaysToDate(2454746, "%Y %m %d"), '2454746');
+compare(2454746, Date_Calc::DateToDays(6, 10, 2008), '2008 10 06');
+compare('2008 10 07', Date_Calc::DaysToDate(2454747, "%Y %m %d"), '2454747');
+compare(2454747, Date_Calc::DateToDays(7, 10, 2008), '2008 10 07');
+compare('2008 10 08', Date_Calc::DaysToDate(2454748, "%Y %m %d"), '2454748');
+compare(2454748, Date_Calc::DateToDays(8, 10, 2008), '2008 10 08');
+compare('2008 10 09', Date_Calc::DaysToDate(2454749, "%Y %m %d"), '2454749');
+compare(2454749, Date_Calc::DateToDays(9, 10, 2008), '2008 10 09');
+compare('2008 10 10', Date_Calc::DaysToDate(2454750, "%Y %m %d"), '2454750');
+compare(2454750, Date_Calc::DateToDays(10, 10, 2008), '2008 10 10');
+compare('2008 10 11', Date_Calc::DaysToDate(2454751, "%Y %m %d"), '2454751');
+compare(2454751, Date_Calc::DateToDays(11, 10, 2008), '2008 10 11');
+compare('2008 10 12', Date_Calc::DaysToDate(2454752, "%Y %m %d"), '2454752');
+compare(2454752, Date_Calc::DateToDays(12, 10, 2008), '2008 10 12');
+compare('2008 10 13', Date_Calc::DaysToDate(2454753, "%Y %m %d"), '2454753');
+compare(2454753, Date_Calc::DateToDays(13, 10, 2008), '2008 10 13');
+compare('2008 10 14', Date_Calc::DaysToDate(2454754, "%Y %m %d"), '2454754');
+compare(2454754, Date_Calc::DateToDays(14, 10, 2008), '2008 10 14');
+compare('2008 10 15', Date_Calc::DaysToDate(2454755, "%Y %m %d"), '2454755');
+compare(2454755, Date_Calc::DateToDays(15, 10, 2008), '2008 10 15');
+compare('2008 10 16', Date_Calc::DaysToDate(2454756, "%Y %m %d"), '2454756');
+compare(2454756, Date_Calc::DateToDays(16, 10, 2008), '2008 10 16');
+compare('2008 10 17', Date_Calc::DaysToDate(2454757, "%Y %m %d"), '2454757');
+compare(2454757, Date_Calc::DateToDays(17, 10, 2008), '2008 10 17');
+compare('2008 10 18', Date_Calc::DaysToDate(2454758, "%Y %m %d"), '2454758');
+compare(2454758, Date_Calc::DateToDays(18, 10, 2008), '2008 10 18');
+compare('2008 10 19', Date_Calc::DaysToDate(2454759, "%Y %m %d"), '2454759');
+compare(2454759, Date_Calc::DateToDays(19, 10, 2008), '2008 10 19');
+compare('2008 10 20', Date_Calc::DaysToDate(2454760, "%Y %m %d"), '2454760');
+compare(2454760, Date_Calc::DateToDays(20, 10, 2008), '2008 10 20');
+compare('2008 10 21', Date_Calc::DaysToDate(2454761, "%Y %m %d"), '2454761');
+compare(2454761, Date_Calc::DateToDays(21, 10, 2008), '2008 10 21');
+compare('2008 10 22', Date_Calc::DaysToDate(2454762, "%Y %m %d"), '2454762');
+compare(2454762, Date_Calc::DateToDays(22, 10, 2008), '2008 10 22');
+compare('2008 10 23', Date_Calc::DaysToDate(2454763, "%Y %m %d"), '2454763');
+compare(2454763, Date_Calc::DateToDays(23, 10, 2008), '2008 10 23');
+compare('2008 10 24', Date_Calc::DaysToDate(2454764, "%Y %m %d"), '2454764');
+compare(2454764, Date_Calc::DateToDays(24, 10, 2008), '2008 10 24');
+compare('2008 10 25', Date_Calc::DaysToDate(2454765, "%Y %m %d"), '2454765');
+compare(2454765, Date_Calc::DateToDays(25, 10, 2008), '2008 10 25');
+compare('2008 10 26', Date_Calc::DaysToDate(2454766, "%Y %m %d"), '2454766');
+compare(2454766, Date_Calc::DateToDays(26, 10, 2008), '2008 10 26');
+compare('2008 10 27', Date_Calc::DaysToDate(2454767, "%Y %m %d"), '2454767');
+compare(2454767, Date_Calc::DateToDays(27, 10, 2008), '2008 10 27');
+compare('2008 10 28', Date_Calc::DaysToDate(2454768, "%Y %m %d"), '2454768');
+compare(2454768, Date_Calc::DateToDays(28, 10, 2008), '2008 10 28');
+compare('2008 10 29', Date_Calc::DaysToDate(2454769, "%Y %m %d"), '2454769');
+compare(2454769, Date_Calc::DateToDays(29, 10, 2008), '2008 10 29');
+compare('2008 10 30', Date_Calc::DaysToDate(2454770, "%Y %m %d"), '2454770');
+compare(2454770, Date_Calc::DateToDays(30, 10, 2008), '2008 10 30');
+compare('2008 10 31', Date_Calc::DaysToDate(2454771, "%Y %m %d"), '2454771');
+compare(2454771, Date_Calc::DateToDays(31, 10, 2008), '2008 10 31');
+compare('2008 11 01', Date_Calc::DaysToDate(2454772, "%Y %m %d"), '2454772');
+compare(2454772, Date_Calc::DateToDays(1, 11, 2008), '2008 11 01');
+compare('2008 11 02', Date_Calc::DaysToDate(2454773, "%Y %m %d"), '2454773');
+compare(2454773, Date_Calc::DateToDays(2, 11, 2008), '2008 11 02');
+compare('2008 11 03', Date_Calc::DaysToDate(2454774, "%Y %m %d"), '2454774');
+compare(2454774, Date_Calc::DateToDays(3, 11, 2008), '2008 11 03');
+compare('2008 11 04', Date_Calc::DaysToDate(2454775, "%Y %m %d"), '2454775');
+compare(2454775, Date_Calc::DateToDays(4, 11, 2008), '2008 11 04');
+compare('2008 11 05', Date_Calc::DaysToDate(2454776, "%Y %m %d"), '2454776');
+compare(2454776, Date_Calc::DateToDays(5, 11, 2008), '2008 11 05');
+compare('2008 11 06', Date_Calc::DaysToDate(2454777, "%Y %m %d"), '2454777');
+compare(2454777, Date_Calc::DateToDays(6, 11, 2008), '2008 11 06');
+compare('2008 11 07', Date_Calc::DaysToDate(2454778, "%Y %m %d"), '2454778');
+compare(2454778, Date_Calc::DateToDays(7, 11, 2008), '2008 11 07');
+
+compare('-0002 12 31', Date_Calc::DaysToDate(1720694, "%Y %m %d"), '1720694');
+compare(1720694, Date_Calc::DateToDays(31, 12, -2), '-0002 12 31');
+compare('-0001 01 01', Date_Calc::DaysToDate(1720695, "%Y %m %d"), '1720695');
+compare(1720695, Date_Calc::DateToDays(1, 1, -1), '-0001 01 01');
+compare('-0001 01 02', Date_Calc::DaysToDate(1720696, "%Y %m %d"), '1720696');
+compare(1720696, Date_Calc::DateToDays(2, 1, -1), '-0001 01 02');
+compare('-0001 01 03', Date_Calc::DaysToDate(1720697, "%Y %m %d"), '1720697');
+compare(1720697, Date_Calc::DateToDays(3, 1, -1), '-0001 01 03');
+compare('-0001 01 04', Date_Calc::DaysToDate(1720698, "%Y %m %d"), '1720698');
+compare(1720698, Date_Calc::DateToDays(4, 1, -1), '-0001 01 04');
+compare('-0001 01 05', Date_Calc::DaysToDate(1720699, "%Y %m %d"), '1720699');
+compare(1720699, Date_Calc::DateToDays(5, 1, -1), '-0001 01 05');
+compare('-0001 01 06', Date_Calc::DaysToDate(1720700, "%Y %m %d"), '1720700');
+compare(1720700, Date_Calc::DateToDays(6, 1, -1), '-0001 01 06');
+compare('-0001 01 07', Date_Calc::DaysToDate(1720701, "%Y %m %d"), '1720701');
+compare(1720701, Date_Calc::DateToDays(7, 1, -1), '-0001 01 07');
+compare('-0001 01 08', Date_Calc::DaysToDate(1720702, "%Y %m %d"), '1720702');
+compare(1720702, Date_Calc::DateToDays(8, 1, -1), '-0001 01 08');
+compare('-0001 01 09', Date_Calc::DaysToDate(1720703, "%Y %m %d"), '1720703');
+compare(1720703, Date_Calc::DateToDays(9, 1, -1), '-0001 01 09');
+compare('-0001 01 10', Date_Calc::DaysToDate(1720704, "%Y %m %d"), '1720704');
+compare(1720704, Date_Calc::DateToDays(10, 1, -1), '-0001 01 10');
+compare('-0001 01 11', Date_Calc::DaysToDate(1720705, "%Y %m %d"), '1720705');
+compare(1720705, Date_Calc::DateToDays(11, 1, -1), '-0001 01 11');
+compare('-0001 01 12', Date_Calc::DaysToDate(1720706, "%Y %m %d"), '1720706');
+compare(1720706, Date_Calc::DateToDays(12, 1, -1), '-0001 01 12');
+compare('-0001 01 13', Date_Calc::DaysToDate(1720707, "%Y %m %d"), '1720707');
+compare(1720707, Date_Calc::DateToDays(13, 1, -1), '-0001 01 13');
+compare('-0001 01 14', Date_Calc::DaysToDate(1720708, "%Y %m %d"), '1720708');
+compare(1720708, Date_Calc::DateToDays(14, 1, -1), '-0001 01 14');
+compare('-0001 01 15', Date_Calc::DaysToDate(1720709, "%Y %m %d"), '1720709');
+compare(1720709, Date_Calc::DateToDays(15, 1, -1), '-0001 01 15');
+compare('-0001 01 16', Date_Calc::DaysToDate(1720710, "%Y %m %d"), '1720710');
+compare(1720710, Date_Calc::DateToDays(16, 1, -1), '-0001 01 16');
+compare('-0001 01 17', Date_Calc::DaysToDate(1720711, "%Y %m %d"), '1720711');
+compare(1720711, Date_Calc::DateToDays(17, 1, -1), '-0001 01 17');
+compare('-0001 01 18', Date_Calc::DaysToDate(1720712, "%Y %m %d"), '1720712');
+compare(1720712, Date_Calc::DateToDays(18, 1, -1), '-0001 01 18');
+compare('-0001 01 19', Date_Calc::DaysToDate(1720713, "%Y %m %d"), '1720713');
+compare(1720713, Date_Calc::DateToDays(19, 1, -1), '-0001 01 19');
+compare('-0001 01 20', Date_Calc::DaysToDate(1720714, "%Y %m %d"), '1720714');
+compare(1720714, Date_Calc::DateToDays(20, 1, -1), '-0001 01 20');
+compare('-0001 01 21', Date_Calc::DaysToDate(1720715, "%Y %m %d"), '1720715');
+compare(1720715, Date_Calc::DateToDays(21, 1, -1), '-0001 01 21');
+compare('-0001 01 22', Date_Calc::DaysToDate(1720716, "%Y %m %d"), '1720716');
+compare(1720716, Date_Calc::DateToDays(22, 1, -1), '-0001 01 22');
+compare('-0001 01 23', Date_Calc::DaysToDate(1720717, "%Y %m %d"), '1720717');
+compare(1720717, Date_Calc::DateToDays(23, 1, -1), '-0001 01 23');
+compare('-0001 01 24', Date_Calc::DaysToDate(1720718, "%Y %m %d"), '1720718');
+compare(1720718, Date_Calc::DateToDays(24, 1, -1), '-0001 01 24');
+compare('-0001 01 25', Date_Calc::DaysToDate(1720719, "%Y %m %d"), '1720719');
+compare(1720719, Date_Calc::DateToDays(25, 1, -1), '-0001 01 25');
+compare('-0001 01 26', Date_Calc::DaysToDate(1720720, "%Y %m %d"), '1720720');
+compare(1720720, Date_Calc::DateToDays(26, 1, -1), '-0001 01 26');
+compare('-0001 01 27', Date_Calc::DaysToDate(1720721, "%Y %m %d"), '1720721');
+compare(1720721, Date_Calc::DateToDays(27, 1, -1), '-0001 01 27');
+compare('-0001 01 28', Date_Calc::DaysToDate(1720722, "%Y %m %d"), '1720722');
+compare(1720722, Date_Calc::DateToDays(28, 1, -1), '-0001 01 28');
+compare('-0001 01 29', Date_Calc::DaysToDate(1720723, "%Y %m %d"), '1720723');
+compare(1720723, Date_Calc::DateToDays(29, 1, -1), '-0001 01 29');
+compare('-0001 01 30', Date_Calc::DaysToDate(1720724, "%Y %m %d"), '1720724');
+compare(1720724, Date_Calc::DateToDays(30, 1, -1), '-0001 01 30');
+compare('-0001 01 31', Date_Calc::DaysToDate(1720725, "%Y %m %d"), '1720725');
+compare(1720725, Date_Calc::DateToDays(31, 1, -1), '-0001 01 31');
+compare('-0001 02 01', Date_Calc::DaysToDate(1720726, "%Y %m %d"), '1720726');
+compare(1720726, Date_Calc::DateToDays(1, 2, -1), '-0001 02 01');
+compare('-0001 02 02', Date_Calc::DaysToDate(1720727, "%Y %m %d"), '1720727');
+compare(1720727, Date_Calc::DateToDays(2, 2, -1), '-0001 02 02');
+compare('-0001 02 03', Date_Calc::DaysToDate(1720728, "%Y %m %d"), '1720728');
+compare(1720728, Date_Calc::DateToDays(3, 2, -1), '-0001 02 03');
+compare('-0001 02 04', Date_Calc::DaysToDate(1720729, "%Y %m %d"), '1720729');
+compare(1720729, Date_Calc::DateToDays(4, 2, -1), '-0001 02 04');
+compare('-0001 02 05', Date_Calc::DaysToDate(1720730, "%Y %m %d"), '1720730');
+compare(1720730, Date_Calc::DateToDays(5, 2, -1), '-0001 02 05');
+compare('-0001 02 06', Date_Calc::DaysToDate(1720731, "%Y %m %d"), '1720731');
+compare(1720731, Date_Calc::DateToDays(6, 2, -1), '-0001 02 06');
+compare('-0001 02 07', Date_Calc::DaysToDate(1720732, "%Y %m %d"), '1720732');
+compare(1720732, Date_Calc::DateToDays(7, 2, -1), '-0001 02 07');
+compare('-0001 02 08', Date_Calc::DaysToDate(1720733, "%Y %m %d"), '1720733');
+compare(1720733, Date_Calc::DateToDays(8, 2, -1), '-0001 02 08');
+compare('-0001 02 09', Date_Calc::DaysToDate(1720734, "%Y %m %d"), '1720734');
+compare(1720734, Date_Calc::DateToDays(9, 2, -1), '-0001 02 09');
+compare('-0001 02 10', Date_Calc::DaysToDate(1720735, "%Y %m %d"), '1720735');
+compare(1720735, Date_Calc::DateToDays(10, 2, -1), '-0001 02 10');
+compare('-0001 02 11', Date_Calc::DaysToDate(1720736, "%Y %m %d"), '1720736');
+compare(1720736, Date_Calc::DateToDays(11, 2, -1), '-0001 02 11');
+compare('-0001 02 12', Date_Calc::DaysToDate(1720737, "%Y %m %d"), '1720737');
+compare(1720737, Date_Calc::DateToDays(12, 2, -1), '-0001 02 12');
+compare('-0001 02 13', Date_Calc::DaysToDate(1720738, "%Y %m %d"), '1720738');
+compare(1720738, Date_Calc::DateToDays(13, 2, -1), '-0001 02 13');
+compare('-0001 02 14', Date_Calc::DaysToDate(1720739, "%Y %m %d"), '1720739');
+compare(1720739, Date_Calc::DateToDays(14, 2, -1), '-0001 02 14');
+compare('-0001 02 15', Date_Calc::DaysToDate(1720740, "%Y %m %d"), '1720740');
+compare(1720740, Date_Calc::DateToDays(15, 2, -1), '-0001 02 15');
+compare('-0001 02 16', Date_Calc::DaysToDate(1720741, "%Y %m %d"), '1720741');
+compare(1720741, Date_Calc::DateToDays(16, 2, -1), '-0001 02 16');
+compare('-0001 02 17', Date_Calc::DaysToDate(1720742, "%Y %m %d"), '1720742');
+compare(1720742, Date_Calc::DateToDays(17, 2, -1), '-0001 02 17');
+compare('-0001 02 18', Date_Calc::DaysToDate(1720743, "%Y %m %d"), '1720743');
+compare(1720743, Date_Calc::DateToDays(18, 2, -1), '-0001 02 18');
+compare('-0001 02 19', Date_Calc::DaysToDate(1720744, "%Y %m %d"), '1720744');
+compare(1720744, Date_Calc::DateToDays(19, 2, -1), '-0001 02 19');
+compare('-0001 02 20', Date_Calc::DaysToDate(1720745, "%Y %m %d"), '1720745');
+compare(1720745, Date_Calc::DateToDays(20, 2, -1), '-0001 02 20');
+compare('-0001 02 21', Date_Calc::DaysToDate(1720746, "%Y %m %d"), '1720746');
+compare(1720746, Date_Calc::DateToDays(21, 2, -1), '-0001 02 21');
+compare('-0001 02 22', Date_Calc::DaysToDate(1720747, "%Y %m %d"), '1720747');
+compare(1720747, Date_Calc::DateToDays(22, 2, -1), '-0001 02 22');
+compare('-0001 02 23', Date_Calc::DaysToDate(1720748, "%Y %m %d"), '1720748');
+compare(1720748, Date_Calc::DateToDays(23, 2, -1), '-0001 02 23');
+compare('-0001 02 24', Date_Calc::DaysToDate(1720749, "%Y %m %d"), '1720749');
+compare(1720749, Date_Calc::DateToDays(24, 2, -1), '-0001 02 24');
+compare('-0001 02 25', Date_Calc::DaysToDate(1720750, "%Y %m %d"), '1720750');
+compare(1720750, Date_Calc::DateToDays(25, 2, -1), '-0001 02 25');
+compare('-0001 02 26', Date_Calc::DaysToDate(1720751, "%Y %m %d"), '1720751');
+compare(1720751, Date_Calc::DateToDays(26, 2, -1), '-0001 02 26');
+compare('-0001 02 27', Date_Calc::DaysToDate(1720752, "%Y %m %d"), '1720752');
+compare(1720752, Date_Calc::DateToDays(27, 2, -1), '-0001 02 27');
+compare('-0001 02 28', Date_Calc::DaysToDate(1720753, "%Y %m %d"), '1720753');
+compare(1720753, Date_Calc::DateToDays(28, 2, -1), '-0001 02 28');
+compare('-0001 03 01', Date_Calc::DaysToDate(1720754, "%Y %m %d"), '1720754');
+compare(1720754, Date_Calc::DateToDays(1, 3, -1), '-0001 03 01');
+compare('-0001 03 02', Date_Calc::DaysToDate(1720755, "%Y %m %d"), '1720755');
+compare(1720755, Date_Calc::DateToDays(2, 3, -1), '-0001 03 02');
+compare('-0001 03 03', Date_Calc::DaysToDate(1720756, "%Y %m %d"), '1720756');
+compare(1720756, Date_Calc::DateToDays(3, 3, -1), '-0001 03 03');
+compare('-0001 03 04', Date_Calc::DaysToDate(1720757, "%Y %m %d"), '1720757');
+compare(1720757, Date_Calc::DateToDays(4, 3, -1), '-0001 03 04');
+compare('-0001 03 05', Date_Calc::DaysToDate(1720758, "%Y %m %d"), '1720758');
+compare(1720758, Date_Calc::DateToDays(5, 3, -1), '-0001 03 05');
+compare('-0001 03 06', Date_Calc::DaysToDate(1720759, "%Y %m %d"), '1720759');
+compare(1720759, Date_Calc::DateToDays(6, 3, -1), '-0001 03 06');
+compare('-0001 03 07', Date_Calc::DaysToDate(1720760, "%Y %m %d"), '1720760');
+compare(1720760, Date_Calc::DateToDays(7, 3, -1), '-0001 03 07');
+compare('-0001 03 08', Date_Calc::DaysToDate(1720761, "%Y %m %d"), '1720761');
+compare(1720761, Date_Calc::DateToDays(8, 3, -1), '-0001 03 08');
+compare('-0001 03 09', Date_Calc::DaysToDate(1720762, "%Y %m %d"), '1720762');
+compare(1720762, Date_Calc::DateToDays(9, 3, -1), '-0001 03 09');
+compare('-0001 03 10', Date_Calc::DaysToDate(1720763, "%Y %m %d"), '1720763');
+compare(1720763, Date_Calc::DateToDays(10, 3, -1), '-0001 03 10');
+compare('-0001 03 11', Date_Calc::DaysToDate(1720764, "%Y %m %d"), '1720764');
+compare(1720764, Date_Calc::DateToDays(11, 3, -1), '-0001 03 11');
+compare('-0001 03 12', Date_Calc::DaysToDate(1720765, "%Y %m %d"), '1720765');
+compare(1720765, Date_Calc::DateToDays(12, 3, -1), '-0001 03 12');
+compare('-0001 03 13', Date_Calc::DaysToDate(1720766, "%Y %m %d"), '1720766');
+compare(1720766, Date_Calc::DateToDays(13, 3, -1), '-0001 03 13');
+compare('-0001 03 14', Date_Calc::DaysToDate(1720767, "%Y %m %d"), '1720767');
+compare(1720767, Date_Calc::DateToDays(14, 3, -1), '-0001 03 14');
+compare('-0001 03 15', Date_Calc::DaysToDate(1720768, "%Y %m %d"), '1720768');
+compare(1720768, Date_Calc::DateToDays(15, 3, -1), '-0001 03 15');
+compare('-0001 03 16', Date_Calc::DaysToDate(1720769, "%Y %m %d"), '1720769');
+compare(1720769, Date_Calc::DateToDays(16, 3, -1), '-0001 03 16');
+compare('-0001 03 17', Date_Calc::DaysToDate(1720770, "%Y %m %d"), '1720770');
+compare(1720770, Date_Calc::DateToDays(17, 3, -1), '-0001 03 17');
+compare('-0001 03 18', Date_Calc::DaysToDate(1720771, "%Y %m %d"), '1720771');
+compare(1720771, Date_Calc::DateToDays(18, 3, -1), '-0001 03 18');
+compare('-0001 03 19', Date_Calc::DaysToDate(1720772, "%Y %m %d"), '1720772');
+compare(1720772, Date_Calc::DateToDays(19, 3, -1), '-0001 03 19');
+compare('-0001 03 20', Date_Calc::DaysToDate(1720773, "%Y %m %d"), '1720773');
+compare(1720773, Date_Calc::DateToDays(20, 3, -1), '-0001 03 20');
+compare('-0001 03 21', Date_Calc::DaysToDate(1720774, "%Y %m %d"), '1720774');
+compare(1720774, Date_Calc::DateToDays(21, 3, -1), '-0001 03 21');
+compare('-0001 03 22', Date_Calc::DaysToDate(1720775, "%Y %m %d"), '1720775');
+compare(1720775, Date_Calc::DateToDays(22, 3, -1), '-0001 03 22');
+compare('-0001 03 23', Date_Calc::DaysToDate(1720776, "%Y %m %d"), '1720776');
+compare(1720776, Date_Calc::DateToDays(23, 3, -1), '-0001 03 23');
+compare('-0001 03 24', Date_Calc::DaysToDate(1720777, "%Y %m %d"), '1720777');
+compare(1720777, Date_Calc::DateToDays(24, 3, -1), '-0001 03 24');
+compare('-0001 03 25', Date_Calc::DaysToDate(1720778, "%Y %m %d"), '1720778');
+compare(1720778, Date_Calc::DateToDays(25, 3, -1), '-0001 03 25');
+compare('-0001 03 26', Date_Calc::DaysToDate(1720779, "%Y %m %d"), '1720779');
+compare(1720779, Date_Calc::DateToDays(26, 3, -1), '-0001 03 26');
+compare('-0001 03 27', Date_Calc::DaysToDate(1720780, "%Y %m %d"), '1720780');
+compare(1720780, Date_Calc::DateToDays(27, 3, -1), '-0001 03 27');
+compare('-0001 03 28', Date_Calc::DaysToDate(1720781, "%Y %m %d"), '1720781');
+compare(1720781, Date_Calc::DateToDays(28, 3, -1), '-0001 03 28');
+compare('-0001 03 29', Date_Calc::DaysToDate(1720782, "%Y %m %d"), '1720782');
+compare(1720782, Date_Calc::DateToDays(29, 3, -1), '-0001 03 29');
+compare('-0001 03 30', Date_Calc::DaysToDate(1720783, "%Y %m %d"), '1720783');
+compare(1720783, Date_Calc::DateToDays(30, 3, -1), '-0001 03 30');
+compare('-0001 03 31', Date_Calc::DaysToDate(1720784, "%Y %m %d"), '1720784');
+compare(1720784, Date_Calc::DateToDays(31, 3, -1), '-0001 03 31');
+compare('-0001 04 01', Date_Calc::DaysToDate(1720785, "%Y %m %d"), '1720785');
+compare(1720785, Date_Calc::DateToDays(1, 4, -1), '-0001 04 01');
+compare('-0001 04 02', Date_Calc::DaysToDate(1720786, "%Y %m %d"), '1720786');
+compare(1720786, Date_Calc::DateToDays(2, 4, -1), '-0001 04 02');
+compare('-0001 04 03', Date_Calc::DaysToDate(1720787, "%Y %m %d"), '1720787');
+compare(1720787, Date_Calc::DateToDays(3, 4, -1), '-0001 04 03');
+compare('-0001 04 04', Date_Calc::DaysToDate(1720788, "%Y %m %d"), '1720788');
+compare(1720788, Date_Calc::DateToDays(4, 4, -1), '-0001 04 04');
+compare('-0001 04 05', Date_Calc::DaysToDate(1720789, "%Y %m %d"), '1720789');
+compare(1720789, Date_Calc::DateToDays(5, 4, -1), '-0001 04 05');
+compare('-0001 04 06', Date_Calc::DaysToDate(1720790, "%Y %m %d"), '1720790');
+compare(1720790, Date_Calc::DateToDays(6, 4, -1), '-0001 04 06');
+compare('-0001 04 07', Date_Calc::DaysToDate(1720791, "%Y %m %d"), '1720791');
+compare(1720791, Date_Calc::DateToDays(7, 4, -1), '-0001 04 07');
+compare('-0001 04 08', Date_Calc::DaysToDate(1720792, "%Y %m %d"), '1720792');
+compare(1720792, Date_Calc::DateToDays(8, 4, -1), '-0001 04 08');
+compare('-0001 04 09', Date_Calc::DaysToDate(1720793, "%Y %m %d"), '1720793');
+compare(1720793, Date_Calc::DateToDays(9, 4, -1), '-0001 04 09');
+compare('-0001 04 10', Date_Calc::DaysToDate(1720794, "%Y %m %d"), '1720794');
+compare(1720794, Date_Calc::DateToDays(10, 4, -1), '-0001 04 10');
+compare('-0001 04 11', Date_Calc::DaysToDate(1720795, "%Y %m %d"), '1720795');
+compare(1720795, Date_Calc::DateToDays(11, 4, -1), '-0001 04 11');
+compare('-0001 04 12', Date_Calc::DaysToDate(1720796, "%Y %m %d"), '1720796');
+compare(1720796, Date_Calc::DateToDays(12, 4, -1), '-0001 04 12');
+compare('-0001 04 13', Date_Calc::DaysToDate(1720797, "%Y %m %d"), '1720797');
+compare(1720797, Date_Calc::DateToDays(13, 4, -1), '-0001 04 13');
+compare('-0001 04 14', Date_Calc::DaysToDate(1720798, "%Y %m %d"), '1720798');
+compare(1720798, Date_Calc::DateToDays(14, 4, -1), '-0001 04 14');
+compare('-0001 04 15', Date_Calc::DaysToDate(1720799, "%Y %m %d"), '1720799');
+compare(1720799, Date_Calc::DateToDays(15, 4, -1), '-0001 04 15');
+compare('-0001 04 16', Date_Calc::DaysToDate(1720800, "%Y %m %d"), '1720800');
+compare(1720800, Date_Calc::DateToDays(16, 4, -1), '-0001 04 16');
+compare('-0001 04 17', Date_Calc::DaysToDate(1720801, "%Y %m %d"), '1720801');
+compare(1720801, Date_Calc::DateToDays(17, 4, -1), '-0001 04 17');
+compare('-0001 04 18', Date_Calc::DaysToDate(1720802, "%Y %m %d"), '1720802');
+compare(1720802, Date_Calc::DateToDays(18, 4, -1), '-0001 04 18');
+compare('-0001 04 19', Date_Calc::DaysToDate(1720803, "%Y %m %d"), '1720803');
+compare(1720803, Date_Calc::DateToDays(19, 4, -1), '-0001 04 19');
+compare('-0001 04 20', Date_Calc::DaysToDate(1720804, "%Y %m %d"), '1720804');
+compare(1720804, Date_Calc::DateToDays(20, 4, -1), '-0001 04 20');
+compare('-0001 04 21', Date_Calc::DaysToDate(1720805, "%Y %m %d"), '1720805');
+compare(1720805, Date_Calc::DateToDays(21, 4, -1), '-0001 04 21');
+compare('-0001 04 22', Date_Calc::DaysToDate(1720806, "%Y %m %d"), '1720806');
+compare(1720806, Date_Calc::DateToDays(22, 4, -1), '-0001 04 22');
+compare('-0001 04 23', Date_Calc::DaysToDate(1720807, "%Y %m %d"), '1720807');
+compare(1720807, Date_Calc::DateToDays(23, 4, -1), '-0001 04 23');
+compare('-0001 04 24', Date_Calc::DaysToDate(1720808, "%Y %m %d"), '1720808');
+compare(1720808, Date_Calc::DateToDays(24, 4, -1), '-0001 04 24');
+compare('-0001 04 25', Date_Calc::DaysToDate(1720809, "%Y %m %d"), '1720809');
+compare(1720809, Date_Calc::DateToDays(25, 4, -1), '-0001 04 25');
+compare('-0001 04 26', Date_Calc::DaysToDate(1720810, "%Y %m %d"), '1720810');
+compare(1720810, Date_Calc::DateToDays(26, 4, -1), '-0001 04 26');
+compare('-0001 04 27', Date_Calc::DaysToDate(1720811, "%Y %m %d"), '1720811');
+compare(1720811, Date_Calc::DateToDays(27, 4, -1), '-0001 04 27');
+compare('-0001 04 28', Date_Calc::DaysToDate(1720812, "%Y %m %d"), '1720812');
+compare(1720812, Date_Calc::DateToDays(28, 4, -1), '-0001 04 28');
+compare('-0001 04 29', Date_Calc::DaysToDate(1720813, "%Y %m %d"), '1720813');
+compare(1720813, Date_Calc::DateToDays(29, 4, -1), '-0001 04 29');
+compare('-0001 04 30', Date_Calc::DaysToDate(1720814, "%Y %m %d"), '1720814');
+compare(1720814, Date_Calc::DateToDays(30, 4, -1), '-0001 04 30');
+compare('-0001 05 01', Date_Calc::DaysToDate(1720815, "%Y %m %d"), '1720815');
+compare(1720815, Date_Calc::DateToDays(1, 5, -1), '-0001 05 01');
+compare('-0001 05 02', Date_Calc::DaysToDate(1720816, "%Y %m %d"), '1720816');
+compare(1720816, Date_Calc::DateToDays(2, 5, -1), '-0001 05 02');
+compare('-0001 05 03', Date_Calc::DaysToDate(1720817, "%Y %m %d"), '1720817');
+compare(1720817, Date_Calc::DateToDays(3, 5, -1), '-0001 05 03');
+compare('-0001 05 04', Date_Calc::DaysToDate(1720818, "%Y %m %d"), '1720818');
+compare(1720818, Date_Calc::DateToDays(4, 5, -1), '-0001 05 04');
+compare('-0001 05 05', Date_Calc::DaysToDate(1720819, "%Y %m %d"), '1720819');
+compare(1720819, Date_Calc::DateToDays(5, 5, -1), '-0001 05 05');
+compare('-0001 05 06', Date_Calc::DaysToDate(1720820, "%Y %m %d"), '1720820');
+compare(1720820, Date_Calc::DateToDays(6, 5, -1), '-0001 05 06');
+compare('-0001 05 07', Date_Calc::DaysToDate(1720821, "%Y %m %d"), '1720821');
+compare(1720821, Date_Calc::DateToDays(7, 5, -1), '-0001 05 07');
+compare('-0001 05 08', Date_Calc::DaysToDate(1720822, "%Y %m %d"), '1720822');
+compare(1720822, Date_Calc::DateToDays(8, 5, -1), '-0001 05 08');
+compare('-0001 05 09', Date_Calc::DaysToDate(1720823, "%Y %m %d"), '1720823');
+compare(1720823, Date_Calc::DateToDays(9, 5, -1), '-0001 05 09');
+compare('-0001 05 10', Date_Calc::DaysToDate(1720824, "%Y %m %d"), '1720824');
+compare(1720824, Date_Calc::DateToDays(10, 5, -1), '-0001 05 10');
+compare('-0001 05 11', Date_Calc::DaysToDate(1720825, "%Y %m %d"), '1720825');
+compare(1720825, Date_Calc::DateToDays(11, 5, -1), '-0001 05 11');
+compare('-0001 05 12', Date_Calc::DaysToDate(1720826, "%Y %m %d"), '1720826');
+compare(1720826, Date_Calc::DateToDays(12, 5, -1), '-0001 05 12');
+compare('-0001 05 13', Date_Calc::DaysToDate(1720827, "%Y %m %d"), '1720827');
+compare(1720827, Date_Calc::DateToDays(13, 5, -1), '-0001 05 13');
+compare('-0001 05 14', Date_Calc::DaysToDate(1720828, "%Y %m %d"), '1720828');
+compare(1720828, Date_Calc::DateToDays(14, 5, -1), '-0001 05 14');
+compare('-0001 05 15', Date_Calc::DaysToDate(1720829, "%Y %m %d"), '1720829');
+compare(1720829, Date_Calc::DateToDays(15, 5, -1), '-0001 05 15');
+compare('-0001 05 16', Date_Calc::DaysToDate(1720830, "%Y %m %d"), '1720830');
+compare(1720830, Date_Calc::DateToDays(16, 5, -1), '-0001 05 16');
+compare('-0001 05 17', Date_Calc::DaysToDate(1720831, "%Y %m %d"), '1720831');
+compare(1720831, Date_Calc::DateToDays(17, 5, -1), '-0001 05 17');
+compare('-0001 05 18', Date_Calc::DaysToDate(1720832, "%Y %m %d"), '1720832');
+compare(1720832, Date_Calc::DateToDays(18, 5, -1), '-0001 05 18');
+compare('-0001 05 19', Date_Calc::DaysToDate(1720833, "%Y %m %d"), '1720833');
+compare(1720833, Date_Calc::DateToDays(19, 5, -1), '-0001 05 19');
+compare('-0001 05 20', Date_Calc::DaysToDate(1720834, "%Y %m %d"), '1720834');
+compare(1720834, Date_Calc::DateToDays(20, 5, -1), '-0001 05 20');
+compare('-0001 05 21', Date_Calc::DaysToDate(1720835, "%Y %m %d"), '1720835');
+compare(1720835, Date_Calc::DateToDays(21, 5, -1), '-0001 05 21');
+compare('-0001 05 22', Date_Calc::DaysToDate(1720836, "%Y %m %d"), '1720836');
+compare(1720836, Date_Calc::DateToDays(22, 5, -1), '-0001 05 22');
+compare('-0001 05 23', Date_Calc::DaysToDate(1720837, "%Y %m %d"), '1720837');
+compare(1720837, Date_Calc::DateToDays(23, 5, -1), '-0001 05 23');
+compare('-0001 05 24', Date_Calc::DaysToDate(1720838, "%Y %m %d"), '1720838');
+compare(1720838, Date_Calc::DateToDays(24, 5, -1), '-0001 05 24');
+compare('-0001 05 25', Date_Calc::DaysToDate(1720839, "%Y %m %d"), '1720839');
+compare(1720839, Date_Calc::DateToDays(25, 5, -1), '-0001 05 25');
+compare('-0001 05 26', Date_Calc::DaysToDate(1720840, "%Y %m %d"), '1720840');
+compare(1720840, Date_Calc::DateToDays(26, 5, -1), '-0001 05 26');
+compare('-0001 05 27', Date_Calc::DaysToDate(1720841, "%Y %m %d"), '1720841');
+compare(1720841, Date_Calc::DateToDays(27, 5, -1), '-0001 05 27');
+compare('-0001 05 28', Date_Calc::DaysToDate(1720842, "%Y %m %d"), '1720842');
+compare(1720842, Date_Calc::DateToDays(28, 5, -1), '-0001 05 28');
+compare('-0001 05 29', Date_Calc::DaysToDate(1720843, "%Y %m %d"), '1720843');
+compare(1720843, Date_Calc::DateToDays(29, 5, -1), '-0001 05 29');
+compare('-0001 05 30', Date_Calc::DaysToDate(1720844, "%Y %m %d"), '1720844');
+compare(1720844, Date_Calc::DateToDays(30, 5, -1), '-0001 05 30');
+compare('-0001 05 31', Date_Calc::DaysToDate(1720845, "%Y %m %d"), '1720845');
+compare(1720845, Date_Calc::DateToDays(31, 5, -1), '-0001 05 31');
+compare('-0001 06 01', Date_Calc::DaysToDate(1720846, "%Y %m %d"), '1720846');
+compare(1720846, Date_Calc::DateToDays(1, 6, -1), '-0001 06 01');
+compare('-0001 06 02', Date_Calc::DaysToDate(1720847, "%Y %m %d"), '1720847');
+compare(1720847, Date_Calc::DateToDays(2, 6, -1), '-0001 06 02');
+compare('-0001 06 03', Date_Calc::DaysToDate(1720848, "%Y %m %d"), '1720848');
+compare(1720848, Date_Calc::DateToDays(3, 6, -1), '-0001 06 03');
+compare('-0001 06 04', Date_Calc::DaysToDate(1720849, "%Y %m %d"), '1720849');
+compare(1720849, Date_Calc::DateToDays(4, 6, -1), '-0001 06 04');
+compare('-0001 06 05', Date_Calc::DaysToDate(1720850, "%Y %m %d"), '1720850');
+compare(1720850, Date_Calc::DateToDays(5, 6, -1), '-0001 06 05');
+compare('-0001 06 06', Date_Calc::DaysToDate(1720851, "%Y %m %d"), '1720851');
+compare(1720851, Date_Calc::DateToDays(6, 6, -1), '-0001 06 06');
+compare('-0001 06 07', Date_Calc::DaysToDate(1720852, "%Y %m %d"), '1720852');
+compare(1720852, Date_Calc::DateToDays(7, 6, -1), '-0001 06 07');
+compare('-0001 06 08', Date_Calc::DaysToDate(1720853, "%Y %m %d"), '1720853');
+compare(1720853, Date_Calc::DateToDays(8, 6, -1), '-0001 06 08');
+compare('-0001 06 09', Date_Calc::DaysToDate(1720854, "%Y %m %d"), '1720854');
+compare(1720854, Date_Calc::DateToDays(9, 6, -1), '-0001 06 09');
+compare('-0001 06 10', Date_Calc::DaysToDate(1720855, "%Y %m %d"), '1720855');
+compare(1720855, Date_Calc::DateToDays(10, 6, -1), '-0001 06 10');
+compare('-0001 06 11', Date_Calc::DaysToDate(1720856, "%Y %m %d"), '1720856');
+compare(1720856, Date_Calc::DateToDays(11, 6, -1), '-0001 06 11');
+compare('-0001 06 12', Date_Calc::DaysToDate(1720857, "%Y %m %d"), '1720857');
+compare(1720857, Date_Calc::DateToDays(12, 6, -1), '-0001 06 12');
+compare('-0001 06 13', Date_Calc::DaysToDate(1720858, "%Y %m %d"), '1720858');
+compare(1720858, Date_Calc::DateToDays(13, 6, -1), '-0001 06 13');
+compare('-0001 06 14', Date_Calc::DaysToDate(1720859, "%Y %m %d"), '1720859');
+compare(1720859, Date_Calc::DateToDays(14, 6, -1), '-0001 06 14');
+compare('-0001 06 15', Date_Calc::DaysToDate(1720860, "%Y %m %d"), '1720860');
+compare(1720860, Date_Calc::DateToDays(15, 6, -1), '-0001 06 15');
+compare('-0001 06 16', Date_Calc::DaysToDate(1720861, "%Y %m %d"), '1720861');
+compare(1720861, Date_Calc::DateToDays(16, 6, -1), '-0001 06 16');
+compare('-0001 06 17', Date_Calc::DaysToDate(1720862, "%Y %m %d"), '1720862');
+compare(1720862, Date_Calc::DateToDays(17, 6, -1), '-0001 06 17');
+compare('-0001 06 18', Date_Calc::DaysToDate(1720863, "%Y %m %d"), '1720863');
+compare(1720863, Date_Calc::DateToDays(18, 6, -1), '-0001 06 18');
+compare('-0001 06 19', Date_Calc::DaysToDate(1720864, "%Y %m %d"), '1720864');
+compare(1720864, Date_Calc::DateToDays(19, 6, -1), '-0001 06 19');
+compare('-0001 06 20', Date_Calc::DaysToDate(1720865, "%Y %m %d"), '1720865');
+compare(1720865, Date_Calc::DateToDays(20, 6, -1), '-0001 06 20');
+compare('-0001 06 21', Date_Calc::DaysToDate(1720866, "%Y %m %d"), '1720866');
+compare(1720866, Date_Calc::DateToDays(21, 6, -1), '-0001 06 21');
+compare('-0001 06 22', Date_Calc::DaysToDate(1720867, "%Y %m %d"), '1720867');
+compare(1720867, Date_Calc::DateToDays(22, 6, -1), '-0001 06 22');
+compare('-0001 06 23', Date_Calc::DaysToDate(1720868, "%Y %m %d"), '1720868');
+compare(1720868, Date_Calc::DateToDays(23, 6, -1), '-0001 06 23');
+compare('-0001 06 24', Date_Calc::DaysToDate(1720869, "%Y %m %d"), '1720869');
+compare(1720869, Date_Calc::DateToDays(24, 6, -1), '-0001 06 24');
+compare('-0001 06 25', Date_Calc::DaysToDate(1720870, "%Y %m %d"), '1720870');
+compare(1720870, Date_Calc::DateToDays(25, 6, -1), '-0001 06 25');
+compare('-0001 06 26', Date_Calc::DaysToDate(1720871, "%Y %m %d"), '1720871');
+compare(1720871, Date_Calc::DateToDays(26, 6, -1), '-0001 06 26');
+compare('-0001 06 27', Date_Calc::DaysToDate(1720872, "%Y %m %d"), '1720872');
+compare(1720872, Date_Calc::DateToDays(27, 6, -1), '-0001 06 27');
+compare('-0001 06 28', Date_Calc::DaysToDate(1720873, "%Y %m %d"), '1720873');
+compare(1720873, Date_Calc::DateToDays(28, 6, -1), '-0001 06 28');
+compare('-0001 06 29', Date_Calc::DaysToDate(1720874, "%Y %m %d"), '1720874');
+compare(1720874, Date_Calc::DateToDays(29, 6, -1), '-0001 06 29');
+compare('-0001 06 30', Date_Calc::DaysToDate(1720875, "%Y %m %d"), '1720875');
+compare(1720875, Date_Calc::DateToDays(30, 6, -1), '-0001 06 30');
+compare('-0001 07 01', Date_Calc::DaysToDate(1720876, "%Y %m %d"), '1720876');
+compare(1720876, Date_Calc::DateToDays(1, 7, -1), '-0001 07 01');
+compare('-0001 07 02', Date_Calc::DaysToDate(1720877, "%Y %m %d"), '1720877');
+compare(1720877, Date_Calc::DateToDays(2, 7, -1), '-0001 07 02');
+compare('-0001 07 03', Date_Calc::DaysToDate(1720878, "%Y %m %d"), '1720878');
+compare(1720878, Date_Calc::DateToDays(3, 7, -1), '-0001 07 03');
+compare('-0001 07 04', Date_Calc::DaysToDate(1720879, "%Y %m %d"), '1720879');
+compare(1720879, Date_Calc::DateToDays(4, 7, -1), '-0001 07 04');
+compare('-0001 07 05', Date_Calc::DaysToDate(1720880, "%Y %m %d"), '1720880');
+compare(1720880, Date_Calc::DateToDays(5, 7, -1), '-0001 07 05');
+compare('-0001 07 06', Date_Calc::DaysToDate(1720881, "%Y %m %d"), '1720881');
+compare(1720881, Date_Calc::DateToDays(6, 7, -1), '-0001 07 06');
+compare('-0001 07 07', Date_Calc::DaysToDate(1720882, "%Y %m %d"), '1720882');
+compare(1720882, Date_Calc::DateToDays(7, 7, -1), '-0001 07 07');
+compare('-0001 07 08', Date_Calc::DaysToDate(1720883, "%Y %m %d"), '1720883');
+compare(1720883, Date_Calc::DateToDays(8, 7, -1), '-0001 07 08');
+compare('-0001 07 09', Date_Calc::DaysToDate(1720884, "%Y %m %d"), '1720884');
+compare(1720884, Date_Calc::DateToDays(9, 7, -1), '-0001 07 09');
+compare('-0001 07 10', Date_Calc::DaysToDate(1720885, "%Y %m %d"), '1720885');
+compare(1720885, Date_Calc::DateToDays(10, 7, -1), '-0001 07 10');
+compare('-0001 07 11', Date_Calc::DaysToDate(1720886, "%Y %m %d"), '1720886');
+compare(1720886, Date_Calc::DateToDays(11, 7, -1), '-0001 07 11');
+compare('-0001 07 12', Date_Calc::DaysToDate(1720887, "%Y %m %d"), '1720887');
+compare(1720887, Date_Calc::DateToDays(12, 7, -1), '-0001 07 12');
+compare('-0001 07 13', Date_Calc::DaysToDate(1720888, "%Y %m %d"), '1720888');
+compare(1720888, Date_Calc::DateToDays(13, 7, -1), '-0001 07 13');
+compare('-0001 07 14', Date_Calc::DaysToDate(1720889, "%Y %m %d"), '1720889');
+compare(1720889, Date_Calc::DateToDays(14, 7, -1), '-0001 07 14');
+compare('-0001 07 15', Date_Calc::DaysToDate(1720890, "%Y %m %d"), '1720890');
+compare(1720890, Date_Calc::DateToDays(15, 7, -1), '-0001 07 15');
+compare('-0001 07 16', Date_Calc::DaysToDate(1720891, "%Y %m %d"), '1720891');
+compare(1720891, Date_Calc::DateToDays(16, 7, -1), '-0001 07 16');
+compare('-0001 07 17', Date_Calc::DaysToDate(1720892, "%Y %m %d"), '1720892');
+compare(1720892, Date_Calc::DateToDays(17, 7, -1), '-0001 07 17');
+compare('-0001 07 18', Date_Calc::DaysToDate(1720893, "%Y %m %d"), '1720893');
+compare(1720893, Date_Calc::DateToDays(18, 7, -1), '-0001 07 18');
+compare('-0001 07 19', Date_Calc::DaysToDate(1720894, "%Y %m %d"), '1720894');
+compare(1720894, Date_Calc::DateToDays(19, 7, -1), '-0001 07 19');
+compare('-0001 07 20', Date_Calc::DaysToDate(1720895, "%Y %m %d"), '1720895');
+compare(1720895, Date_Calc::DateToDays(20, 7, -1), '-0001 07 20');
+compare('-0001 07 21', Date_Calc::DaysToDate(1720896, "%Y %m %d"), '1720896');
+compare(1720896, Date_Calc::DateToDays(21, 7, -1), '-0001 07 21');
+compare('-0001 07 22', Date_Calc::DaysToDate(1720897, "%Y %m %d"), '1720897');
+compare(1720897, Date_Calc::DateToDays(22, 7, -1), '-0001 07 22');
+compare('-0001 07 23', Date_Calc::DaysToDate(1720898, "%Y %m %d"), '1720898');
+compare(1720898, Date_Calc::DateToDays(23, 7, -1), '-0001 07 23');
+compare('-0001 07 24', Date_Calc::DaysToDate(1720899, "%Y %m %d"), '1720899');
+compare(1720899, Date_Calc::DateToDays(24, 7, -1), '-0001 07 24');
+compare('-0001 07 25', Date_Calc::DaysToDate(1720900, "%Y %m %d"), '1720900');
+compare(1720900, Date_Calc::DateToDays(25, 7, -1), '-0001 07 25');
+compare('-0001 07 26', Date_Calc::DaysToDate(1720901, "%Y %m %d"), '1720901');
+compare(1720901, Date_Calc::DateToDays(26, 7, -1), '-0001 07 26');
+compare('-0001 07 27', Date_Calc::DaysToDate(1720902, "%Y %m %d"), '1720902');
+compare(1720902, Date_Calc::DateToDays(27, 7, -1), '-0001 07 27');
+compare('-0001 07 28', Date_Calc::DaysToDate(1720903, "%Y %m %d"), '1720903');
+compare(1720903, Date_Calc::DateToDays(28, 7, -1), '-0001 07 28');
+compare('-0001 07 29', Date_Calc::DaysToDate(1720904, "%Y %m %d"), '1720904');
+compare(1720904, Date_Calc::DateToDays(29, 7, -1), '-0001 07 29');
+compare('-0001 07 30', Date_Calc::DaysToDate(1720905, "%Y %m %d"), '1720905');
+compare(1720905, Date_Calc::DateToDays(30, 7, -1), '-0001 07 30');
+compare('-0001 07 31', Date_Calc::DaysToDate(1720906, "%Y %m %d"), '1720906');
+compare(1720906, Date_Calc::DateToDays(31, 7, -1), '-0001 07 31');
+compare('-0001 08 01', Date_Calc::DaysToDate(1720907, "%Y %m %d"), '1720907');
+compare(1720907, Date_Calc::DateToDays(1, 8, -1), '-0001 08 01');
+compare('-0001 08 02', Date_Calc::DaysToDate(1720908, "%Y %m %d"), '1720908');
+compare(1720908, Date_Calc::DateToDays(2, 8, -1), '-0001 08 02');
+compare('-0001 08 03', Date_Calc::DaysToDate(1720909, "%Y %m %d"), '1720909');
+compare(1720909, Date_Calc::DateToDays(3, 8, -1), '-0001 08 03');
+compare('-0001 08 04', Date_Calc::DaysToDate(1720910, "%Y %m %d"), '1720910');
+compare(1720910, Date_Calc::DateToDays(4, 8, -1), '-0001 08 04');
+compare('-0001 08 05', Date_Calc::DaysToDate(1720911, "%Y %m %d"), '1720911');
+compare(1720911, Date_Calc::DateToDays(5, 8, -1), '-0001 08 05');
+compare('-0001 08 06', Date_Calc::DaysToDate(1720912, "%Y %m %d"), '1720912');
+compare(1720912, Date_Calc::DateToDays(6, 8, -1), '-0001 08 06');
+compare('-0001 08 07', Date_Calc::DaysToDate(1720913, "%Y %m %d"), '1720913');
+compare(1720913, Date_Calc::DateToDays(7, 8, -1), '-0001 08 07');
+compare('-0001 08 08', Date_Calc::DaysToDate(1720914, "%Y %m %d"), '1720914');
+compare(1720914, Date_Calc::DateToDays(8, 8, -1), '-0001 08 08');
+compare('-0001 08 09', Date_Calc::DaysToDate(1720915, "%Y %m %d"), '1720915');
+compare(1720915, Date_Calc::DateToDays(9, 8, -1), '-0001 08 09');
+compare('-0001 08 10', Date_Calc::DaysToDate(1720916, "%Y %m %d"), '1720916');
+compare(1720916, Date_Calc::DateToDays(10, 8, -1), '-0001 08 10');
+compare('-0001 08 11', Date_Calc::DaysToDate(1720917, "%Y %m %d"), '1720917');
+compare(1720917, Date_Calc::DateToDays(11, 8, -1), '-0001 08 11');
+compare('-0001 08 12', Date_Calc::DaysToDate(1720918, "%Y %m %d"), '1720918');
+compare(1720918, Date_Calc::DateToDays(12, 8, -1), '-0001 08 12');
+compare('-0001 08 13', Date_Calc::DaysToDate(1720919, "%Y %m %d"), '1720919');
+compare(1720919, Date_Calc::DateToDays(13, 8, -1), '-0001 08 13');
+compare('-0001 08 14', Date_Calc::DaysToDate(1720920, "%Y %m %d"), '1720920');
+compare(1720920, Date_Calc::DateToDays(14, 8, -1), '-0001 08 14');
+compare('-0001 08 15', Date_Calc::DaysToDate(1720921, "%Y %m %d"), '1720921');
+compare(1720921, Date_Calc::DateToDays(15, 8, -1), '-0001 08 15');
+compare('-0001 08 16', Date_Calc::DaysToDate(1720922, "%Y %m %d"), '1720922');
+compare(1720922, Date_Calc::DateToDays(16, 8, -1), '-0001 08 16');
+compare('-0001 08 17', Date_Calc::DaysToDate(1720923, "%Y %m %d"), '1720923');
+compare(1720923, Date_Calc::DateToDays(17, 8, -1), '-0001 08 17');
+compare('-0001 08 18', Date_Calc::DaysToDate(1720924, "%Y %m %d"), '1720924');
+compare(1720924, Date_Calc::DateToDays(18, 8, -1), '-0001 08 18');
+compare('-0001 08 19', Date_Calc::DaysToDate(1720925, "%Y %m %d"), '1720925');
+compare(1720925, Date_Calc::DateToDays(19, 8, -1), '-0001 08 19');
+compare('-0001 08 20', Date_Calc::DaysToDate(1720926, "%Y %m %d"), '1720926');
+compare(1720926, Date_Calc::DateToDays(20, 8, -1), '-0001 08 20');
+compare('-0001 08 21', Date_Calc::DaysToDate(1720927, "%Y %m %d"), '1720927');
+compare(1720927, Date_Calc::DateToDays(21, 8, -1), '-0001 08 21');
+compare('-0001 08 22', Date_Calc::DaysToDate(1720928, "%Y %m %d"), '1720928');
+compare(1720928, Date_Calc::DateToDays(22, 8, -1), '-0001 08 22');
+compare('-0001 08 23', Date_Calc::DaysToDate(1720929, "%Y %m %d"), '1720929');
+compare(1720929, Date_Calc::DateToDays(23, 8, -1), '-0001 08 23');
+compare('-0001 08 24', Date_Calc::DaysToDate(1720930, "%Y %m %d"), '1720930');
+compare(1720930, Date_Calc::DateToDays(24, 8, -1), '-0001 08 24');
+compare('-0001 08 25', Date_Calc::DaysToDate(1720931, "%Y %m %d"), '1720931');
+compare(1720931, Date_Calc::DateToDays(25, 8, -1), '-0001 08 25');
+compare('-0001 08 26', Date_Calc::DaysToDate(1720932, "%Y %m %d"), '1720932');
+compare(1720932, Date_Calc::DateToDays(26, 8, -1), '-0001 08 26');
+compare('-0001 08 27', Date_Calc::DaysToDate(1720933, "%Y %m %d"), '1720933');
+compare(1720933, Date_Calc::DateToDays(27, 8, -1), '-0001 08 27');
+compare('-0001 08 28', Date_Calc::DaysToDate(1720934, "%Y %m %d"), '1720934');
+compare(1720934, Date_Calc::DateToDays(28, 8, -1), '-0001 08 28');
+compare('-0001 08 29', Date_Calc::DaysToDate(1720935, "%Y %m %d"), '1720935');
+compare(1720935, Date_Calc::DateToDays(29, 8, -1), '-0001 08 29');
+compare('-0001 08 30', Date_Calc::DaysToDate(1720936, "%Y %m %d"), '1720936');
+compare(1720936, Date_Calc::DateToDays(30, 8, -1), '-0001 08 30');
+compare('-0001 08 31', Date_Calc::DaysToDate(1720937, "%Y %m %d"), '1720937');
+compare(1720937, Date_Calc::DateToDays(31, 8, -1), '-0001 08 31');
+compare('-0001 09 01', Date_Calc::DaysToDate(1720938, "%Y %m %d"), '1720938');
+compare(1720938, Date_Calc::DateToDays(1, 9, -1), '-0001 09 01');
+compare('-0001 09 02', Date_Calc::DaysToDate(1720939, "%Y %m %d"), '1720939');
+compare(1720939, Date_Calc::DateToDays(2, 9, -1), '-0001 09 02');
+compare('-0001 09 03', Date_Calc::DaysToDate(1720940, "%Y %m %d"), '1720940');
+compare(1720940, Date_Calc::DateToDays(3, 9, -1), '-0001 09 03');
+compare('-0001 09 04', Date_Calc::DaysToDate(1720941, "%Y %m %d"), '1720941');
+compare(1720941, Date_Calc::DateToDays(4, 9, -1), '-0001 09 04');
+compare('-0001 09 05', Date_Calc::DaysToDate(1720942, "%Y %m %d"), '1720942');
+compare(1720942, Date_Calc::DateToDays(5, 9, -1), '-0001 09 05');
+compare('-0001 09 06', Date_Calc::DaysToDate(1720943, "%Y %m %d"), '1720943');
+compare(1720943, Date_Calc::DateToDays(6, 9, -1), '-0001 09 06');
+compare('-0001 09 07', Date_Calc::DaysToDate(1720944, "%Y %m %d"), '1720944');
+compare(1720944, Date_Calc::DateToDays(7, 9, -1), '-0001 09 07');
+compare('-0001 09 08', Date_Calc::DaysToDate(1720945, "%Y %m %d"), '1720945');
+compare(1720945, Date_Calc::DateToDays(8, 9, -1), '-0001 09 08');
+compare('-0001 09 09', Date_Calc::DaysToDate(1720946, "%Y %m %d"), '1720946');
+compare(1720946, Date_Calc::DateToDays(9, 9, -1), '-0001 09 09');
+compare('-0001 09 10', Date_Calc::DaysToDate(1720947, "%Y %m %d"), '1720947');
+compare(1720947, Date_Calc::DateToDays(10, 9, -1), '-0001 09 10');
+compare('-0001 09 11', Date_Calc::DaysToDate(1720948, "%Y %m %d"), '1720948');
+compare(1720948, Date_Calc::DateToDays(11, 9, -1), '-0001 09 11');
+compare('-0001 09 12', Date_Calc::DaysToDate(1720949, "%Y %m %d"), '1720949');
+compare(1720949, Date_Calc::DateToDays(12, 9, -1), '-0001 09 12');
+compare('-0001 09 13', Date_Calc::DaysToDate(1720950, "%Y %m %d"), '1720950');
+compare(1720950, Date_Calc::DateToDays(13, 9, -1), '-0001 09 13');
+compare('-0001 09 14', Date_Calc::DaysToDate(1720951, "%Y %m %d"), '1720951');
+compare(1720951, Date_Calc::DateToDays(14, 9, -1), '-0001 09 14');
+compare('-0001 09 15', Date_Calc::DaysToDate(1720952, "%Y %m %d"), '1720952');
+compare(1720952, Date_Calc::DateToDays(15, 9, -1), '-0001 09 15');
+compare('-0001 09 16', Date_Calc::DaysToDate(1720953, "%Y %m %d"), '1720953');
+compare(1720953, Date_Calc::DateToDays(16, 9, -1), '-0001 09 16');
+compare('-0001 09 17', Date_Calc::DaysToDate(1720954, "%Y %m %d"), '1720954');
+compare(1720954, Date_Calc::DateToDays(17, 9, -1), '-0001 09 17');
+compare('-0001 09 18', Date_Calc::DaysToDate(1720955, "%Y %m %d"), '1720955');
+compare(1720955, Date_Calc::DateToDays(18, 9, -1), '-0001 09 18');
+compare('-0001 09 19', Date_Calc::DaysToDate(1720956, "%Y %m %d"), '1720956');
+compare(1720956, Date_Calc::DateToDays(19, 9, -1), '-0001 09 19');
+compare('-0001 09 20', Date_Calc::DaysToDate(1720957, "%Y %m %d"), '1720957');
+compare(1720957, Date_Calc::DateToDays(20, 9, -1), '-0001 09 20');
+compare('-0001 09 21', Date_Calc::DaysToDate(1720958, "%Y %m %d"), '1720958');
+compare(1720958, Date_Calc::DateToDays(21, 9, -1), '-0001 09 21');
+compare('-0001 09 22', Date_Calc::DaysToDate(1720959, "%Y %m %d"), '1720959');
+compare(1720959, Date_Calc::DateToDays(22, 9, -1), '-0001 09 22');
+compare('-0001 09 23', Date_Calc::DaysToDate(1720960, "%Y %m %d"), '1720960');
+compare(1720960, Date_Calc::DateToDays(23, 9, -1), '-0001 09 23');
+compare('-0001 09 24', Date_Calc::DaysToDate(1720961, "%Y %m %d"), '1720961');
+compare(1720961, Date_Calc::DateToDays(24, 9, -1), '-0001 09 24');
+compare('-0001 09 25', Date_Calc::DaysToDate(1720962, "%Y %m %d"), '1720962');
+compare(1720962, Date_Calc::DateToDays(25, 9, -1), '-0001 09 25');
+compare('-0001 09 26', Date_Calc::DaysToDate(1720963, "%Y %m %d"), '1720963');
+compare(1720963, Date_Calc::DateToDays(26, 9, -1), '-0001 09 26');
+compare('-0001 09 27', Date_Calc::DaysToDate(1720964, "%Y %m %d"), '1720964');
+compare(1720964, Date_Calc::DateToDays(27, 9, -1), '-0001 09 27');
+compare('-0001 09 28', Date_Calc::DaysToDate(1720965, "%Y %m %d"), '1720965');
+compare(1720965, Date_Calc::DateToDays(28, 9, -1), '-0001 09 28');
+compare('-0001 09 29', Date_Calc::DaysToDate(1720966, "%Y %m %d"), '1720966');
+compare(1720966, Date_Calc::DateToDays(29, 9, -1), '-0001 09 29');
+compare('-0001 09 30', Date_Calc::DaysToDate(1720967, "%Y %m %d"), '1720967');
+compare(1720967, Date_Calc::DateToDays(30, 9, -1), '-0001 09 30');
+compare('-0001 10 01', Date_Calc::DaysToDate(1720968, "%Y %m %d"), '1720968');
+compare(1720968, Date_Calc::DateToDays(1, 10, -1), '-0001 10 01');
+compare('-0001 10 02', Date_Calc::DaysToDate(1720969, "%Y %m %d"), '1720969');
+compare(1720969, Date_Calc::DateToDays(2, 10, -1), '-0001 10 02');
+compare('-0001 10 03', Date_Calc::DaysToDate(1720970, "%Y %m %d"), '1720970');
+compare(1720970, Date_Calc::DateToDays(3, 10, -1), '-0001 10 03');
+compare('-0001 10 04', Date_Calc::DaysToDate(1720971, "%Y %m %d"), '1720971');
+compare(1720971, Date_Calc::DateToDays(4, 10, -1), '-0001 10 04');
+compare('-0001 10 05', Date_Calc::DaysToDate(1720972, "%Y %m %d"), '1720972');
+compare(1720972, Date_Calc::DateToDays(5, 10, -1), '-0001 10 05');
+compare('-0001 10 06', Date_Calc::DaysToDate(1720973, "%Y %m %d"), '1720973');
+compare(1720973, Date_Calc::DateToDays(6, 10, -1), '-0001 10 06');
+compare('-0001 10 07', Date_Calc::DaysToDate(1720974, "%Y %m %d"), '1720974');
+compare(1720974, Date_Calc::DateToDays(7, 10, -1), '-0001 10 07');
+compare('-0001 10 08', Date_Calc::DaysToDate(1720975, "%Y %m %d"), '1720975');
+compare(1720975, Date_Calc::DateToDays(8, 10, -1), '-0001 10 08');
+compare('-0001 10 09', Date_Calc::DaysToDate(1720976, "%Y %m %d"), '1720976');
+compare(1720976, Date_Calc::DateToDays(9, 10, -1), '-0001 10 09');
+compare('-0001 10 10', Date_Calc::DaysToDate(1720977, "%Y %m %d"), '1720977');
+compare(1720977, Date_Calc::DateToDays(10, 10, -1), '-0001 10 10');
+compare('-0001 10 11', Date_Calc::DaysToDate(1720978, "%Y %m %d"), '1720978');
+compare(1720978, Date_Calc::DateToDays(11, 10, -1), '-0001 10 11');
+compare('-0001 10 12', Date_Calc::DaysToDate(1720979, "%Y %m %d"), '1720979');
+compare(1720979, Date_Calc::DateToDays(12, 10, -1), '-0001 10 12');
+compare('-0001 10 13', Date_Calc::DaysToDate(1720980, "%Y %m %d"), '1720980');
+compare(1720980, Date_Calc::DateToDays(13, 10, -1), '-0001 10 13');
+compare('-0001 10 14', Date_Calc::DaysToDate(1720981, "%Y %m %d"), '1720981');
+compare(1720981, Date_Calc::DateToDays(14, 10, -1), '-0001 10 14');
+compare('-0001 10 15', Date_Calc::DaysToDate(1720982, "%Y %m %d"), '1720982');
+compare(1720982, Date_Calc::DateToDays(15, 10, -1), '-0001 10 15');
+compare('-0001 10 16', Date_Calc::DaysToDate(1720983, "%Y %m %d"), '1720983');
+compare(1720983, Date_Calc::DateToDays(16, 10, -1), '-0001 10 16');
+compare('-0001 10 17', Date_Calc::DaysToDate(1720984, "%Y %m %d"), '1720984');
+compare(1720984, Date_Calc::DateToDays(17, 10, -1), '-0001 10 17');
+compare('-0001 10 18', Date_Calc::DaysToDate(1720985, "%Y %m %d"), '1720985');
+compare(1720985, Date_Calc::DateToDays(18, 10, -1), '-0001 10 18');
+compare('-0001 10 19', Date_Calc::DaysToDate(1720986, "%Y %m %d"), '1720986');
+compare(1720986, Date_Calc::DateToDays(19, 10, -1), '-0001 10 19');
+compare('-0001 10 20', Date_Calc::DaysToDate(1720987, "%Y %m %d"), '1720987');
+compare(1720987, Date_Calc::DateToDays(20, 10, -1), '-0001 10 20');
+compare('-0001 10 21', Date_Calc::DaysToDate(1720988, "%Y %m %d"), '1720988');
+compare(1720988, Date_Calc::DateToDays(21, 10, -1), '-0001 10 21');
+compare('-0001 10 22', Date_Calc::DaysToDate(1720989, "%Y %m %d"), '1720989');
+compare(1720989, Date_Calc::DateToDays(22, 10, -1), '-0001 10 22');
+compare('-0001 10 23', Date_Calc::DaysToDate(1720990, "%Y %m %d"), '1720990');
+compare(1720990, Date_Calc::DateToDays(23, 10, -1), '-0001 10 23');
+compare('-0001 10 24', Date_Calc::DaysToDate(1720991, "%Y %m %d"), '1720991');
+compare(1720991, Date_Calc::DateToDays(24, 10, -1), '-0001 10 24');
+compare('-0001 10 25', Date_Calc::DaysToDate(1720992, "%Y %m %d"), '1720992');
+compare(1720992, Date_Calc::DateToDays(25, 10, -1), '-0001 10 25');
+compare('-0001 10 26', Date_Calc::DaysToDate(1720993, "%Y %m %d"), '1720993');
+compare(1720993, Date_Calc::DateToDays(26, 10, -1), '-0001 10 26');
+compare('-0001 10 27', Date_Calc::DaysToDate(1720994, "%Y %m %d"), '1720994');
+compare(1720994, Date_Calc::DateToDays(27, 10, -1), '-0001 10 27');
+compare('-0001 10 28', Date_Calc::DaysToDate(1720995, "%Y %m %d"), '1720995');
+compare(1720995, Date_Calc::DateToDays(28, 10, -1), '-0001 10 28');
+compare('-0001 10 29', Date_Calc::DaysToDate(1720996, "%Y %m %d"), '1720996');
+compare(1720996, Date_Calc::DateToDays(29, 10, -1), '-0001 10 29');
+compare('-0001 10 30', Date_Calc::DaysToDate(1720997, "%Y %m %d"), '1720997');
+compare(1720997, Date_Calc::DateToDays(30, 10, -1), '-0001 10 30');
+compare('-0001 10 31', Date_Calc::DaysToDate(1720998, "%Y %m %d"), '1720998');
+compare(1720998, Date_Calc::DateToDays(31, 10, -1), '-0001 10 31');
+compare('-0001 11 01', Date_Calc::DaysToDate(1720999, "%Y %m %d"), '1720999');
+compare(1720999, Date_Calc::DateToDays(1, 11, -1), '-0001 11 01');
+compare('-0001 11 02', Date_Calc::DaysToDate(1721000, "%Y %m %d"), '1721000');
+compare(1721000, Date_Calc::DateToDays(2, 11, -1), '-0001 11 02');
+compare('-0001 11 03', Date_Calc::DaysToDate(1721001, "%Y %m %d"), '1721001');
+compare(1721001, Date_Calc::DateToDays(3, 11, -1), '-0001 11 03');
+compare('-0001 11 04', Date_Calc::DaysToDate(1721002, "%Y %m %d"), '1721002');
+compare(1721002, Date_Calc::DateToDays(4, 11, -1), '-0001 11 04');
+compare('-0001 11 05', Date_Calc::DaysToDate(1721003, "%Y %m %d"), '1721003');
+compare(1721003, Date_Calc::DateToDays(5, 11, -1), '-0001 11 05');
+compare('-0001 11 06', Date_Calc::DaysToDate(1721004, "%Y %m %d"), '1721004');
+compare(1721004, Date_Calc::DateToDays(6, 11, -1), '-0001 11 06');
+compare('-0001 11 07', Date_Calc::DaysToDate(1721005, "%Y %m %d"), '1721005');
+compare(1721005, Date_Calc::DateToDays(7, 11, -1), '-0001 11 07');
+compare('-0001 11 08', Date_Calc::DaysToDate(1721006, "%Y %m %d"), '1721006');
+compare(1721006, Date_Calc::DateToDays(8, 11, -1), '-0001 11 08');
+compare('-0001 11 09', Date_Calc::DaysToDate(1721007, "%Y %m %d"), '1721007');
+compare(1721007, Date_Calc::DateToDays(9, 11, -1), '-0001 11 09');
+compare('-0001 11 10', Date_Calc::DaysToDate(1721008, "%Y %m %d"), '1721008');
+compare(1721008, Date_Calc::DateToDays(10, 11, -1), '-0001 11 10');
+compare('-0001 11 11', Date_Calc::DaysToDate(1721009, "%Y %m %d"), '1721009');
+compare(1721009, Date_Calc::DateToDays(11, 11, -1), '-0001 11 11');
+compare('-0001 11 12', Date_Calc::DaysToDate(1721010, "%Y %m %d"), '1721010');
+compare(1721010, Date_Calc::DateToDays(12, 11, -1), '-0001 11 12');
+compare('-0001 11 13', Date_Calc::DaysToDate(1721011, "%Y %m %d"), '1721011');
+compare(1721011, Date_Calc::DateToDays(13, 11, -1), '-0001 11 13');
+compare('-0001 11 14', Date_Calc::DaysToDate(1721012, "%Y %m %d"), '1721012');
+compare(1721012, Date_Calc::DateToDays(14, 11, -1), '-0001 11 14');
+compare('-0001 11 15', Date_Calc::DaysToDate(1721013, "%Y %m %d"), '1721013');
+compare(1721013, Date_Calc::DateToDays(15, 11, -1), '-0001 11 15');
+compare('-0001 11 16', Date_Calc::DaysToDate(1721014, "%Y %m %d"), '1721014');
+compare(1721014, Date_Calc::DateToDays(16, 11, -1), '-0001 11 16');
+compare('-0001 11 17', Date_Calc::DaysToDate(1721015, "%Y %m %d"), '1721015');
+compare(1721015, Date_Calc::DateToDays(17, 11, -1), '-0001 11 17');
+compare('-0001 11 18', Date_Calc::DaysToDate(1721016, "%Y %m %d"), '1721016');
+compare(1721016, Date_Calc::DateToDays(18, 11, -1), '-0001 11 18');
+compare('-0001 11 19', Date_Calc::DaysToDate(1721017, "%Y %m %d"), '1721017');
+compare(1721017, Date_Calc::DateToDays(19, 11, -1), '-0001 11 19');
+compare('-0001 11 20', Date_Calc::DaysToDate(1721018, "%Y %m %d"), '1721018');
+compare(1721018, Date_Calc::DateToDays(20, 11, -1), '-0001 11 20');
+compare('-0001 11 21', Date_Calc::DaysToDate(1721019, "%Y %m %d"), '1721019');
+compare(1721019, Date_Calc::DateToDays(21, 11, -1), '-0001 11 21');
+compare('-0001 11 22', Date_Calc::DaysToDate(1721020, "%Y %m %d"), '1721020');
+compare(1721020, Date_Calc::DateToDays(22, 11, -1), '-0001 11 22');
+compare('-0001 11 23', Date_Calc::DaysToDate(1721021, "%Y %m %d"), '1721021');
+compare(1721021, Date_Calc::DateToDays(23, 11, -1), '-0001 11 23');
+compare('-0001 11 24', Date_Calc::DaysToDate(1721022, "%Y %m %d"), '1721022');
+compare(1721022, Date_Calc::DateToDays(24, 11, -1), '-0001 11 24');
+compare('-0001 11 25', Date_Calc::DaysToDate(1721023, "%Y %m %d"), '1721023');
+compare(1721023, Date_Calc::DateToDays(25, 11, -1), '-0001 11 25');
+compare('-0001 11 26', Date_Calc::DaysToDate(1721024, "%Y %m %d"), '1721024');
+compare(1721024, Date_Calc::DateToDays(26, 11, -1), '-0001 11 26');
+compare('-0001 11 27', Date_Calc::DaysToDate(1721025, "%Y %m %d"), '1721025');
+compare(1721025, Date_Calc::DateToDays(27, 11, -1), '-0001 11 27');
+compare('-0001 11 28', Date_Calc::DaysToDate(1721026, "%Y %m %d"), '1721026');
+compare(1721026, Date_Calc::DateToDays(28, 11, -1), '-0001 11 28');
+compare('-0001 11 29', Date_Calc::DaysToDate(1721027, "%Y %m %d"), '1721027');
+compare(1721027, Date_Calc::DateToDays(29, 11, -1), '-0001 11 29');
+compare('-0001 11 30', Date_Calc::DaysToDate(1721028, "%Y %m %d"), '1721028');
+compare(1721028, Date_Calc::DateToDays(30, 11, -1), '-0001 11 30');
+compare('-0001 12 01', Date_Calc::DaysToDate(1721029, "%Y %m %d"), '1721029');
+compare(1721029, Date_Calc::DateToDays(1, 12, -1), '-0001 12 01');
+compare('-0001 12 02', Date_Calc::DaysToDate(1721030, "%Y %m %d"), '1721030');
+compare(1721030, Date_Calc::DateToDays(2, 12, -1), '-0001 12 02');
+compare('-0001 12 03', Date_Calc::DaysToDate(1721031, "%Y %m %d"), '1721031');
+compare(1721031, Date_Calc::DateToDays(3, 12, -1), '-0001 12 03');
+compare('-0001 12 04', Date_Calc::DaysToDate(1721032, "%Y %m %d"), '1721032');
+compare(1721032, Date_Calc::DateToDays(4, 12, -1), '-0001 12 04');
+compare('-0001 12 05', Date_Calc::DaysToDate(1721033, "%Y %m %d"), '1721033');
+compare(1721033, Date_Calc::DateToDays(5, 12, -1), '-0001 12 05');
+compare('-0001 12 06', Date_Calc::DaysToDate(1721034, "%Y %m %d"), '1721034');
+compare(1721034, Date_Calc::DateToDays(6, 12, -1), '-0001 12 06');
+compare('-0001 12 07', Date_Calc::DaysToDate(1721035, "%Y %m %d"), '1721035');
+compare(1721035, Date_Calc::DateToDays(7, 12, -1), '-0001 12 07');
+compare('-0001 12 08', Date_Calc::DaysToDate(1721036, "%Y %m %d"), '1721036');
+compare(1721036, Date_Calc::DateToDays(8, 12, -1), '-0001 12 08');
+compare('-0001 12 09', Date_Calc::DaysToDate(1721037, "%Y %m %d"), '1721037');
+compare(1721037, Date_Calc::DateToDays(9, 12, -1), '-0001 12 09');
+compare('-0001 12 10', Date_Calc::DaysToDate(1721038, "%Y %m %d"), '1721038');
+compare(1721038, Date_Calc::DateToDays(10, 12, -1), '-0001 12 10');
+compare('-0001 12 11', Date_Calc::DaysToDate(1721039, "%Y %m %d"), '1721039');
+compare(1721039, Date_Calc::DateToDays(11, 12, -1), '-0001 12 11');
+compare('-0001 12 12', Date_Calc::DaysToDate(1721040, "%Y %m %d"), '1721040');
+compare(1721040, Date_Calc::DateToDays(12, 12, -1), '-0001 12 12');
+compare('-0001 12 13', Date_Calc::DaysToDate(1721041, "%Y %m %d"), '1721041');
+compare(1721041, Date_Calc::DateToDays(13, 12, -1), '-0001 12 13');
+compare('-0001 12 14', Date_Calc::DaysToDate(1721042, "%Y %m %d"), '1721042');
+compare(1721042, Date_Calc::DateToDays(14, 12, -1), '-0001 12 14');
+compare('-0001 12 15', Date_Calc::DaysToDate(1721043, "%Y %m %d"), '1721043');
+compare(1721043, Date_Calc::DateToDays(15, 12, -1), '-0001 12 15');
+compare('-0001 12 16', Date_Calc::DaysToDate(1721044, "%Y %m %d"), '1721044');
+compare(1721044, Date_Calc::DateToDays(16, 12, -1), '-0001 12 16');
+compare('-0001 12 17', Date_Calc::DaysToDate(1721045, "%Y %m %d"), '1721045');
+compare(1721045, Date_Calc::DateToDays(17, 12, -1), '-0001 12 17');
+compare('-0001 12 18', Date_Calc::DaysToDate(1721046, "%Y %m %d"), '1721046');
+compare(1721046, Date_Calc::DateToDays(18, 12, -1), '-0001 12 18');
+compare('-0001 12 19', Date_Calc::DaysToDate(1721047, "%Y %m %d"), '1721047');
+compare(1721047, Date_Calc::DateToDays(19, 12, -1), '-0001 12 19');
+compare('-0001 12 20', Date_Calc::DaysToDate(1721048, "%Y %m %d"), '1721048');
+compare(1721048, Date_Calc::DateToDays(20, 12, -1), '-0001 12 20');
+compare('-0001 12 21', Date_Calc::DaysToDate(1721049, "%Y %m %d"), '1721049');
+compare(1721049, Date_Calc::DateToDays(21, 12, -1), '-0001 12 21');
+compare('-0001 12 22', Date_Calc::DaysToDate(1721050, "%Y %m %d"), '1721050');
+compare(1721050, Date_Calc::DateToDays(22, 12, -1), '-0001 12 22');
+compare('-0001 12 23', Date_Calc::DaysToDate(1721051, "%Y %m %d"), '1721051');
+compare(1721051, Date_Calc::DateToDays(23, 12, -1), '-0001 12 23');
+compare('-0001 12 24', Date_Calc::DaysToDate(1721052, "%Y %m %d"), '1721052');
+compare(1721052, Date_Calc::DateToDays(24, 12, -1), '-0001 12 24');
+compare('-0001 12 25', Date_Calc::DaysToDate(1721053, "%Y %m %d"), '1721053');
+compare(1721053, Date_Calc::DateToDays(25, 12, -1), '-0001 12 25');
+compare('-0001 12 26', Date_Calc::DaysToDate(1721054, "%Y %m %d"), '1721054');
+compare(1721054, Date_Calc::DateToDays(26, 12, -1), '-0001 12 26');
+compare('-0001 12 27', Date_Calc::DaysToDate(1721055, "%Y %m %d"), '1721055');
+compare(1721055, Date_Calc::DateToDays(27, 12, -1), '-0001 12 27');
+compare('-0001 12 28', Date_Calc::DaysToDate(1721056, "%Y %m %d"), '1721056');
+compare(1721056, Date_Calc::DateToDays(28, 12, -1), '-0001 12 28');
+compare('-0001 12 29', Date_Calc::DaysToDate(1721057, "%Y %m %d"), '1721057');
+compare(1721057, Date_Calc::DateToDays(29, 12, -1), '-0001 12 29');
+compare('-0001 12 30', Date_Calc::DaysToDate(1721058, "%Y %m %d"), '1721058');
+compare(1721058, Date_Calc::DateToDays(30, 12, -1), '-0001 12 30');
+compare('-0001 12 31', Date_Calc::DaysToDate(1721059, "%Y %m %d"), '1721059');
+compare(1721059, Date_Calc::DateToDays(31, 12, -1), '-0001 12 31');
+compare('0000 01 01', Date_Calc::DaysToDate(1721060, "%Y %m %d"), '1721060');
+compare(1721060, Date_Calc::DateToDays(1, 1, 0), '0000 01 01');
+compare('0000 01 02', Date_Calc::DaysToDate(1721061, "%Y %m %d"), '1721061');
+compare(1721061, Date_Calc::DateToDays(2, 1, 0), '0000 01 02');
+compare('0000 01 03', Date_Calc::DaysToDate(1721062, "%Y %m %d"), '1721062');
+compare(1721062, Date_Calc::DateToDays(3, 1, 0), '0000 01 03');
+compare('0000 01 04', Date_Calc::DaysToDate(1721063, "%Y %m %d"), '1721063');
+compare(1721063, Date_Calc::DateToDays(4, 1, 0), '0000 01 04');
+compare('0000 01 05', Date_Calc::DaysToDate(1721064, "%Y %m %d"), '1721064');
+compare(1721064, Date_Calc::DateToDays(5, 1, 0), '0000 01 05');
+compare('0000 01 06', Date_Calc::DaysToDate(1721065, "%Y %m %d"), '1721065');
+compare(1721065, Date_Calc::DateToDays(6, 1, 0), '0000 01 06');
+compare('0000 01 07', Date_Calc::DaysToDate(1721066, "%Y %m %d"), '1721066');
+compare(1721066, Date_Calc::DateToDays(7, 1, 0), '0000 01 07');
+compare('0000 01 08', Date_Calc::DaysToDate(1721067, "%Y %m %d"), '1721067');
+compare(1721067, Date_Calc::DateToDays(8, 1, 0), '0000 01 08');
+compare('0000 01 09', Date_Calc::DaysToDate(1721068, "%Y %m %d"), '1721068');
+compare(1721068, Date_Calc::DateToDays(9, 1, 0), '0000 01 09');
+compare('0000 01 10', Date_Calc::DaysToDate(1721069, "%Y %m %d"), '1721069');
+compare(1721069, Date_Calc::DateToDays(10, 1, 0), '0000 01 10');
+compare('0000 01 11', Date_Calc::DaysToDate(1721070, "%Y %m %d"), '1721070');
+compare(1721070, Date_Calc::DateToDays(11, 1, 0), '0000 01 11');
+compare('0000 01 12', Date_Calc::DaysToDate(1721071, "%Y %m %d"), '1721071');
+compare(1721071, Date_Calc::DateToDays(12, 1, 0), '0000 01 12');
+compare('0000 01 13', Date_Calc::DaysToDate(1721072, "%Y %m %d"), '1721072');
+compare(1721072, Date_Calc::DateToDays(13, 1, 0), '0000 01 13');
+compare('0000 01 14', Date_Calc::DaysToDate(1721073, "%Y %m %d"), '1721073');
+compare(1721073, Date_Calc::DateToDays(14, 1, 0), '0000 01 14');
+compare('0000 01 15', Date_Calc::DaysToDate(1721074, "%Y %m %d"), '1721074');
+compare(1721074, Date_Calc::DateToDays(15, 1, 0), '0000 01 15');
+compare('0000 01 16', Date_Calc::DaysToDate(1721075, "%Y %m %d"), '1721075');
+compare(1721075, Date_Calc::DateToDays(16, 1, 0), '0000 01 16');
+compare('0000 01 17', Date_Calc::DaysToDate(1721076, "%Y %m %d"), '1721076');
+compare(1721076, Date_Calc::DateToDays(17, 1, 0), '0000 01 17');
+compare('0000 01 18', Date_Calc::DaysToDate(1721077, "%Y %m %d"), '1721077');
+compare(1721077, Date_Calc::DateToDays(18, 1, 0), '0000 01 18');
+compare('0000 01 19', Date_Calc::DaysToDate(1721078, "%Y %m %d"), '1721078');
+compare(1721078, Date_Calc::DateToDays(19, 1, 0), '0000 01 19');
+compare('0000 01 20', Date_Calc::DaysToDate(1721079, "%Y %m %d"), '1721079');
+compare(1721079, Date_Calc::DateToDays(20, 1, 0), '0000 01 20');
+compare('0000 01 21', Date_Calc::DaysToDate(1721080, "%Y %m %d"), '1721080');
+compare(1721080, Date_Calc::DateToDays(21, 1, 0), '0000 01 21');
+compare('0000 01 22', Date_Calc::DaysToDate(1721081, "%Y %m %d"), '1721081');
+compare(1721081, Date_Calc::DateToDays(22, 1, 0), '0000 01 22');
+compare('0000 01 23', Date_Calc::DaysToDate(1721082, "%Y %m %d"), '1721082');
+compare(1721082, Date_Calc::DateToDays(23, 1, 0), '0000 01 23');
+compare('0000 01 24', Date_Calc::DaysToDate(1721083, "%Y %m %d"), '1721083');
+compare(1721083, Date_Calc::DateToDays(24, 1, 0), '0000 01 24');
+compare('0000 01 25', Date_Calc::DaysToDate(1721084, "%Y %m %d"), '1721084');
+compare(1721084, Date_Calc::DateToDays(25, 1, 0), '0000 01 25');
+compare('0000 01 26', Date_Calc::DaysToDate(1721085, "%Y %m %d"), '1721085');
+compare(1721085, Date_Calc::DateToDays(26, 1, 0), '0000 01 26');
+compare('0000 01 27', Date_Calc::DaysToDate(1721086, "%Y %m %d"), '1721086');
+compare(1721086, Date_Calc::DateToDays(27, 1, 0), '0000 01 27');
+compare('0000 01 28', Date_Calc::DaysToDate(1721087, "%Y %m %d"), '1721087');
+compare(1721087, Date_Calc::DateToDays(28, 1, 0), '0000 01 28');
+compare('0000 01 29', Date_Calc::DaysToDate(1721088, "%Y %m %d"), '1721088');
+compare(1721088, Date_Calc::DateToDays(29, 1, 0), '0000 01 29');
+compare('0000 01 30', Date_Calc::DaysToDate(1721089, "%Y %m %d"), '1721089');
+compare(1721089, Date_Calc::DateToDays(30, 1, 0), '0000 01 30');
+compare('0000 01 31', Date_Calc::DaysToDate(1721090, "%Y %m %d"), '1721090');
+compare(1721090, Date_Calc::DateToDays(31, 1, 0), '0000 01 31');
+compare('0000 02 01', Date_Calc::DaysToDate(1721091, "%Y %m %d"), '1721091');
+compare(1721091, Date_Calc::DateToDays(1, 2, 0), '0000 02 01');
+compare('0000 02 02', Date_Calc::DaysToDate(1721092, "%Y %m %d"), '1721092');
+compare(1721092, Date_Calc::DateToDays(2, 2, 0), '0000 02 02');
+compare('0000 02 03', Date_Calc::DaysToDate(1721093, "%Y %m %d"), '1721093');
+compare(1721093, Date_Calc::DateToDays(3, 2, 0), '0000 02 03');
+compare('0000 02 04', Date_Calc::DaysToDate(1721094, "%Y %m %d"), '1721094');
+compare(1721094, Date_Calc::DateToDays(4, 2, 0), '0000 02 04');
+compare('0000 02 05', Date_Calc::DaysToDate(1721095, "%Y %m %d"), '1721095');
+compare(1721095, Date_Calc::DateToDays(5, 2, 0), '0000 02 05');
+compare('0000 02 06', Date_Calc::DaysToDate(1721096, "%Y %m %d"), '1721096');
+compare(1721096, Date_Calc::DateToDays(6, 2, 0), '0000 02 06');
+compare('0000 02 07', Date_Calc::DaysToDate(1721097, "%Y %m %d"), '1721097');
+compare(1721097, Date_Calc::DateToDays(7, 2, 0), '0000 02 07');
+compare('0000 02 08', Date_Calc::DaysToDate(1721098, "%Y %m %d"), '1721098');
+compare(1721098, Date_Calc::DateToDays(8, 2, 0), '0000 02 08');
+compare('0000 02 09', Date_Calc::DaysToDate(1721099, "%Y %m %d"), '1721099');
+compare(1721099, Date_Calc::DateToDays(9, 2, 0), '0000 02 09');
+compare('0000 02 10', Date_Calc::DaysToDate(1721100, "%Y %m %d"), '1721100');
+compare(1721100, Date_Calc::DateToDays(10, 2, 0), '0000 02 10');
+compare('0000 02 11', Date_Calc::DaysToDate(1721101, "%Y %m %d"), '1721101');
+compare(1721101, Date_Calc::DateToDays(11, 2, 0), '0000 02 11');
+compare('0000 02 12', Date_Calc::DaysToDate(1721102, "%Y %m %d"), '1721102');
+compare(1721102, Date_Calc::DateToDays(12, 2, 0), '0000 02 12');
+compare('0000 02 13', Date_Calc::DaysToDate(1721103, "%Y %m %d"), '1721103');
+compare(1721103, Date_Calc::DateToDays(13, 2, 0), '0000 02 13');
+compare('0000 02 14', Date_Calc::DaysToDate(1721104, "%Y %m %d"), '1721104');
+compare(1721104, Date_Calc::DateToDays(14, 2, 0), '0000 02 14');
+compare('0000 02 15', Date_Calc::DaysToDate(1721105, "%Y %m %d"), '1721105');
+compare(1721105, Date_Calc::DateToDays(15, 2, 0), '0000 02 15');
+compare('0000 02 16', Date_Calc::DaysToDate(1721106, "%Y %m %d"), '1721106');
+compare(1721106, Date_Calc::DateToDays(16, 2, 0), '0000 02 16');
+compare('0000 02 17', Date_Calc::DaysToDate(1721107, "%Y %m %d"), '1721107');
+compare(1721107, Date_Calc::DateToDays(17, 2, 0), '0000 02 17');
+compare('0000 02 18', Date_Calc::DaysToDate(1721108, "%Y %m %d"), '1721108');
+compare(1721108, Date_Calc::DateToDays(18, 2, 0), '0000 02 18');
+compare('0000 02 19', Date_Calc::DaysToDate(1721109, "%Y %m %d"), '1721109');
+compare(1721109, Date_Calc::DateToDays(19, 2, 0), '0000 02 19');
+compare('0000 02 20', Date_Calc::DaysToDate(1721110, "%Y %m %d"), '1721110');
+compare(1721110, Date_Calc::DateToDays(20, 2, 0), '0000 02 20');
+compare('0000 02 21', Date_Calc::DaysToDate(1721111, "%Y %m %d"), '1721111');
+compare(1721111, Date_Calc::DateToDays(21, 2, 0), '0000 02 21');
+compare('0000 02 22', Date_Calc::DaysToDate(1721112, "%Y %m %d"), '1721112');
+compare(1721112, Date_Calc::DateToDays(22, 2, 0), '0000 02 22');
+compare('0000 02 23', Date_Calc::DaysToDate(1721113, "%Y %m %d"), '1721113');
+compare(1721113, Date_Calc::DateToDays(23, 2, 0), '0000 02 23');
+compare('0000 02 24', Date_Calc::DaysToDate(1721114, "%Y %m %d"), '1721114');
+compare(1721114, Date_Calc::DateToDays(24, 2, 0), '0000 02 24');
+compare('0000 02 25', Date_Calc::DaysToDate(1721115, "%Y %m %d"), '1721115');
+compare(1721115, Date_Calc::DateToDays(25, 2, 0), '0000 02 25');
+compare('0000 02 26', Date_Calc::DaysToDate(1721116, "%Y %m %d"), '1721116');
+compare(1721116, Date_Calc::DateToDays(26, 2, 0), '0000 02 26');
+compare('0000 02 27', Date_Calc::DaysToDate(1721117, "%Y %m %d"), '1721117');
+compare(1721117, Date_Calc::DateToDays(27, 2, 0), '0000 02 27');
+compare('0000 02 28', Date_Calc::DaysToDate(1721118, "%Y %m %d"), '1721118');
+compare(1721118, Date_Calc::DateToDays(28, 2, 0), '0000 02 28');
+compare('0000 02 29', Date_Calc::DaysToDate(1721119, "%Y %m %d"), '1721119');
+compare(1721119, Date_Calc::DateToDays(29, 2, 0), '0000 02 29');
+compare('0000 03 01', Date_Calc::DaysToDate(1721120, "%Y %m %d"), '1721120');
+compare(1721120, Date_Calc::DateToDays(1, 3, 0), '0000 03 01');
+compare('0000 03 02', Date_Calc::DaysToDate(1721121, "%Y %m %d"), '1721121');
+compare(1721121, Date_Calc::DateToDays(2, 3, 0), '0000 03 02');
+compare('0000 03 03', Date_Calc::DaysToDate(1721122, "%Y %m %d"), '1721122');
+compare(1721122, Date_Calc::DateToDays(3, 3, 0), '0000 03 03');
+compare('0000 03 04', Date_Calc::DaysToDate(1721123, "%Y %m %d"), '1721123');
+compare(1721123, Date_Calc::DateToDays(4, 3, 0), '0000 03 04');
+compare('0000 03 05', Date_Calc::DaysToDate(1721124, "%Y %m %d"), '1721124');
+compare(1721124, Date_Calc::DateToDays(5, 3, 0), '0000 03 05');
+compare('0000 03 06', Date_Calc::DaysToDate(1721125, "%Y %m %d"), '1721125');
+compare(1721125, Date_Calc::DateToDays(6, 3, 0), '0000 03 06');
+compare('0000 03 07', Date_Calc::DaysToDate(1721126, "%Y %m %d"), '1721126');
+compare(1721126, Date_Calc::DateToDays(7, 3, 0), '0000 03 07');
+compare('0000 03 08', Date_Calc::DaysToDate(1721127, "%Y %m %d"), '1721127');
+compare(1721127, Date_Calc::DateToDays(8, 3, 0), '0000 03 08');
+compare('0000 03 09', Date_Calc::DaysToDate(1721128, "%Y %m %d"), '1721128');
+compare(1721128, Date_Calc::DateToDays(9, 3, 0), '0000 03 09');
+compare('0000 03 10', Date_Calc::DaysToDate(1721129, "%Y %m %d"), '1721129');
+compare(1721129, Date_Calc::DateToDays(10, 3, 0), '0000 03 10');
+compare('0000 03 11', Date_Calc::DaysToDate(1721130, "%Y %m %d"), '1721130');
+compare(1721130, Date_Calc::DateToDays(11, 3, 0), '0000 03 11');
+compare('0000 03 12', Date_Calc::DaysToDate(1721131, "%Y %m %d"), '1721131');
+compare(1721131, Date_Calc::DateToDays(12, 3, 0), '0000 03 12');
+compare('0000 03 13', Date_Calc::DaysToDate(1721132, "%Y %m %d"), '1721132');
+compare(1721132, Date_Calc::DateToDays(13, 3, 0), '0000 03 13');
+compare('0000 03 14', Date_Calc::DaysToDate(1721133, "%Y %m %d"), '1721133');
+compare(1721133, Date_Calc::DateToDays(14, 3, 0), '0000 03 14');
+compare('0000 03 15', Date_Calc::DaysToDate(1721134, "%Y %m %d"), '1721134');
+compare(1721134, Date_Calc::DateToDays(15, 3, 0), '0000 03 15');
+compare('0000 03 16', Date_Calc::DaysToDate(1721135, "%Y %m %d"), '1721135');
+compare(1721135, Date_Calc::DateToDays(16, 3, 0), '0000 03 16');
+compare('0000 03 17', Date_Calc::DaysToDate(1721136, "%Y %m %d"), '1721136');
+compare(1721136, Date_Calc::DateToDays(17, 3, 0), '0000 03 17');
+compare('0000 03 18', Date_Calc::DaysToDate(1721137, "%Y %m %d"), '1721137');
+compare(1721137, Date_Calc::DateToDays(18, 3, 0), '0000 03 18');
+compare('0000 03 19', Date_Calc::DaysToDate(1721138, "%Y %m %d"), '1721138');
+compare(1721138, Date_Calc::DateToDays(19, 3, 0), '0000 03 19');
+compare('0000 03 20', Date_Calc::DaysToDate(1721139, "%Y %m %d"), '1721139');
+compare(1721139, Date_Calc::DateToDays(20, 3, 0), '0000 03 20');
+compare('0000 03 21', Date_Calc::DaysToDate(1721140, "%Y %m %d"), '1721140');
+compare(1721140, Date_Calc::DateToDays(21, 3, 0), '0000 03 21');
+compare('0000 03 22', Date_Calc::DaysToDate(1721141, "%Y %m %d"), '1721141');
+compare(1721141, Date_Calc::DateToDays(22, 3, 0), '0000 03 22');
+compare('0000 03 23', Date_Calc::DaysToDate(1721142, "%Y %m %d"), '1721142');
+compare(1721142, Date_Calc::DateToDays(23, 3, 0), '0000 03 23');
+compare('0000 03 24', Date_Calc::DaysToDate(1721143, "%Y %m %d"), '1721143');
+compare(1721143, Date_Calc::DateToDays(24, 3, 0), '0000 03 24');
+compare('0000 03 25', Date_Calc::DaysToDate(1721144, "%Y %m %d"), '1721144');
+compare(1721144, Date_Calc::DateToDays(25, 3, 0), '0000 03 25');
+compare('0000 03 26', Date_Calc::DaysToDate(1721145, "%Y %m %d"), '1721145');
+compare(1721145, Date_Calc::DateToDays(26, 3, 0), '0000 03 26');
+compare('0000 03 27', Date_Calc::DaysToDate(1721146, "%Y %m %d"), '1721146');
+compare(1721146, Date_Calc::DateToDays(27, 3, 0), '0000 03 27');
+compare('0000 03 28', Date_Calc::DaysToDate(1721147, "%Y %m %d"), '1721147');
+compare(1721147, Date_Calc::DateToDays(28, 3, 0), '0000 03 28');
+compare('0000 03 29', Date_Calc::DaysToDate(1721148, "%Y %m %d"), '1721148');
+compare(1721148, Date_Calc::DateToDays(29, 3, 0), '0000 03 29');
+compare('0000 03 30', Date_Calc::DaysToDate(1721149, "%Y %m %d"), '1721149');
+compare(1721149, Date_Calc::DateToDays(30, 3, 0), '0000 03 30');
+compare('0000 03 31', Date_Calc::DaysToDate(1721150, "%Y %m %d"), '1721150');
+compare(1721150, Date_Calc::DateToDays(31, 3, 0), '0000 03 31');
+compare('0000 04 01', Date_Calc::DaysToDate(1721151, "%Y %m %d"), '1721151');
+compare(1721151, Date_Calc::DateToDays(1, 4, 0), '0000 04 01');
+compare('0000 04 02', Date_Calc::DaysToDate(1721152, "%Y %m %d"), '1721152');
+compare(1721152, Date_Calc::DateToDays(2, 4, 0), '0000 04 02');
+compare('0000 04 03', Date_Calc::DaysToDate(1721153, "%Y %m %d"), '1721153');
+compare(1721153, Date_Calc::DateToDays(3, 4, 0), '0000 04 03');
+compare('0000 04 04', Date_Calc::DaysToDate(1721154, "%Y %m %d"), '1721154');
+compare(1721154, Date_Calc::DateToDays(4, 4, 0), '0000 04 04');
+compare('0000 04 05', Date_Calc::DaysToDate(1721155, "%Y %m %d"), '1721155');
+compare(1721155, Date_Calc::DateToDays(5, 4, 0), '0000 04 05');
+compare('0000 04 06', Date_Calc::DaysToDate(1721156, "%Y %m %d"), '1721156');
+compare(1721156, Date_Calc::DateToDays(6, 4, 0), '0000 04 06');
+compare('0000 04 07', Date_Calc::DaysToDate(1721157, "%Y %m %d"), '1721157');
+compare(1721157, Date_Calc::DateToDays(7, 4, 0), '0000 04 07');
+compare('0000 04 08', Date_Calc::DaysToDate(1721158, "%Y %m %d"), '1721158');
+compare(1721158, Date_Calc::DateToDays(8, 4, 0), '0000 04 08');
+compare('0000 04 09', Date_Calc::DaysToDate(1721159, "%Y %m %d"), '1721159');
+compare(1721159, Date_Calc::DateToDays(9, 4, 0), '0000 04 09');
+compare('0000 04 10', Date_Calc::DaysToDate(1721160, "%Y %m %d"), '1721160');
+compare(1721160, Date_Calc::DateToDays(10, 4, 0), '0000 04 10');
+compare('0000 04 11', Date_Calc::DaysToDate(1721161, "%Y %m %d"), '1721161');
+compare(1721161, Date_Calc::DateToDays(11, 4, 0), '0000 04 11');
+compare('0000 04 12', Date_Calc::DaysToDate(1721162, "%Y %m %d"), '1721162');
+compare(1721162, Date_Calc::DateToDays(12, 4, 0), '0000 04 12');
+compare('0000 04 13', Date_Calc::DaysToDate(1721163, "%Y %m %d"), '1721163');
+compare(1721163, Date_Calc::DateToDays(13, 4, 0), '0000 04 13');
+compare('0000 04 14', Date_Calc::DaysToDate(1721164, "%Y %m %d"), '1721164');
+compare(1721164, Date_Calc::DateToDays(14, 4, 0), '0000 04 14');
+compare('0000 04 15', Date_Calc::DaysToDate(1721165, "%Y %m %d"), '1721165');
+compare(1721165, Date_Calc::DateToDays(15, 4, 0), '0000 04 15');
+compare('0000 04 16', Date_Calc::DaysToDate(1721166, "%Y %m %d"), '1721166');
+compare(1721166, Date_Calc::DateToDays(16, 4, 0), '0000 04 16');
+compare('0000 04 17', Date_Calc::DaysToDate(1721167, "%Y %m %d"), '1721167');
+compare(1721167, Date_Calc::DateToDays(17, 4, 0), '0000 04 17');
+compare('0000 04 18', Date_Calc::DaysToDate(1721168, "%Y %m %d"), '1721168');
+compare(1721168, Date_Calc::DateToDays(18, 4, 0), '0000 04 18');
+compare('0000 04 19', Date_Calc::DaysToDate(1721169, "%Y %m %d"), '1721169');
+compare(1721169, Date_Calc::DateToDays(19, 4, 0), '0000 04 19');
+compare('0000 04 20', Date_Calc::DaysToDate(1721170, "%Y %m %d"), '1721170');
+compare(1721170, Date_Calc::DateToDays(20, 4, 0), '0000 04 20');
+compare('0000 04 21', Date_Calc::DaysToDate(1721171, "%Y %m %d"), '1721171');
+compare(1721171, Date_Calc::DateToDays(21, 4, 0), '0000 04 21');
+compare('0000 04 22', Date_Calc::DaysToDate(1721172, "%Y %m %d"), '1721172');
+compare(1721172, Date_Calc::DateToDays(22, 4, 0), '0000 04 22');
+compare('0000 04 23', Date_Calc::DaysToDate(1721173, "%Y %m %d"), '1721173');
+compare(1721173, Date_Calc::DateToDays(23, 4, 0), '0000 04 23');
+compare('0000 04 24', Date_Calc::DaysToDate(1721174, "%Y %m %d"), '1721174');
+compare(1721174, Date_Calc::DateToDays(24, 4, 0), '0000 04 24');
+compare('0000 04 25', Date_Calc::DaysToDate(1721175, "%Y %m %d"), '1721175');
+compare(1721175, Date_Calc::DateToDays(25, 4, 0), '0000 04 25');
+compare('0000 04 26', Date_Calc::DaysToDate(1721176, "%Y %m %d"), '1721176');
+compare(1721176, Date_Calc::DateToDays(26, 4, 0), '0000 04 26');
+compare('0000 04 27', Date_Calc::DaysToDate(1721177, "%Y %m %d"), '1721177');
+compare(1721177, Date_Calc::DateToDays(27, 4, 0), '0000 04 27');
+compare('0000 04 28', Date_Calc::DaysToDate(1721178, "%Y %m %d"), '1721178');
+compare(1721178, Date_Calc::DateToDays(28, 4, 0), '0000 04 28');
+compare('0000 04 29', Date_Calc::DaysToDate(1721179, "%Y %m %d"), '1721179');
+compare(1721179, Date_Calc::DateToDays(29, 4, 0), '0000 04 29');
+compare('0000 04 30', Date_Calc::DaysToDate(1721180, "%Y %m %d"), '1721180');
+compare(1721180, Date_Calc::DateToDays(30, 4, 0), '0000 04 30');
+compare('0000 05 01', Date_Calc::DaysToDate(1721181, "%Y %m %d"), '1721181');
+compare(1721181, Date_Calc::DateToDays(1, 5, 0), '0000 05 01');
+compare('0000 05 02', Date_Calc::DaysToDate(1721182, "%Y %m %d"), '1721182');
+compare(1721182, Date_Calc::DateToDays(2, 5, 0), '0000 05 02');
+compare('0000 05 03', Date_Calc::DaysToDate(1721183, "%Y %m %d"), '1721183');
+compare(1721183, Date_Calc::DateToDays(3, 5, 0), '0000 05 03');
+compare('0000 05 04', Date_Calc::DaysToDate(1721184, "%Y %m %d"), '1721184');
+compare(1721184, Date_Calc::DateToDays(4, 5, 0), '0000 05 04');
+compare('0000 05 05', Date_Calc::DaysToDate(1721185, "%Y %m %d"), '1721185');
+compare(1721185, Date_Calc::DateToDays(5, 5, 0), '0000 05 05');
+compare('0000 05 06', Date_Calc::DaysToDate(1721186, "%Y %m %d"), '1721186');
+compare(1721186, Date_Calc::DateToDays(6, 5, 0), '0000 05 06');
+compare('0000 05 07', Date_Calc::DaysToDate(1721187, "%Y %m %d"), '1721187');
+compare(1721187, Date_Calc::DateToDays(7, 5, 0), '0000 05 07');
+compare('0000 05 08', Date_Calc::DaysToDate(1721188, "%Y %m %d"), '1721188');
+compare(1721188, Date_Calc::DateToDays(8, 5, 0), '0000 05 08');
+compare('0000 05 09', Date_Calc::DaysToDate(1721189, "%Y %m %d"), '1721189');
+compare(1721189, Date_Calc::DateToDays(9, 5, 0), '0000 05 09');
+compare('0000 05 10', Date_Calc::DaysToDate(1721190, "%Y %m %d"), '1721190');
+compare(1721190, Date_Calc::DateToDays(10, 5, 0), '0000 05 10');
+compare('0000 05 11', Date_Calc::DaysToDate(1721191, "%Y %m %d"), '1721191');
+compare(1721191, Date_Calc::DateToDays(11, 5, 0), '0000 05 11');
+compare('0000 05 12', Date_Calc::DaysToDate(1721192, "%Y %m %d"), '1721192');
+compare(1721192, Date_Calc::DateToDays(12, 5, 0), '0000 05 12');
+compare('0000 05 13', Date_Calc::DaysToDate(1721193, "%Y %m %d"), '1721193');
+compare(1721193, Date_Calc::DateToDays(13, 5, 0), '0000 05 13');
+compare('0000 05 14', Date_Calc::DaysToDate(1721194, "%Y %m %d"), '1721194');
+compare(1721194, Date_Calc::DateToDays(14, 5, 0), '0000 05 14');
+compare('0000 05 15', Date_Calc::DaysToDate(1721195, "%Y %m %d"), '1721195');
+compare(1721195, Date_Calc::DateToDays(15, 5, 0), '0000 05 15');
+compare('0000 05 16', Date_Calc::DaysToDate(1721196, "%Y %m %d"), '1721196');
+compare(1721196, Date_Calc::DateToDays(16, 5, 0), '0000 05 16');
+compare('0000 05 17', Date_Calc::DaysToDate(1721197, "%Y %m %d"), '1721197');
+compare(1721197, Date_Calc::DateToDays(17, 5, 0), '0000 05 17');
+compare('0000 05 18', Date_Calc::DaysToDate(1721198, "%Y %m %d"), '1721198');
+compare(1721198, Date_Calc::DateToDays(18, 5, 0), '0000 05 18');
+compare('0000 05 19', Date_Calc::DaysToDate(1721199, "%Y %m %d"), '1721199');
+compare(1721199, Date_Calc::DateToDays(19, 5, 0), '0000 05 19');
+compare('0000 05 20', Date_Calc::DaysToDate(1721200, "%Y %m %d"), '1721200');
+compare(1721200, Date_Calc::DateToDays(20, 5, 0), '0000 05 20');
+compare('0000 05 21', Date_Calc::DaysToDate(1721201, "%Y %m %d"), '1721201');
+compare(1721201, Date_Calc::DateToDays(21, 5, 0), '0000 05 21');
+compare('0000 05 22', Date_Calc::DaysToDate(1721202, "%Y %m %d"), '1721202');
+compare(1721202, Date_Calc::DateToDays(22, 5, 0), '0000 05 22');
+compare('0000 05 23', Date_Calc::DaysToDate(1721203, "%Y %m %d"), '1721203');
+compare(1721203, Date_Calc::DateToDays(23, 5, 0), '0000 05 23');
+compare('0000 05 24', Date_Calc::DaysToDate(1721204, "%Y %m %d"), '1721204');
+compare(1721204, Date_Calc::DateToDays(24, 5, 0), '0000 05 24');
+compare('0000 05 25', Date_Calc::DaysToDate(1721205, "%Y %m %d"), '1721205');
+compare(1721205, Date_Calc::DateToDays(25, 5, 0), '0000 05 25');
+compare('0000 05 26', Date_Calc::DaysToDate(1721206, "%Y %m %d"), '1721206');
+compare(1721206, Date_Calc::DateToDays(26, 5, 0), '0000 05 26');
+compare('0000 05 27', Date_Calc::DaysToDate(1721207, "%Y %m %d"), '1721207');
+compare(1721207, Date_Calc::DateToDays(27, 5, 0), '0000 05 27');
+compare('0000 05 28', Date_Calc::DaysToDate(1721208, "%Y %m %d"), '1721208');
+compare(1721208, Date_Calc::DateToDays(28, 5, 0), '0000 05 28');
+compare('0000 05 29', Date_Calc::DaysToDate(1721209, "%Y %m %d"), '1721209');
+compare(1721209, Date_Calc::DateToDays(29, 5, 0), '0000 05 29');
+compare('0000 05 30', Date_Calc::DaysToDate(1721210, "%Y %m %d"), '1721210');
+compare(1721210, Date_Calc::DateToDays(30, 5, 0), '0000 05 30');
+compare('0000 05 31', Date_Calc::DaysToDate(1721211, "%Y %m %d"), '1721211');
+compare(1721211, Date_Calc::DateToDays(31, 5, 0), '0000 05 31');
+compare('0000 06 01', Date_Calc::DaysToDate(1721212, "%Y %m %d"), '1721212');
+compare(1721212, Date_Calc::DateToDays(1, 6, 0), '0000 06 01');
+compare('0000 06 02', Date_Calc::DaysToDate(1721213, "%Y %m %d"), '1721213');
+compare(1721213, Date_Calc::DateToDays(2, 6, 0), '0000 06 02');
+compare('0000 06 03', Date_Calc::DaysToDate(1721214, "%Y %m %d"), '1721214');
+compare(1721214, Date_Calc::DateToDays(3, 6, 0), '0000 06 03');
+compare('0000 06 04', Date_Calc::DaysToDate(1721215, "%Y %m %d"), '1721215');
+compare(1721215, Date_Calc::DateToDays(4, 6, 0), '0000 06 04');
+compare('0000 06 05', Date_Calc::DaysToDate(1721216, "%Y %m %d"), '1721216');
+compare(1721216, Date_Calc::DateToDays(5, 6, 0), '0000 06 05');
+compare('0000 06 06', Date_Calc::DaysToDate(1721217, "%Y %m %d"), '1721217');
+compare(1721217, Date_Calc::DateToDays(6, 6, 0), '0000 06 06');
+compare('0000 06 07', Date_Calc::DaysToDate(1721218, "%Y %m %d"), '1721218');
+compare(1721218, Date_Calc::DateToDays(7, 6, 0), '0000 06 07');
+compare('0000 06 08', Date_Calc::DaysToDate(1721219, "%Y %m %d"), '1721219');
+compare(1721219, Date_Calc::DateToDays(8, 6, 0), '0000 06 08');
+compare('0000 06 09', Date_Calc::DaysToDate(1721220, "%Y %m %d"), '1721220');
+compare(1721220, Date_Calc::DateToDays(9, 6, 0), '0000 06 09');
+compare('0000 06 10', Date_Calc::DaysToDate(1721221, "%Y %m %d"), '1721221');
+compare(1721221, Date_Calc::DateToDays(10, 6, 0), '0000 06 10');
+compare('0000 06 11', Date_Calc::DaysToDate(1721222, "%Y %m %d"), '1721222');
+compare(1721222, Date_Calc::DateToDays(11, 6, 0), '0000 06 11');
+compare('0000 06 12', Date_Calc::DaysToDate(1721223, "%Y %m %d"), '1721223');
+compare(1721223, Date_Calc::DateToDays(12, 6, 0), '0000 06 12');
+compare('0000 06 13', Date_Calc::DaysToDate(1721224, "%Y %m %d"), '1721224');
+compare(1721224, Date_Calc::DateToDays(13, 6, 0), '0000 06 13');
+compare('0000 06 14', Date_Calc::DaysToDate(1721225, "%Y %m %d"), '1721225');
+compare(1721225, Date_Calc::DateToDays(14, 6, 0), '0000 06 14');
+compare('0000 06 15', Date_Calc::DaysToDate(1721226, "%Y %m %d"), '1721226');
+compare(1721226, Date_Calc::DateToDays(15, 6, 0), '0000 06 15');
+compare('0000 06 16', Date_Calc::DaysToDate(1721227, "%Y %m %d"), '1721227');
+compare(1721227, Date_Calc::DateToDays(16, 6, 0), '0000 06 16');
+compare('0000 06 17', Date_Calc::DaysToDate(1721228, "%Y %m %d"), '1721228');
+compare(1721228, Date_Calc::DateToDays(17, 6, 0), '0000 06 17');
+compare('0000 06 18', Date_Calc::DaysToDate(1721229, "%Y %m %d"), '1721229');
+compare(1721229, Date_Calc::DateToDays(18, 6, 0), '0000 06 18');
+compare('0000 06 19', Date_Calc::DaysToDate(1721230, "%Y %m %d"), '1721230');
+compare(1721230, Date_Calc::DateToDays(19, 6, 0), '0000 06 19');
+compare('0000 06 20', Date_Calc::DaysToDate(1721231, "%Y %m %d"), '1721231');
+compare(1721231, Date_Calc::DateToDays(20, 6, 0), '0000 06 20');
+compare('0000 06 21', Date_Calc::DaysToDate(1721232, "%Y %m %d"), '1721232');
+compare(1721232, Date_Calc::DateToDays(21, 6, 0), '0000 06 21');
+compare('0000 06 22', Date_Calc::DaysToDate(1721233, "%Y %m %d"), '1721233');
+compare(1721233, Date_Calc::DateToDays(22, 6, 0), '0000 06 22');
+compare('0000 06 23', Date_Calc::DaysToDate(1721234, "%Y %m %d"), '1721234');
+compare(1721234, Date_Calc::DateToDays(23, 6, 0), '0000 06 23');
+compare('0000 06 24', Date_Calc::DaysToDate(1721235, "%Y %m %d"), '1721235');
+compare(1721235, Date_Calc::DateToDays(24, 6, 0), '0000 06 24');
+compare('0000 06 25', Date_Calc::DaysToDate(1721236, "%Y %m %d"), '1721236');
+compare(1721236, Date_Calc::DateToDays(25, 6, 0), '0000 06 25');
+compare('0000 06 26', Date_Calc::DaysToDate(1721237, "%Y %m %d"), '1721237');
+compare(1721237, Date_Calc::DateToDays(26, 6, 0), '0000 06 26');
+compare('0000 06 27', Date_Calc::DaysToDate(1721238, "%Y %m %d"), '1721238');
+compare(1721238, Date_Calc::DateToDays(27, 6, 0), '0000 06 27');
+compare('0000 06 28', Date_Calc::DaysToDate(1721239, "%Y %m %d"), '1721239');
+compare(1721239, Date_Calc::DateToDays(28, 6, 0), '0000 06 28');
+compare('0000 06 29', Date_Calc::DaysToDate(1721240, "%Y %m %d"), '1721240');
+compare(1721240, Date_Calc::DateToDays(29, 6, 0), '0000 06 29');
+compare('0000 06 30', Date_Calc::DaysToDate(1721241, "%Y %m %d"), '1721241');
+compare(1721241, Date_Calc::DateToDays(30, 6, 0), '0000 06 30');
+compare('0000 07 01', Date_Calc::DaysToDate(1721242, "%Y %m %d"), '1721242');
+compare(1721242, Date_Calc::DateToDays(1, 7, 0), '0000 07 01');
+compare('0000 07 02', Date_Calc::DaysToDate(1721243, "%Y %m %d"), '1721243');
+compare(1721243, Date_Calc::DateToDays(2, 7, 0), '0000 07 02');
+compare('0000 07 03', Date_Calc::DaysToDate(1721244, "%Y %m %d"), '1721244');
+compare(1721244, Date_Calc::DateToDays(3, 7, 0), '0000 07 03');
+compare('0000 07 04', Date_Calc::DaysToDate(1721245, "%Y %m %d"), '1721245');
+compare(1721245, Date_Calc::DateToDays(4, 7, 0), '0000 07 04');
+compare('0000 07 05', Date_Calc::DaysToDate(1721246, "%Y %m %d"), '1721246');
+compare(1721246, Date_Calc::DateToDays(5, 7, 0), '0000 07 05');
+compare('0000 07 06', Date_Calc::DaysToDate(1721247, "%Y %m %d"), '1721247');
+compare(1721247, Date_Calc::DateToDays(6, 7, 0), '0000 07 06');
+compare('0000 07 07', Date_Calc::DaysToDate(1721248, "%Y %m %d"), '1721248');
+compare(1721248, Date_Calc::DateToDays(7, 7, 0), '0000 07 07');
+compare('0000 07 08', Date_Calc::DaysToDate(1721249, "%Y %m %d"), '1721249');
+compare(1721249, Date_Calc::DateToDays(8, 7, 0), '0000 07 08');
+compare('0000 07 09', Date_Calc::DaysToDate(1721250, "%Y %m %d"), '1721250');
+compare(1721250, Date_Calc::DateToDays(9, 7, 0), '0000 07 09');
+compare('0000 07 10', Date_Calc::DaysToDate(1721251, "%Y %m %d"), '1721251');
+compare(1721251, Date_Calc::DateToDays(10, 7, 0), '0000 07 10');
+compare('0000 07 11', Date_Calc::DaysToDate(1721252, "%Y %m %d"), '1721252');
+compare(1721252, Date_Calc::DateToDays(11, 7, 0), '0000 07 11');
+compare('0000 07 12', Date_Calc::DaysToDate(1721253, "%Y %m %d"), '1721253');
+compare(1721253, Date_Calc::DateToDays(12, 7, 0), '0000 07 12');
+compare('0000 07 13', Date_Calc::DaysToDate(1721254, "%Y %m %d"), '1721254');
+compare(1721254, Date_Calc::DateToDays(13, 7, 0), '0000 07 13');
+compare('0000 07 14', Date_Calc::DaysToDate(1721255, "%Y %m %d"), '1721255');
+compare(1721255, Date_Calc::DateToDays(14, 7, 0), '0000 07 14');
+compare('0000 07 15', Date_Calc::DaysToDate(1721256, "%Y %m %d"), '1721256');
+compare(1721256, Date_Calc::DateToDays(15, 7, 0), '0000 07 15');
+compare('0000 07 16', Date_Calc::DaysToDate(1721257, "%Y %m %d"), '1721257');
+compare(1721257, Date_Calc::DateToDays(16, 7, 0), '0000 07 16');
+compare('0000 07 17', Date_Calc::DaysToDate(1721258, "%Y %m %d"), '1721258');
+compare(1721258, Date_Calc::DateToDays(17, 7, 0), '0000 07 17');
+compare('0000 07 18', Date_Calc::DaysToDate(1721259, "%Y %m %d"), '1721259');
+compare(1721259, Date_Calc::DateToDays(18, 7, 0), '0000 07 18');
+compare('0000 07 19', Date_Calc::DaysToDate(1721260, "%Y %m %d"), '1721260');
+compare(1721260, Date_Calc::DateToDays(19, 7, 0), '0000 07 19');
+compare('0000 07 20', Date_Calc::DaysToDate(1721261, "%Y %m %d"), '1721261');
+compare(1721261, Date_Calc::DateToDays(20, 7, 0), '0000 07 20');
+compare('0000 07 21', Date_Calc::DaysToDate(1721262, "%Y %m %d"), '1721262');
+compare(1721262, Date_Calc::DateToDays(21, 7, 0), '0000 07 21');
+compare('0000 07 22', Date_Calc::DaysToDate(1721263, "%Y %m %d"), '1721263');
+compare(1721263, Date_Calc::DateToDays(22, 7, 0), '0000 07 22');
+compare('0000 07 23', Date_Calc::DaysToDate(1721264, "%Y %m %d"), '1721264');
+compare(1721264, Date_Calc::DateToDays(23, 7, 0), '0000 07 23');
+compare('0000 07 24', Date_Calc::DaysToDate(1721265, "%Y %m %d"), '1721265');
+compare(1721265, Date_Calc::DateToDays(24, 7, 0), '0000 07 24');
+compare('0000 07 25', Date_Calc::DaysToDate(1721266, "%Y %m %d"), '1721266');
+compare(1721266, Date_Calc::DateToDays(25, 7, 0), '0000 07 25');
+compare('0000 07 26', Date_Calc::DaysToDate(1721267, "%Y %m %d"), '1721267');
+compare(1721267, Date_Calc::DateToDays(26, 7, 0), '0000 07 26');
+compare('0000 07 27', Date_Calc::DaysToDate(1721268, "%Y %m %d"), '1721268');
+compare(1721268, Date_Calc::DateToDays(27, 7, 0), '0000 07 27');
+compare('0000 07 28', Date_Calc::DaysToDate(1721269, "%Y %m %d"), '1721269');
+compare(1721269, Date_Calc::DateToDays(28, 7, 0), '0000 07 28');
+compare('0000 07 29', Date_Calc::DaysToDate(1721270, "%Y %m %d"), '1721270');
+compare(1721270, Date_Calc::DateToDays(29, 7, 0), '0000 07 29');
+compare('0000 07 30', Date_Calc::DaysToDate(1721271, "%Y %m %d"), '1721271');
+compare(1721271, Date_Calc::DateToDays(30, 7, 0), '0000 07 30');
+compare('0000 07 31', Date_Calc::DaysToDate(1721272, "%Y %m %d"), '1721272');
+compare(1721272, Date_Calc::DateToDays(31, 7, 0), '0000 07 31');
+compare('0000 08 01', Date_Calc::DaysToDate(1721273, "%Y %m %d"), '1721273');
+compare(1721273, Date_Calc::DateToDays(1, 8, 0), '0000 08 01');
+compare('0000 08 02', Date_Calc::DaysToDate(1721274, "%Y %m %d"), '1721274');
+compare(1721274, Date_Calc::DateToDays(2, 8, 0), '0000 08 02');
+compare('0000 08 03', Date_Calc::DaysToDate(1721275, "%Y %m %d"), '1721275');
+compare(1721275, Date_Calc::DateToDays(3, 8, 0), '0000 08 03');
+compare('0000 08 04', Date_Calc::DaysToDate(1721276, "%Y %m %d"), '1721276');
+compare(1721276, Date_Calc::DateToDays(4, 8, 0), '0000 08 04');
+compare('0000 08 05', Date_Calc::DaysToDate(1721277, "%Y %m %d"), '1721277');
+compare(1721277, Date_Calc::DateToDays(5, 8, 0), '0000 08 05');
+compare('0000 08 06', Date_Calc::DaysToDate(1721278, "%Y %m %d"), '1721278');
+compare(1721278, Date_Calc::DateToDays(6, 8, 0), '0000 08 06');
+compare('0000 08 07', Date_Calc::DaysToDate(1721279, "%Y %m %d"), '1721279');
+compare(1721279, Date_Calc::DateToDays(7, 8, 0), '0000 08 07');
+compare('0000 08 08', Date_Calc::DaysToDate(1721280, "%Y %m %d"), '1721280');
+compare(1721280, Date_Calc::DateToDays(8, 8, 0), '0000 08 08');
+compare('0000 08 09', Date_Calc::DaysToDate(1721281, "%Y %m %d"), '1721281');
+compare(1721281, Date_Calc::DateToDays(9, 8, 0), '0000 08 09');
+compare('0000 08 10', Date_Calc::DaysToDate(1721282, "%Y %m %d"), '1721282');
+compare(1721282, Date_Calc::DateToDays(10, 8, 0), '0000 08 10');
+compare('0000 08 11', Date_Calc::DaysToDate(1721283, "%Y %m %d"), '1721283');
+compare(1721283, Date_Calc::DateToDays(11, 8, 0), '0000 08 11');
+compare('0000 08 12', Date_Calc::DaysToDate(1721284, "%Y %m %d"), '1721284');
+compare(1721284, Date_Calc::DateToDays(12, 8, 0), '0000 08 12');
+compare('0000 08 13', Date_Calc::DaysToDate(1721285, "%Y %m %d"), '1721285');
+compare(1721285, Date_Calc::DateToDays(13, 8, 0), '0000 08 13');
+compare('0000 08 14', Date_Calc::DaysToDate(1721286, "%Y %m %d"), '1721286');
+compare(1721286, Date_Calc::DateToDays(14, 8, 0), '0000 08 14');
+compare('0000 08 15', Date_Calc::DaysToDate(1721287, "%Y %m %d"), '1721287');
+compare(1721287, Date_Calc::DateToDays(15, 8, 0), '0000 08 15');
+compare('0000 08 16', Date_Calc::DaysToDate(1721288, "%Y %m %d"), '1721288');
+compare(1721288, Date_Calc::DateToDays(16, 8, 0), '0000 08 16');
+compare('0000 08 17', Date_Calc::DaysToDate(1721289, "%Y %m %d"), '1721289');
+compare(1721289, Date_Calc::DateToDays(17, 8, 0), '0000 08 17');
+compare('0000 08 18', Date_Calc::DaysToDate(1721290, "%Y %m %d"), '1721290');
+compare(1721290, Date_Calc::DateToDays(18, 8, 0), '0000 08 18');
+compare('0000 08 19', Date_Calc::DaysToDate(1721291, "%Y %m %d"), '1721291');
+compare(1721291, Date_Calc::DateToDays(19, 8, 0), '0000 08 19');
+compare('0000 08 20', Date_Calc::DaysToDate(1721292, "%Y %m %d"), '1721292');
+compare(1721292, Date_Calc::DateToDays(20, 8, 0), '0000 08 20');
+compare('0000 08 21', Date_Calc::DaysToDate(1721293, "%Y %m %d"), '1721293');
+compare(1721293, Date_Calc::DateToDays(21, 8, 0), '0000 08 21');
+compare('0000 08 22', Date_Calc::DaysToDate(1721294, "%Y %m %d"), '1721294');
+compare(1721294, Date_Calc::DateToDays(22, 8, 0), '0000 08 22');
+compare('0000 08 23', Date_Calc::DaysToDate(1721295, "%Y %m %d"), '1721295');
+compare(1721295, Date_Calc::DateToDays(23, 8, 0), '0000 08 23');
+compare('0000 08 24', Date_Calc::DaysToDate(1721296, "%Y %m %d"), '1721296');
+compare(1721296, Date_Calc::DateToDays(24, 8, 0), '0000 08 24');
+compare('0000 08 25', Date_Calc::DaysToDate(1721297, "%Y %m %d"), '1721297');
+compare(1721297, Date_Calc::DateToDays(25, 8, 0), '0000 08 25');
+compare('0000 08 26', Date_Calc::DaysToDate(1721298, "%Y %m %d"), '1721298');
+compare(1721298, Date_Calc::DateToDays(26, 8, 0), '0000 08 26');
+compare('0000 08 27', Date_Calc::DaysToDate(1721299, "%Y %m %d"), '1721299');
+compare(1721299, Date_Calc::DateToDays(27, 8, 0), '0000 08 27');
+compare('0000 08 28', Date_Calc::DaysToDate(1721300, "%Y %m %d"), '1721300');
+compare(1721300, Date_Calc::DateToDays(28, 8, 0), '0000 08 28');
+compare('0000 08 29', Date_Calc::DaysToDate(1721301, "%Y %m %d"), '1721301');
+compare(1721301, Date_Calc::DateToDays(29, 8, 0), '0000 08 29');
+compare('0000 08 30', Date_Calc::DaysToDate(1721302, "%Y %m %d"), '1721302');
+compare(1721302, Date_Calc::DateToDays(30, 8, 0), '0000 08 30');
+compare('0000 08 31', Date_Calc::DaysToDate(1721303, "%Y %m %d"), '1721303');
+compare(1721303, Date_Calc::DateToDays(31, 8, 0), '0000 08 31');
+compare('0000 09 01', Date_Calc::DaysToDate(1721304, "%Y %m %d"), '1721304');
+compare(1721304, Date_Calc::DateToDays(1, 9, 0), '0000 09 01');
+compare('0000 09 02', Date_Calc::DaysToDate(1721305, "%Y %m %d"), '1721305');
+compare(1721305, Date_Calc::DateToDays(2, 9, 0), '0000 09 02');
+compare('0000 09 03', Date_Calc::DaysToDate(1721306, "%Y %m %d"), '1721306');
+compare(1721306, Date_Calc::DateToDays(3, 9, 0), '0000 09 03');
+compare('0000 09 04', Date_Calc::DaysToDate(1721307, "%Y %m %d"), '1721307');
+compare(1721307, Date_Calc::DateToDays(4, 9, 0), '0000 09 04');
+compare('0000 09 05', Date_Calc::DaysToDate(1721308, "%Y %m %d"), '1721308');
+compare(1721308, Date_Calc::DateToDays(5, 9, 0), '0000 09 05');
+compare('0000 09 06', Date_Calc::DaysToDate(1721309, "%Y %m %d"), '1721309');
+compare(1721309, Date_Calc::DateToDays(6, 9, 0), '0000 09 06');
+compare('0000 09 07', Date_Calc::DaysToDate(1721310, "%Y %m %d"), '1721310');
+compare(1721310, Date_Calc::DateToDays(7, 9, 0), '0000 09 07');
+compare('0000 09 08', Date_Calc::DaysToDate(1721311, "%Y %m %d"), '1721311');
+compare(1721311, Date_Calc::DateToDays(8, 9, 0), '0000 09 08');
+compare('0000 09 09', Date_Calc::DaysToDate(1721312, "%Y %m %d"), '1721312');
+compare(1721312, Date_Calc::DateToDays(9, 9, 0), '0000 09 09');
+compare('0000 09 10', Date_Calc::DaysToDate(1721313, "%Y %m %d"), '1721313');
+compare(1721313, Date_Calc::DateToDays(10, 9, 0), '0000 09 10');
+compare('0000 09 11', Date_Calc::DaysToDate(1721314, "%Y %m %d"), '1721314');
+compare(1721314, Date_Calc::DateToDays(11, 9, 0), '0000 09 11');
+compare('0000 09 12', Date_Calc::DaysToDate(1721315, "%Y %m %d"), '1721315');
+compare(1721315, Date_Calc::DateToDays(12, 9, 0), '0000 09 12');
+compare('0000 09 13', Date_Calc::DaysToDate(1721316, "%Y %m %d"), '1721316');
+compare(1721316, Date_Calc::DateToDays(13, 9, 0), '0000 09 13');
+compare('0000 09 14', Date_Calc::DaysToDate(1721317, "%Y %m %d"), '1721317');
+compare(1721317, Date_Calc::DateToDays(14, 9, 0), '0000 09 14');
+compare('0000 09 15', Date_Calc::DaysToDate(1721318, "%Y %m %d"), '1721318');
+compare(1721318, Date_Calc::DateToDays(15, 9, 0), '0000 09 15');
+compare('0000 09 16', Date_Calc::DaysToDate(1721319, "%Y %m %d"), '1721319');
+compare(1721319, Date_Calc::DateToDays(16, 9, 0), '0000 09 16');
+compare('0000 09 17', Date_Calc::DaysToDate(1721320, "%Y %m %d"), '1721320');
+compare(1721320, Date_Calc::DateToDays(17, 9, 0), '0000 09 17');
+compare('0000 09 18', Date_Calc::DaysToDate(1721321, "%Y %m %d"), '1721321');
+compare(1721321, Date_Calc::DateToDays(18, 9, 0), '0000 09 18');
+compare('0000 09 19', Date_Calc::DaysToDate(1721322, "%Y %m %d"), '1721322');
+compare(1721322, Date_Calc::DateToDays(19, 9, 0), '0000 09 19');
+compare('0000 09 20', Date_Calc::DaysToDate(1721323, "%Y %m %d"), '1721323');
+compare(1721323, Date_Calc::DateToDays(20, 9, 0), '0000 09 20');
+compare('0000 09 21', Date_Calc::DaysToDate(1721324, "%Y %m %d"), '1721324');
+compare(1721324, Date_Calc::DateToDays(21, 9, 0), '0000 09 21');
+compare('0000 09 22', Date_Calc::DaysToDate(1721325, "%Y %m %d"), '1721325');
+compare(1721325, Date_Calc::DateToDays(22, 9, 0), '0000 09 22');
+compare('0000 09 23', Date_Calc::DaysToDate(1721326, "%Y %m %d"), '1721326');
+compare(1721326, Date_Calc::DateToDays(23, 9, 0), '0000 09 23');
+compare('0000 09 24', Date_Calc::DaysToDate(1721327, "%Y %m %d"), '1721327');
+compare(1721327, Date_Calc::DateToDays(24, 9, 0), '0000 09 24');
+compare('0000 09 25', Date_Calc::DaysToDate(1721328, "%Y %m %d"), '1721328');
+compare(1721328, Date_Calc::DateToDays(25, 9, 0), '0000 09 25');
+compare('0000 09 26', Date_Calc::DaysToDate(1721329, "%Y %m %d"), '1721329');
+compare(1721329, Date_Calc::DateToDays(26, 9, 0), '0000 09 26');
+compare('0000 09 27', Date_Calc::DaysToDate(1721330, "%Y %m %d"), '1721330');
+compare(1721330, Date_Calc::DateToDays(27, 9, 0), '0000 09 27');
+compare('0000 09 28', Date_Calc::DaysToDate(1721331, "%Y %m %d"), '1721331');
+compare(1721331, Date_Calc::DateToDays(28, 9, 0), '0000 09 28');
+compare('0000 09 29', Date_Calc::DaysToDate(1721332, "%Y %m %d"), '1721332');
+compare(1721332, Date_Calc::DateToDays(29, 9, 0), '0000 09 29');
+compare('0000 09 30', Date_Calc::DaysToDate(1721333, "%Y %m %d"), '1721333');
+compare(1721333, Date_Calc::DateToDays(30, 9, 0), '0000 09 30');
+compare('0000 10 01', Date_Calc::DaysToDate(1721334, "%Y %m %d"), '1721334');
+compare(1721334, Date_Calc::DateToDays(1, 10, 0), '0000 10 01');
+compare('0000 10 02', Date_Calc::DaysToDate(1721335, "%Y %m %d"), '1721335');
+compare(1721335, Date_Calc::DateToDays(2, 10, 0), '0000 10 02');
+compare('0000 10 03', Date_Calc::DaysToDate(1721336, "%Y %m %d"), '1721336');
+compare(1721336, Date_Calc::DateToDays(3, 10, 0), '0000 10 03');
+compare('0000 10 04', Date_Calc::DaysToDate(1721337, "%Y %m %d"), '1721337');
+compare(1721337, Date_Calc::DateToDays(4, 10, 0), '0000 10 04');
+compare('0000 10 05', Date_Calc::DaysToDate(1721338, "%Y %m %d"), '1721338');
+compare(1721338, Date_Calc::DateToDays(5, 10, 0), '0000 10 05');
+compare('0000 10 06', Date_Calc::DaysToDate(1721339, "%Y %m %d"), '1721339');
+compare(1721339, Date_Calc::DateToDays(6, 10, 0), '0000 10 06');
+compare('0000 10 07', Date_Calc::DaysToDate(1721340, "%Y %m %d"), '1721340');
+compare(1721340, Date_Calc::DateToDays(7, 10, 0), '0000 10 07');
+compare('0000 10 08', Date_Calc::DaysToDate(1721341, "%Y %m %d"), '1721341');
+compare(1721341, Date_Calc::DateToDays(8, 10, 0), '0000 10 08');
+compare('0000 10 09', Date_Calc::DaysToDate(1721342, "%Y %m %d"), '1721342');
+compare(1721342, Date_Calc::DateToDays(9, 10, 0), '0000 10 09');
+compare('0000 10 10', Date_Calc::DaysToDate(1721343, "%Y %m %d"), '1721343');
+compare(1721343, Date_Calc::DateToDays(10, 10, 0), '0000 10 10');
+compare('0000 10 11', Date_Calc::DaysToDate(1721344, "%Y %m %d"), '1721344');
+compare(1721344, Date_Calc::DateToDays(11, 10, 0), '0000 10 11');
+compare('0000 10 12', Date_Calc::DaysToDate(1721345, "%Y %m %d"), '1721345');
+compare(1721345, Date_Calc::DateToDays(12, 10, 0), '0000 10 12');
+compare('0000 10 13', Date_Calc::DaysToDate(1721346, "%Y %m %d"), '1721346');
+compare(1721346, Date_Calc::DateToDays(13, 10, 0), '0000 10 13');
+compare('0000 10 14', Date_Calc::DaysToDate(1721347, "%Y %m %d"), '1721347');
+compare(1721347, Date_Calc::DateToDays(14, 10, 0), '0000 10 14');
+compare('0000 10 15', Date_Calc::DaysToDate(1721348, "%Y %m %d"), '1721348');
+compare(1721348, Date_Calc::DateToDays(15, 10, 0), '0000 10 15');
+compare('0000 10 16', Date_Calc::DaysToDate(1721349, "%Y %m %d"), '1721349');
+compare(1721349, Date_Calc::DateToDays(16, 10, 0), '0000 10 16');
+compare('0000 10 17', Date_Calc::DaysToDate(1721350, "%Y %m %d"), '1721350');
+compare(1721350, Date_Calc::DateToDays(17, 10, 0), '0000 10 17');
+compare('0000 10 18', Date_Calc::DaysToDate(1721351, "%Y %m %d"), '1721351');
+compare(1721351, Date_Calc::DateToDays(18, 10, 0), '0000 10 18');
+compare('0000 10 19', Date_Calc::DaysToDate(1721352, "%Y %m %d"), '1721352');
+compare(1721352, Date_Calc::DateToDays(19, 10, 0), '0000 10 19');
+compare('0000 10 20', Date_Calc::DaysToDate(1721353, "%Y %m %d"), '1721353');
+compare(1721353, Date_Calc::DateToDays(20, 10, 0), '0000 10 20');
+compare('0000 10 21', Date_Calc::DaysToDate(1721354, "%Y %m %d"), '1721354');
+compare(1721354, Date_Calc::DateToDays(21, 10, 0), '0000 10 21');
+compare('0000 10 22', Date_Calc::DaysToDate(1721355, "%Y %m %d"), '1721355');
+compare(1721355, Date_Calc::DateToDays(22, 10, 0), '0000 10 22');
+compare('0000 10 23', Date_Calc::DaysToDate(1721356, "%Y %m %d"), '1721356');
+compare(1721356, Date_Calc::DateToDays(23, 10, 0), '0000 10 23');
+compare('0000 10 24', Date_Calc::DaysToDate(1721357, "%Y %m %d"), '1721357');
+compare(1721357, Date_Calc::DateToDays(24, 10, 0), '0000 10 24');
+compare('0000 10 25', Date_Calc::DaysToDate(1721358, "%Y %m %d"), '1721358');
+compare(1721358, Date_Calc::DateToDays(25, 10, 0), '0000 10 25');
+compare('0000 10 26', Date_Calc::DaysToDate(1721359, "%Y %m %d"), '1721359');
+compare(1721359, Date_Calc::DateToDays(26, 10, 0), '0000 10 26');
+compare('0000 10 27', Date_Calc::DaysToDate(1721360, "%Y %m %d"), '1721360');
+compare(1721360, Date_Calc::DateToDays(27, 10, 0), '0000 10 27');
+compare('0000 10 28', Date_Calc::DaysToDate(1721361, "%Y %m %d"), '1721361');
+compare(1721361, Date_Calc::DateToDays(28, 10, 0), '0000 10 28');
+compare('0000 10 29', Date_Calc::DaysToDate(1721362, "%Y %m %d"), '1721362');
+compare(1721362, Date_Calc::DateToDays(29, 10, 0), '0000 10 29');
+compare('0000 10 30', Date_Calc::DaysToDate(1721363, "%Y %m %d"), '1721363');
+compare(1721363, Date_Calc::DateToDays(30, 10, 0), '0000 10 30');
+compare('0000 10 31', Date_Calc::DaysToDate(1721364, "%Y %m %d"), '1721364');
+compare(1721364, Date_Calc::DateToDays(31, 10, 0), '0000 10 31');
+compare('0000 11 01', Date_Calc::DaysToDate(1721365, "%Y %m %d"), '1721365');
+compare(1721365, Date_Calc::DateToDays(1, 11, 0), '0000 11 01');
+compare('0000 11 02', Date_Calc::DaysToDate(1721366, "%Y %m %d"), '1721366');
+compare(1721366, Date_Calc::DateToDays(2, 11, 0), '0000 11 02');
+compare('0000 11 03', Date_Calc::DaysToDate(1721367, "%Y %m %d"), '1721367');
+compare(1721367, Date_Calc::DateToDays(3, 11, 0), '0000 11 03');
+compare('0000 11 04', Date_Calc::DaysToDate(1721368, "%Y %m %d"), '1721368');
+compare(1721368, Date_Calc::DateToDays(4, 11, 0), '0000 11 04');
+compare('0000 11 05', Date_Calc::DaysToDate(1721369, "%Y %m %d"), '1721369');
+compare(1721369, Date_Calc::DateToDays(5, 11, 0), '0000 11 05');
+compare('0000 11 06', Date_Calc::DaysToDate(1721370, "%Y %m %d"), '1721370');
+compare(1721370, Date_Calc::DateToDays(6, 11, 0), '0000 11 06');
+compare('0000 11 07', Date_Calc::DaysToDate(1721371, "%Y %m %d"), '1721371');
+compare(1721371, Date_Calc::DateToDays(7, 11, 0), '0000 11 07');
+compare('0000 11 08', Date_Calc::DaysToDate(1721372, "%Y %m %d"), '1721372');
+compare(1721372, Date_Calc::DateToDays(8, 11, 0), '0000 11 08');
+compare('0000 11 09', Date_Calc::DaysToDate(1721373, "%Y %m %d"), '1721373');
+compare(1721373, Date_Calc::DateToDays(9, 11, 0), '0000 11 09');
+compare('0000 11 10', Date_Calc::DaysToDate(1721374, "%Y %m %d"), '1721374');
+compare(1721374, Date_Calc::DateToDays(10, 11, 0), '0000 11 10');
+compare('0000 11 11', Date_Calc::DaysToDate(1721375, "%Y %m %d"), '1721375');
+compare(1721375, Date_Calc::DateToDays(11, 11, 0), '0000 11 11');
+compare('0000 11 12', Date_Calc::DaysToDate(1721376, "%Y %m %d"), '1721376');
+compare(1721376, Date_Calc::DateToDays(12, 11, 0), '0000 11 12');
+compare('0000 11 13', Date_Calc::DaysToDate(1721377, "%Y %m %d"), '1721377');
+compare(1721377, Date_Calc::DateToDays(13, 11, 0), '0000 11 13');
+compare('0000 11 14', Date_Calc::DaysToDate(1721378, "%Y %m %d"), '1721378');
+compare(1721378, Date_Calc::DateToDays(14, 11, 0), '0000 11 14');
+compare('0000 11 15', Date_Calc::DaysToDate(1721379, "%Y %m %d"), '1721379');
+compare(1721379, Date_Calc::DateToDays(15, 11, 0), '0000 11 15');
+compare('0000 11 16', Date_Calc::DaysToDate(1721380, "%Y %m %d"), '1721380');
+compare(1721380, Date_Calc::DateToDays(16, 11, 0), '0000 11 16');
+compare('0000 11 17', Date_Calc::DaysToDate(1721381, "%Y %m %d"), '1721381');
+compare(1721381, Date_Calc::DateToDays(17, 11, 0), '0000 11 17');
+compare('0000 11 18', Date_Calc::DaysToDate(1721382, "%Y %m %d"), '1721382');
+compare(1721382, Date_Calc::DateToDays(18, 11, 0), '0000 11 18');
+compare('0000 11 19', Date_Calc::DaysToDate(1721383, "%Y %m %d"), '1721383');
+compare(1721383, Date_Calc::DateToDays(19, 11, 0), '0000 11 19');
+compare('0000 11 20', Date_Calc::DaysToDate(1721384, "%Y %m %d"), '1721384');
+compare(1721384, Date_Calc::DateToDays(20, 11, 0), '0000 11 20');
+compare('0000 11 21', Date_Calc::DaysToDate(1721385, "%Y %m %d"), '1721385');
+compare(1721385, Date_Calc::DateToDays(21, 11, 0), '0000 11 21');
+compare('0000 11 22', Date_Calc::DaysToDate(1721386, "%Y %m %d"), '1721386');
+compare(1721386, Date_Calc::DateToDays(22, 11, 0), '0000 11 22');
+compare('0000 11 23', Date_Calc::DaysToDate(1721387, "%Y %m %d"), '1721387');
+compare(1721387, Date_Calc::DateToDays(23, 11, 0), '0000 11 23');
+compare('0000 11 24', Date_Calc::DaysToDate(1721388, "%Y %m %d"), '1721388');
+compare(1721388, Date_Calc::DateToDays(24, 11, 0), '0000 11 24');
+compare('0000 11 25', Date_Calc::DaysToDate(1721389, "%Y %m %d"), '1721389');
+compare(1721389, Date_Calc::DateToDays(25, 11, 0), '0000 11 25');
+compare('0000 11 26', Date_Calc::DaysToDate(1721390, "%Y %m %d"), '1721390');
+compare(1721390, Date_Calc::DateToDays(26, 11, 0), '0000 11 26');
+compare('0000 11 27', Date_Calc::DaysToDate(1721391, "%Y %m %d"), '1721391');
+compare(1721391, Date_Calc::DateToDays(27, 11, 0), '0000 11 27');
+compare('0000 11 28', Date_Calc::DaysToDate(1721392, "%Y %m %d"), '1721392');
+compare(1721392, Date_Calc::DateToDays(28, 11, 0), '0000 11 28');
+compare('0000 11 29', Date_Calc::DaysToDate(1721393, "%Y %m %d"), '1721393');
+compare(1721393, Date_Calc::DateToDays(29, 11, 0), '0000 11 29');
+compare('0000 11 30', Date_Calc::DaysToDate(1721394, "%Y %m %d"), '1721394');
+compare(1721394, Date_Calc::DateToDays(30, 11, 0), '0000 11 30');
+compare('0000 12 01', Date_Calc::DaysToDate(1721395, "%Y %m %d"), '1721395');
+compare(1721395, Date_Calc::DateToDays(1, 12, 0), '0000 12 01');
+compare('0000 12 02', Date_Calc::DaysToDate(1721396, "%Y %m %d"), '1721396');
+compare(1721396, Date_Calc::DateToDays(2, 12, 0), '0000 12 02');
+compare('0000 12 03', Date_Calc::DaysToDate(1721397, "%Y %m %d"), '1721397');
+compare(1721397, Date_Calc::DateToDays(3, 12, 0), '0000 12 03');
+compare('0000 12 04', Date_Calc::DaysToDate(1721398, "%Y %m %d"), '1721398');
+compare(1721398, Date_Calc::DateToDays(4, 12, 0), '0000 12 04');
+compare('0000 12 05', Date_Calc::DaysToDate(1721399, "%Y %m %d"), '1721399');
+compare(1721399, Date_Calc::DateToDays(5, 12, 0), '0000 12 05');
+compare('0000 12 06', Date_Calc::DaysToDate(1721400, "%Y %m %d"), '1721400');
+compare(1721400, Date_Calc::DateToDays(6, 12, 0), '0000 12 06');
+compare('0000 12 07', Date_Calc::DaysToDate(1721401, "%Y %m %d"), '1721401');
+compare(1721401, Date_Calc::DateToDays(7, 12, 0), '0000 12 07');
+compare('0000 12 08', Date_Calc::DaysToDate(1721402, "%Y %m %d"), '1721402');
+compare(1721402, Date_Calc::DateToDays(8, 12, 0), '0000 12 08');
+compare('0000 12 09', Date_Calc::DaysToDate(1721403, "%Y %m %d"), '1721403');
+compare(1721403, Date_Calc::DateToDays(9, 12, 0), '0000 12 09');
+compare('0000 12 10', Date_Calc::DaysToDate(1721404, "%Y %m %d"), '1721404');
+compare(1721404, Date_Calc::DateToDays(10, 12, 0), '0000 12 10');
+compare('0000 12 11', Date_Calc::DaysToDate(1721405, "%Y %m %d"), '1721405');
+compare(1721405, Date_Calc::DateToDays(11, 12, 0), '0000 12 11');
+compare('0000 12 12', Date_Calc::DaysToDate(1721406, "%Y %m %d"), '1721406');
+compare(1721406, Date_Calc::DateToDays(12, 12, 0), '0000 12 12');
+compare('0000 12 13', Date_Calc::DaysToDate(1721407, "%Y %m %d"), '1721407');
+compare(1721407, Date_Calc::DateToDays(13, 12, 0), '0000 12 13');
+compare('0000 12 14', Date_Calc::DaysToDate(1721408, "%Y %m %d"), '1721408');
+compare(1721408, Date_Calc::DateToDays(14, 12, 0), '0000 12 14');
+compare('0000 12 15', Date_Calc::DaysToDate(1721409, "%Y %m %d"), '1721409');
+compare(1721409, Date_Calc::DateToDays(15, 12, 0), '0000 12 15');
+compare('0000 12 16', Date_Calc::DaysToDate(1721410, "%Y %m %d"), '1721410');
+compare(1721410, Date_Calc::DateToDays(16, 12, 0), '0000 12 16');
+compare('0000 12 17', Date_Calc::DaysToDate(1721411, "%Y %m %d"), '1721411');
+compare(1721411, Date_Calc::DateToDays(17, 12, 0), '0000 12 17');
+compare('0000 12 18', Date_Calc::DaysToDate(1721412, "%Y %m %d"), '1721412');
+compare(1721412, Date_Calc::DateToDays(18, 12, 0), '0000 12 18');
+compare('0000 12 19', Date_Calc::DaysToDate(1721413, "%Y %m %d"), '1721413');
+compare(1721413, Date_Calc::DateToDays(19, 12, 0), '0000 12 19');
+compare('0000 12 20', Date_Calc::DaysToDate(1721414, "%Y %m %d"), '1721414');
+compare(1721414, Date_Calc::DateToDays(20, 12, 0), '0000 12 20');
+compare('0000 12 21', Date_Calc::DaysToDate(1721415, "%Y %m %d"), '1721415');
+compare(1721415, Date_Calc::DateToDays(21, 12, 0), '0000 12 21');
+compare('0000 12 22', Date_Calc::DaysToDate(1721416, "%Y %m %d"), '1721416');
+compare(1721416, Date_Calc::DateToDays(22, 12, 0), '0000 12 22');
+compare('0000 12 23', Date_Calc::DaysToDate(1721417, "%Y %m %d"), '1721417');
+compare(1721417, Date_Calc::DateToDays(23, 12, 0), '0000 12 23');
+compare('0000 12 24', Date_Calc::DaysToDate(1721418, "%Y %m %d"), '1721418');
+compare(1721418, Date_Calc::DateToDays(24, 12, 0), '0000 12 24');
+compare('0000 12 25', Date_Calc::DaysToDate(1721419, "%Y %m %d"), '1721419');
+compare(1721419, Date_Calc::DateToDays(25, 12, 0), '0000 12 25');
+compare('0000 12 26', Date_Calc::DaysToDate(1721420, "%Y %m %d"), '1721420');
+compare(1721420, Date_Calc::DateToDays(26, 12, 0), '0000 12 26');
+compare('0000 12 27', Date_Calc::DaysToDate(1721421, "%Y %m %d"), '1721421');
+compare(1721421, Date_Calc::DateToDays(27, 12, 0), '0000 12 27');
+compare('0000 12 28', Date_Calc::DaysToDate(1721422, "%Y %m %d"), '1721422');
+compare(1721422, Date_Calc::DateToDays(28, 12, 0), '0000 12 28');
+compare('0000 12 29', Date_Calc::DaysToDate(1721423, "%Y %m %d"), '1721423');
+compare(1721423, Date_Calc::DateToDays(29, 12, 0), '0000 12 29');
+compare('0000 12 30', Date_Calc::DaysToDate(1721424, "%Y %m %d"), '1721424');
+compare(1721424, Date_Calc::DateToDays(30, 12, 0), '0000 12 30');
+compare('0000 12 31', Date_Calc::DaysToDate(1721425, "%Y %m %d"), '1721425');
+compare(1721425, Date_Calc::DateToDays(31, 12, 0), '0000 12 31');
+compare('0001 01 01', Date_Calc::DaysToDate(1721426, "%Y %m %d"), '1721426');
+compare(1721426, Date_Calc::DateToDays(1, 1, 1), '0001 01 01');
diff --git a/extlib/Date/tests/test_round_trunc.php b/extlib/Date/tests/test_round_trunc.php
new file mode 100644 (file)
index 0000000..635d7cf
--- /dev/null
@@ -0,0 +1,231 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests Date:round() and Date::trunc()
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+$date = new Date("19871109T16:12:24.171878000");
+
+$od = new Date($date);
+$od->round(-6);
+compare('0000-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-6 (1)');
+$od = new Date($date);
+$od->round(-5);
+compare('2000-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-5 (1)');
+$od = new Date($date);
+$od->round(-4);
+compare('2000-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-4 (1)');
+$od = new Date($date);
+$od->round(-3);
+compare('1990-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-3 (1)');
+$od = new Date($date);
+$od->round(-2);
+compare('1988-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-2 (1)');
+$od = new Date($date);
+$od->round(-1);
+compare('1987-11-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-1 (1)');
+$od = new Date($date);
+$od->round(0);
+compare('1987-11-10 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '0 (1)');
+$od = new Date($date);
+$od->round(1);
+compare('1987-11-09 16.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '1 (1)');
+$od = new Date($date);
+$od->round(2);
+compare('1987-11-09 16.10.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '2 (1)');
+$od = new Date($date);
+$od->round(3);
+compare('1987-11-09 16.12.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '3 (1)');
+$od = new Date($date);
+$od->round(4);
+compare('1987-11-09 16.12.20.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '4 (1)');
+$od = new Date($date);
+$od->round(5);
+compare('1987-11-09 16.12.24.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '5 (1)');
+$od = new Date($date);
+$od->round(6);
+compare('1987-11-09 16.12.24.200000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '6 (1)');
+$od = new Date($date);
+$od->round(7);
+compare('1987-11-09 16.12.24.170000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '7 (1)');
+$od = new Date($date);
+$od->round(8);
+compare('1987-11-09 16.12.24.172000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '8 (1)');
+$od = new Date($date);
+$od->round(9);
+compare('1987-11-09 16.12.24.171900000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '9 (1)');
+$od = new Date($date);
+$od->round(10);
+compare('1987-11-09 16.12.24.171880000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '10 (1)');
+$od = new Date($date);
+$od->round(11);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '11 (1)');
+$od = new Date($date);
+$od->round(12);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '12 (1)');
+$od = new Date($date);
+$od->round(13);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '13 (1)');
+$od = new Date($date);
+$od->round(14);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '14 (1)');
+
+$od = new Date($date);
+$od->trunc(-6);
+compare('0000-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-6 (1)');
+$od = new Date($date);
+$od->trunc(-5);
+compare('1000-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-5 (1)');
+$od = new Date($date);
+$od->trunc(-4);
+compare('1900-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-4 (1)');
+$od = new Date($date);
+$od->trunc(-3);
+compare('1980-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-3 (1)');
+$od = new Date($date);
+$od->trunc(-2);
+compare('1987-00-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-2 (1)');
+$od = new Date($date);
+$od->trunc(-1);
+compare('1987-11-00 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '-1 (1)');
+$od = new Date($date);
+$od->trunc(0);
+compare('1987-11-09 00.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '0 (1)');
+$od = new Date($date);
+$od->trunc(1);
+compare('1987-11-09 16.00.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '1 (1)');
+$od = new Date($date);
+$od->trunc(2);
+compare('1987-11-09 16.10.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '2 (1)');
+$od = new Date($date);
+$od->trunc(3);
+compare('1987-11-09 16.12.00.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '3 (1)');
+$od = new Date($date);
+$od->trunc(4);
+compare('1987-11-09 16.12.20.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '4 (1)');
+$od = new Date($date);
+$od->trunc(5);
+compare('1987-11-09 16.12.24.000000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '5 (1)');
+$od = new Date($date);
+$od->trunc(6);
+compare('1987-11-09 16.12.24.100000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '6 (1)');
+$od = new Date($date);
+$od->trunc(7);
+compare('1987-11-09 16.12.24.170000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '7 (1)');
+$od = new Date($date);
+$od->trunc(8);
+compare('1987-11-09 16.12.24.171000000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '8 (1)');
+$od = new Date($date);
+$od->trunc(9);
+compare('1987-11-09 16.12.24.171800000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '9 (1)');
+$od = new Date($date);
+$od->trunc(10);
+compare('1987-11-09 16.12.24.171870000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '10 (1)');
+$od = new Date($date);
+$od->trunc(11);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '11 (1)');
+$od = new Date($date);
+$od->trunc(12);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '12 (1)');
+$od = new Date($date);
+$od->trunc(13);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '13 (1)');
+$od = new Date($date);
+$od->trunc(14);
+compare('1987-11-09 16.12.24.171878000', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS.FFFFFFFFF'), '14 (1)');
+
+
+$od = new Date("19870709T12:00:00");
+$od->round(DATE_PRECISION_DAY);
+compare('1987-07-10 00.00.00', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS'), 'Midday test 1');
+$od = new Date("19870709T11:59:59.999999");
+$od->round(DATE_PRECISION_DAY);
+compare('1987-07-09 00.00.00', $od->formatLikeSQL('YYYY-MM-DD HH.MI.SS'), 'Midday test 2');
diff --git a/extlib/Date/tests/test_weeknumbers_0.php b/extlib/Date/tests/test_weeknumbers_0.php
new file mode 100644 (file)
index 0000000..30d6e51
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 0);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Sunday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_1.php b/extlib/Date/tests/test_weeknumbers_1.php
new file mode 100644 (file)
index 0000000..a30c2e4
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 1);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Monday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_2.php b/extlib/Date/tests/test_weeknumbers_2.php
new file mode 100644 (file)
index 0000000..f83d6de
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 2);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Tuesday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_3.php b/extlib/Date/tests/test_weeknumbers_3.php
new file mode 100644 (file)
index 0000000..8370297
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 3);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Wednesday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_4.php b/extlib/Date/tests/test_weeknumbers_4.php
new file mode 100644 (file)
index 0000000..ece0232
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 4);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Thursday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_5.php b/extlib/Date/tests/test_weeknumbers_5.php
new file mode 100644 (file)
index 0000000..956f130
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 5);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Friday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('53', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('53', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_6.php b/extlib/Date/tests/test_weeknumbers_6.php
new file mode 100644 (file)
index 0000000..137d8c9
--- /dev/null
@@ -0,0 +1,3527 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc day of week functions
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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')
+    );
+}
+
+
+define('DATE_CALC_BEGIN_WEEKDAY', 6);
+
+/**
+ * Get the needed class
+ */
+require_once 'Date.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 "<pre>\n";
+}
+
+$date = new Date("1998-12-24 00:00:00Z");
+
+// First day of week is Saturday
+//
+
+// Thursday, 24th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-8)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-8)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (-8)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-8)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-7)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (-7)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (-7)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (-7)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-6)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-6)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-6)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-6)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-5)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-5)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-5)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-5)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (-5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-4)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-4)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-4)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-4)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-3)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-3)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-3)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-3)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('52', $date->formatLikeSQL('WW'), 'WW (-2)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-2)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-2)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('53', $date->formatLikeSQL('WW'), 'WW (-1)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (-1)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (-1)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (-1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (-1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (0)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (0)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (0)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (0)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (1)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (1)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (1)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (1)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (2)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (2)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (2)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (2)');
+compare('53', $date->formatLikeSQL('IW'), 'IW (2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (3)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (3)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (3)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (3)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (4)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (4)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (4)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (4)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (5)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (5)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (5)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (5)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('01', $date->formatLikeSQL('WW'), 'WW (6)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (6)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (6)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (6)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (7)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (7)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (7)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (7)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (7)');
+
+$date->addDays(1);
+
+// Saturday, 9th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (8)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (8)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (8)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (8)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (8)');
+
+$date->addDays(1);
+
+// Sunday, 10th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (9)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (9)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (9)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (9)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (9)');
+
+$date->addDays(1);
+
+// Monday, 11th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (10)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (10)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (10)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (10)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (10)');
+
+$date->addDays(1);
+
+// Tuesday, 12th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (11)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (11)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (11)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (11)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (11)');
+
+$date->addDays(1);
+
+// Wednesday, 13th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (12)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (12)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (12)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (12)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (12)');
+
+$date->addDays(1);
+
+// Thursday, 14th January 1999
+compare('02', $date->formatLikeSQL('WW'), 'WW (13)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (13)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (13)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (13)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (13)');
+
+$date->addDays(1);
+
+// Friday, 15th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (14)');
+compare('03', $date->formatLikeSQL('W1'), 'W1 (14)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (14)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (14)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (14)');
+
+$date->addDays(1);
+
+// Saturday, 16th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (15)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (15)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (15)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (15)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (15)');
+
+$date->addDays(1);
+
+// Sunday, 17th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (16)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (16)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (16)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (16)');
+compare('02', $date->formatLikeSQL('IW'), 'IW (16)');
+
+$date->addDays(1);
+
+// Monday, 18th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (17)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (17)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (17)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (17)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (17)');
+
+$date->addDays(1);
+
+// Tuesday, 19th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (18)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (18)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (18)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (18)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (18)');
+
+$date->addDays(1);
+
+// Wednesday, 20th January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (19)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (19)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (19)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (19)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (19)');
+
+$date->addDays(1);
+
+// Thursday, 21st January 1999
+compare('03', $date->formatLikeSQL('WW'), 'WW (20)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (20)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (20)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (20)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (20)');
+
+$date->addDays(1);
+
+// Friday, 22nd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (21)');
+compare('04', $date->formatLikeSQL('W1'), 'W1 (21)');
+compare('03', $date->formatLikeSQL('W4'), 'W4 (21)');
+compare('03', $date->formatLikeSQL('W7'), 'W7 (21)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (21)');
+
+$date->addDays(1);
+
+// Saturday, 23rd January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (22)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (22)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (22)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (22)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (22)');
+
+$date->addDays(1);
+
+// Sunday, 24th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (23)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (23)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (23)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (23)');
+compare('03', $date->formatLikeSQL('IW'), 'IW (23)');
+
+$date->addDays(1);
+
+// Monday, 25th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (24)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (24)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (24)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (24)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (24)');
+
+$date->addDays(1);
+
+// Tuesday, 26th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (25)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (25)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (25)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (25)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (25)');
+
+$date->addDays(1);
+
+// Wednesday, 27th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (26)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (26)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (26)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (26)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (26)');
+
+$date->addDays(1);
+
+// Thursday, 28th January 1999
+compare('04', $date->formatLikeSQL('WW'), 'WW (27)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (27)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (27)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (27)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (27)');
+
+$date->addDays(1);
+
+// Friday, 29th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (28)');
+compare('05', $date->formatLikeSQL('W1'), 'W1 (28)');
+compare('04', $date->formatLikeSQL('W4'), 'W4 (28)');
+compare('04', $date->formatLikeSQL('W7'), 'W7 (28)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (28)');
+
+$date->addDays(1);
+
+// Saturday, 30th January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (29)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (29)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (29)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (29)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (29)');
+
+$date->addDays(1);
+
+// Sunday, 31st January 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (30)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (30)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (30)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (30)');
+compare('04', $date->formatLikeSQL('IW'), 'IW (30)');
+
+$date->addDays(1);
+
+// Monday, 1st February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (31)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (31)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (31)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (31)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (31)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (32)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (32)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (32)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (32)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (32)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (33)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (33)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (33)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (33)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (33)');
+
+$date->addDays(1);
+
+// Thursday, 4th February 1999
+compare('05', $date->formatLikeSQL('WW'), 'WW (34)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (34)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (34)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (34)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (34)');
+
+$date->addDays(1);
+
+// Friday, 5th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (35)');
+compare('06', $date->formatLikeSQL('W1'), 'W1 (35)');
+compare('05', $date->formatLikeSQL('W4'), 'W4 (35)');
+compare('05', $date->formatLikeSQL('W7'), 'W7 (35)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (35)');
+
+$date->addDays(1);
+
+// Saturday, 6th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (36)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (36)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (36)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (36)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (36)');
+
+$date->addDays(1);
+
+// Sunday, 7th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (37)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (37)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (37)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (37)');
+compare('05', $date->formatLikeSQL('IW'), 'IW (37)');
+
+$date->addDays(1);
+
+// Monday, 8th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (38)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (38)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (38)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (38)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (38)');
+
+$date->addDays(1);
+
+// Tuesday, 9th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (39)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (39)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (39)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (39)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (39)');
+
+$date->addDays(1);
+
+// Wednesday, 10th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (40)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (40)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (40)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (40)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (40)');
+
+$date->addDays(1);
+
+// Thursday, 11th February 1999
+compare('06', $date->formatLikeSQL('WW'), 'WW (41)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (41)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (41)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (41)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (41)');
+
+$date->addDays(1);
+
+// Friday, 12th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (42)');
+compare('07', $date->formatLikeSQL('W1'), 'W1 (42)');
+compare('06', $date->formatLikeSQL('W4'), 'W4 (42)');
+compare('06', $date->formatLikeSQL('W7'), 'W7 (42)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (42)');
+
+$date->addDays(1);
+
+// Saturday, 13th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (43)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (43)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (43)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (43)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (43)');
+
+$date->addDays(1);
+
+// Sunday, 14th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (44)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (44)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (44)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (44)');
+compare('06', $date->formatLikeSQL('IW'), 'IW (44)');
+
+$date->addDays(1);
+
+// Monday, 15th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (45)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (45)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (45)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (45)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (45)');
+
+$date->addDays(1);
+
+// Tuesday, 16th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (46)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (46)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (46)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (46)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (46)');
+
+$date->addDays(1);
+
+// Wednesday, 17th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (47)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (47)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (47)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (47)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (47)');
+
+$date->addDays(1);
+
+// Thursday, 18th February 1999
+compare('07', $date->formatLikeSQL('WW'), 'WW (48)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (48)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (48)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (48)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (48)');
+
+$date->addDays(1);
+
+// Friday, 19th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (49)');
+compare('08', $date->formatLikeSQL('W1'), 'W1 (49)');
+compare('07', $date->formatLikeSQL('W4'), 'W4 (49)');
+compare('07', $date->formatLikeSQL('W7'), 'W7 (49)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (49)');
+
+$date->addDays(1);
+
+// Saturday, 20th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (50)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (50)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (50)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (50)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (50)');
+
+$date->addDays(1);
+
+// Sunday, 21st February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (51)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (51)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (51)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (51)');
+compare('07', $date->formatLikeSQL('IW'), 'IW (51)');
+
+$date->addDays(1);
+
+// Monday, 22nd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (52)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (52)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (52)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (52)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (52)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (53)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (53)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (53)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (53)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (53)');
+
+$date->addDays(1);
+
+// Wednesday, 24th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (54)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (54)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (54)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (54)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (54)');
+
+$date->addDays(1);
+
+// Thursday, 25th February 1999
+compare('08', $date->formatLikeSQL('WW'), 'WW (55)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (55)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (55)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (55)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (55)');
+
+$date->addDays(1);
+
+// Friday, 26th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (56)');
+compare('09', $date->formatLikeSQL('W1'), 'W1 (56)');
+compare('08', $date->formatLikeSQL('W4'), 'W4 (56)');
+compare('08', $date->formatLikeSQL('W7'), 'W7 (56)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (56)');
+
+$date->addDays(1);
+
+// Saturday, 27th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (57)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (57)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (57)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (57)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (57)');
+
+$date->addDays(1);
+
+// Sunday, 28th February 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (58)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (58)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (58)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (58)');
+compare('08', $date->formatLikeSQL('IW'), 'IW (58)');
+
+$date->addDays(1);
+
+// Monday, 1st March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (59)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (59)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (59)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (59)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (59)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (60)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (60)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (60)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (60)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (60)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (61)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (61)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (61)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (61)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (61)');
+
+$date->addDays(1);
+
+// Thursday, 4th March 1999
+compare('09', $date->formatLikeSQL('WW'), 'WW (62)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (62)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (62)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (62)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (62)');
+
+$date->addDays(1);
+
+// Friday, 5th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (63)');
+compare('10', $date->formatLikeSQL('W1'), 'W1 (63)');
+compare('09', $date->formatLikeSQL('W4'), 'W4 (63)');
+compare('09', $date->formatLikeSQL('W7'), 'W7 (63)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (63)');
+
+$date->addDays(1);
+
+// Saturday, 6th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (64)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (64)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (64)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (64)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (64)');
+
+$date->addDays(1);
+
+// Sunday, 7th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (65)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (65)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (65)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (65)');
+compare('09', $date->formatLikeSQL('IW'), 'IW (65)');
+
+$date->addDays(1);
+
+// Monday, 8th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (66)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (66)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (66)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (66)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (66)');
+
+$date->addDays(1);
+
+// Tuesday, 9th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (67)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (67)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (67)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (67)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (67)');
+
+$date->addDays(1);
+
+// Wednesday, 10th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (68)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (68)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (68)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (68)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (68)');
+
+$date->addDays(1);
+
+// Thursday, 11th March 1999
+compare('10', $date->formatLikeSQL('WW'), 'WW (69)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (69)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (69)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (69)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (69)');
+
+$date->addDays(1);
+
+// Friday, 12th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (70)');
+compare('11', $date->formatLikeSQL('W1'), 'W1 (70)');
+compare('10', $date->formatLikeSQL('W4'), 'W4 (70)');
+compare('10', $date->formatLikeSQL('W7'), 'W7 (70)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (70)');
+
+$date->addDays(1);
+
+// Saturday, 13th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (71)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (71)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (71)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (71)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (71)');
+
+$date->addDays(1);
+
+// Sunday, 14th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (72)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (72)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (72)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (72)');
+compare('10', $date->formatLikeSQL('IW'), 'IW (72)');
+
+$date->addDays(1);
+
+// Monday, 15th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (73)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (73)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (73)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (73)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (73)');
+
+$date->addDays(1);
+
+// Tuesday, 16th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (74)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (74)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (74)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (74)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (74)');
+
+$date->addDays(1);
+
+// Wednesday, 17th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (75)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (75)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (75)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (75)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (75)');
+
+$date->addDays(1);
+
+// Thursday, 18th March 1999
+compare('11', $date->formatLikeSQL('WW'), 'WW (76)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (76)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (76)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (76)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (76)');
+
+$date->addDays(1);
+
+// Friday, 19th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (77)');
+compare('12', $date->formatLikeSQL('W1'), 'W1 (77)');
+compare('11', $date->formatLikeSQL('W4'), 'W4 (77)');
+compare('11', $date->formatLikeSQL('W7'), 'W7 (77)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (77)');
+
+$date->addDays(1);
+
+// Saturday, 20th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (78)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (78)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (78)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (78)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (78)');
+
+$date->addDays(1);
+
+// Sunday, 21st March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (79)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (79)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (79)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (79)');
+compare('11', $date->formatLikeSQL('IW'), 'IW (79)');
+
+$date->addDays(1);
+
+// Monday, 22nd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (80)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (80)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (80)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (80)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (80)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (81)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (81)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (81)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (81)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (81)');
+
+$date->addDays(1);
+
+// Wednesday, 24th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (82)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (82)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (82)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (82)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (82)');
+
+$date->addDays(1);
+
+// Thursday, 25th March 1999
+compare('12', $date->formatLikeSQL('WW'), 'WW (83)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (83)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (83)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (83)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (83)');
+
+$date->addDays(1);
+
+// Friday, 26th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (84)');
+compare('13', $date->formatLikeSQL('W1'), 'W1 (84)');
+compare('12', $date->formatLikeSQL('W4'), 'W4 (84)');
+compare('12', $date->formatLikeSQL('W7'), 'W7 (84)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (84)');
+
+$date->addDays(1);
+
+// Saturday, 27th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (85)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (85)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (85)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (85)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (85)');
+
+$date->addDays(1);
+
+// Sunday, 28th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (86)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (86)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (86)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (86)');
+compare('12', $date->formatLikeSQL('IW'), 'IW (86)');
+
+$date->addDays(1);
+
+// Monday, 29th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (87)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (87)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (87)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (87)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (87)');
+
+$date->addDays(1);
+
+// Tuesday, 30th March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (88)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (88)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (88)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (88)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (88)');
+
+$date->addDays(1);
+
+// Wednesday, 31st March 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (89)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (89)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (89)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (89)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (89)');
+
+$date->addDays(1);
+
+// Thursday, 1st April 1999
+compare('13', $date->formatLikeSQL('WW'), 'WW (90)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (90)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (90)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (90)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (90)');
+
+$date->addDays(1);
+
+// Friday, 2nd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (91)');
+compare('14', $date->formatLikeSQL('W1'), 'W1 (91)');
+compare('13', $date->formatLikeSQL('W4'), 'W4 (91)');
+compare('13', $date->formatLikeSQL('W7'), 'W7 (91)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (91)');
+
+$date->addDays(1);
+
+// Saturday, 3rd April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (92)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (92)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (92)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (92)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (92)');
+
+$date->addDays(1);
+
+// Sunday, 4th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (93)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (93)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (93)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (93)');
+compare('13', $date->formatLikeSQL('IW'), 'IW (93)');
+
+$date->addDays(1);
+
+// Monday, 5th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (94)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (94)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (94)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (94)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (94)');
+
+$date->addDays(1);
+
+// Tuesday, 6th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (95)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (95)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (95)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (95)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (95)');
+
+$date->addDays(1);
+
+// Wednesday, 7th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (96)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (96)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (96)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (96)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (96)');
+
+$date->addDays(1);
+
+// Thursday, 8th April 1999
+compare('14', $date->formatLikeSQL('WW'), 'WW (97)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (97)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (97)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (97)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (97)');
+
+$date->addDays(1);
+
+// Friday, 9th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (98)');
+compare('15', $date->formatLikeSQL('W1'), 'W1 (98)');
+compare('14', $date->formatLikeSQL('W4'), 'W4 (98)');
+compare('14', $date->formatLikeSQL('W7'), 'W7 (98)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (98)');
+
+$date->addDays(1);
+
+// Saturday, 10th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (99)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (99)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (99)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (99)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (99)');
+
+$date->addDays(1);
+
+// Sunday, 11th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (100)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (100)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (100)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (100)');
+compare('14', $date->formatLikeSQL('IW'), 'IW (100)');
+
+$date->addDays(1);
+
+// Monday, 12th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (101)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (101)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (101)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (101)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (101)');
+
+$date->addDays(1);
+
+// Tuesday, 13th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (102)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (102)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (102)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (102)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (102)');
+
+$date->addDays(1);
+
+// Wednesday, 14th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (103)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (103)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (103)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (103)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (103)');
+
+$date->addDays(1);
+
+// Thursday, 15th April 1999
+compare('15', $date->formatLikeSQL('WW'), 'WW (104)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (104)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (104)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (104)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (104)');
+
+$date->addDays(1);
+
+// Friday, 16th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (105)');
+compare('16', $date->formatLikeSQL('W1'), 'W1 (105)');
+compare('15', $date->formatLikeSQL('W4'), 'W4 (105)');
+compare('15', $date->formatLikeSQL('W7'), 'W7 (105)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (105)');
+
+$date->addDays(1);
+
+// Saturday, 17th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (106)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (106)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (106)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (106)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (106)');
+
+$date->addDays(1);
+
+// Sunday, 18th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (107)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (107)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (107)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (107)');
+compare('15', $date->formatLikeSQL('IW'), 'IW (107)');
+
+$date->addDays(1);
+
+// Monday, 19th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (108)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (108)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (108)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (108)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (108)');
+
+$date->addDays(1);
+
+// Tuesday, 20th April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (109)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (109)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (109)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (109)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (109)');
+
+$date->addDays(1);
+
+// Wednesday, 21st April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (110)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (110)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (110)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (110)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (110)');
+
+$date->addDays(1);
+
+// Thursday, 22nd April 1999
+compare('16', $date->formatLikeSQL('WW'), 'WW (111)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (111)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (111)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (111)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (111)');
+
+$date->addDays(1);
+
+// Friday, 23rd April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (112)');
+compare('17', $date->formatLikeSQL('W1'), 'W1 (112)');
+compare('16', $date->formatLikeSQL('W4'), 'W4 (112)');
+compare('16', $date->formatLikeSQL('W7'), 'W7 (112)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (112)');
+
+$date->addDays(1);
+
+// Saturday, 24th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (113)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (113)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (113)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (113)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (113)');
+
+$date->addDays(1);
+
+// Sunday, 25th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (114)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (114)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (114)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (114)');
+compare('16', $date->formatLikeSQL('IW'), 'IW (114)');
+
+$date->addDays(1);
+
+// Monday, 26th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (115)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (115)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (115)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (115)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (115)');
+
+$date->addDays(1);
+
+// Tuesday, 27th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (116)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (116)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (116)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (116)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (116)');
+
+$date->addDays(1);
+
+// Wednesday, 28th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (117)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (117)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (117)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (117)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (117)');
+
+$date->addDays(1);
+
+// Thursday, 29th April 1999
+compare('17', $date->formatLikeSQL('WW'), 'WW (118)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (118)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (118)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (118)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (118)');
+
+$date->addDays(1);
+
+// Friday, 30th April 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (119)');
+compare('18', $date->formatLikeSQL('W1'), 'W1 (119)');
+compare('17', $date->formatLikeSQL('W4'), 'W4 (119)');
+compare('17', $date->formatLikeSQL('W7'), 'W7 (119)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (119)');
+
+$date->addDays(1);
+
+// Saturday, 1st May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (120)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (120)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (120)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (120)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (120)');
+
+$date->addDays(1);
+
+// Sunday, 2nd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (121)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (121)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (121)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (121)');
+compare('17', $date->formatLikeSQL('IW'), 'IW (121)');
+
+$date->addDays(1);
+
+// Monday, 3rd May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (122)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (122)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (122)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (122)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (122)');
+
+$date->addDays(1);
+
+// Tuesday, 4th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (123)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (123)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (123)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (123)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (123)');
+
+$date->addDays(1);
+
+// Wednesday, 5th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (124)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (124)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (124)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (124)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (124)');
+
+$date->addDays(1);
+
+// Thursday, 6th May 1999
+compare('18', $date->formatLikeSQL('WW'), 'WW (125)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (125)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (125)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (125)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (125)');
+
+$date->addDays(1);
+
+// Friday, 7th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (126)');
+compare('19', $date->formatLikeSQL('W1'), 'W1 (126)');
+compare('18', $date->formatLikeSQL('W4'), 'W4 (126)');
+compare('18', $date->formatLikeSQL('W7'), 'W7 (126)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (126)');
+
+$date->addDays(1);
+
+// Saturday, 8th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (127)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (127)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (127)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (127)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (127)');
+
+$date->addDays(1);
+
+// Sunday, 9th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (128)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (128)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (128)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (128)');
+compare('18', $date->formatLikeSQL('IW'), 'IW (128)');
+
+$date->addDays(1);
+
+// Monday, 10th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (129)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (129)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (129)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (129)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (129)');
+
+$date->addDays(1);
+
+// Tuesday, 11th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (130)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (130)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (130)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (130)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (130)');
+
+$date->addDays(1);
+
+// Wednesday, 12th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (131)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (131)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (131)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (131)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (131)');
+
+$date->addDays(1);
+
+// Thursday, 13th May 1999
+compare('19', $date->formatLikeSQL('WW'), 'WW (132)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (132)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (132)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (132)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (132)');
+
+$date->addDays(1);
+
+// Friday, 14th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (133)');
+compare('20', $date->formatLikeSQL('W1'), 'W1 (133)');
+compare('19', $date->formatLikeSQL('W4'), 'W4 (133)');
+compare('19', $date->formatLikeSQL('W7'), 'W7 (133)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (133)');
+
+$date->addDays(1);
+
+// Saturday, 15th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (134)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (134)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (134)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (134)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (134)');
+
+$date->addDays(1);
+
+// Sunday, 16th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (135)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (135)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (135)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (135)');
+compare('19', $date->formatLikeSQL('IW'), 'IW (135)');
+
+$date->addDays(1);
+
+// Monday, 17th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (136)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (136)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (136)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (136)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (136)');
+
+$date->addDays(1);
+
+// Tuesday, 18th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (137)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (137)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (137)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (137)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (137)');
+
+$date->addDays(1);
+
+// Wednesday, 19th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (138)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (138)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (138)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (138)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (138)');
+
+$date->addDays(1);
+
+// Thursday, 20th May 1999
+compare('20', $date->formatLikeSQL('WW'), 'WW (139)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (139)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (139)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (139)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (139)');
+
+$date->addDays(1);
+
+// Friday, 21st May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (140)');
+compare('21', $date->formatLikeSQL('W1'), 'W1 (140)');
+compare('20', $date->formatLikeSQL('W4'), 'W4 (140)');
+compare('20', $date->formatLikeSQL('W7'), 'W7 (140)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (140)');
+
+$date->addDays(1);
+
+// Saturday, 22nd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (141)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (141)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (141)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (141)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (141)');
+
+$date->addDays(1);
+
+// Sunday, 23rd May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (142)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (142)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (142)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (142)');
+compare('20', $date->formatLikeSQL('IW'), 'IW (142)');
+
+$date->addDays(1);
+
+// Monday, 24th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (143)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (143)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (143)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (143)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (143)');
+
+$date->addDays(1);
+
+// Tuesday, 25th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (144)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (144)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (144)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (144)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (144)');
+
+$date->addDays(1);
+
+// Wednesday, 26th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (145)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (145)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (145)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (145)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (145)');
+
+$date->addDays(1);
+
+// Thursday, 27th May 1999
+compare('21', $date->formatLikeSQL('WW'), 'WW (146)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (146)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (146)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (146)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (146)');
+
+$date->addDays(1);
+
+// Friday, 28th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (147)');
+compare('22', $date->formatLikeSQL('W1'), 'W1 (147)');
+compare('21', $date->formatLikeSQL('W4'), 'W4 (147)');
+compare('21', $date->formatLikeSQL('W7'), 'W7 (147)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (147)');
+
+$date->addDays(1);
+
+// Saturday, 29th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (148)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (148)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (148)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (148)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (148)');
+
+$date->addDays(1);
+
+// Sunday, 30th May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (149)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (149)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (149)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (149)');
+compare('21', $date->formatLikeSQL('IW'), 'IW (149)');
+
+$date->addDays(1);
+
+// Monday, 31st May 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (150)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (150)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (150)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (150)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (150)');
+
+$date->addDays(1);
+
+// Tuesday, 1st June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (151)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (151)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (151)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (151)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (151)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (152)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (152)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (152)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (152)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (152)');
+
+$date->addDays(1);
+
+// Thursday, 3rd June 1999
+compare('22', $date->formatLikeSQL('WW'), 'WW (153)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (153)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (153)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (153)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (153)');
+
+$date->addDays(1);
+
+// Friday, 4th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (154)');
+compare('23', $date->formatLikeSQL('W1'), 'W1 (154)');
+compare('22', $date->formatLikeSQL('W4'), 'W4 (154)');
+compare('22', $date->formatLikeSQL('W7'), 'W7 (154)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (154)');
+
+$date->addDays(1);
+
+// Saturday, 5th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (155)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (155)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (155)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (155)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (155)');
+
+$date->addDays(1);
+
+// Sunday, 6th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (156)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (156)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (156)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (156)');
+compare('22', $date->formatLikeSQL('IW'), 'IW (156)');
+
+$date->addDays(1);
+
+// Monday, 7th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (157)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (157)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (157)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (157)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (157)');
+
+$date->addDays(1);
+
+// Tuesday, 8th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (158)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (158)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (158)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (158)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (158)');
+
+$date->addDays(1);
+
+// Wednesday, 9th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (159)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (159)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (159)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (159)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (159)');
+
+$date->addDays(1);
+
+// Thursday, 10th June 1999
+compare('23', $date->formatLikeSQL('WW'), 'WW (160)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (160)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (160)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (160)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (160)');
+
+$date->addDays(1);
+
+// Friday, 11th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (161)');
+compare('24', $date->formatLikeSQL('W1'), 'W1 (161)');
+compare('23', $date->formatLikeSQL('W4'), 'W4 (161)');
+compare('23', $date->formatLikeSQL('W7'), 'W7 (161)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (161)');
+
+$date->addDays(1);
+
+// Saturday, 12th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (162)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (162)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (162)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (162)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (162)');
+
+$date->addDays(1);
+
+// Sunday, 13th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (163)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (163)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (163)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (163)');
+compare('23', $date->formatLikeSQL('IW'), 'IW (163)');
+
+$date->addDays(1);
+
+// Monday, 14th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (164)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (164)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (164)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (164)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (164)');
+
+$date->addDays(1);
+
+// Tuesday, 15th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (165)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (165)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (165)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (165)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (165)');
+
+$date->addDays(1);
+
+// Wednesday, 16th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (166)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (166)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (166)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (166)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (166)');
+
+$date->addDays(1);
+
+// Thursday, 17th June 1999
+compare('24', $date->formatLikeSQL('WW'), 'WW (167)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (167)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (167)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (167)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (167)');
+
+$date->addDays(1);
+
+// Friday, 18th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (168)');
+compare('25', $date->formatLikeSQL('W1'), 'W1 (168)');
+compare('24', $date->formatLikeSQL('W4'), 'W4 (168)');
+compare('24', $date->formatLikeSQL('W7'), 'W7 (168)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (168)');
+
+$date->addDays(1);
+
+// Saturday, 19th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (169)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (169)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (169)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (169)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (169)');
+
+$date->addDays(1);
+
+// Sunday, 20th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (170)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (170)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (170)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (170)');
+compare('24', $date->formatLikeSQL('IW'), 'IW (170)');
+
+$date->addDays(1);
+
+// Monday, 21st June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (171)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (171)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (171)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (171)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (171)');
+
+$date->addDays(1);
+
+// Tuesday, 22nd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (172)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (172)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (172)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (172)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (172)');
+
+$date->addDays(1);
+
+// Wednesday, 23rd June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (173)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (173)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (173)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (173)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (173)');
+
+$date->addDays(1);
+
+// Thursday, 24th June 1999
+compare('25', $date->formatLikeSQL('WW'), 'WW (174)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (174)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (174)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (174)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (174)');
+
+$date->addDays(1);
+
+// Friday, 25th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (175)');
+compare('26', $date->formatLikeSQL('W1'), 'W1 (175)');
+compare('25', $date->formatLikeSQL('W4'), 'W4 (175)');
+compare('25', $date->formatLikeSQL('W7'), 'W7 (175)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (175)');
+
+$date->addDays(1);
+
+// Saturday, 26th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (176)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (176)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (176)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (176)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (176)');
+
+$date->addDays(1);
+
+// Sunday, 27th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (177)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (177)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (177)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (177)');
+compare('25', $date->formatLikeSQL('IW'), 'IW (177)');
+
+$date->addDays(1);
+
+// Monday, 28th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (178)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (178)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (178)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (178)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (178)');
+
+$date->addDays(1);
+
+// Tuesday, 29th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (179)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (179)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (179)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (179)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (179)');
+
+$date->addDays(1);
+
+// Wednesday, 30th June 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (180)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (180)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (180)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (180)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (180)');
+
+$date->addDays(1);
+
+// Thursday, 1st July 1999
+compare('26', $date->formatLikeSQL('WW'), 'WW (181)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (181)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (181)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (181)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (181)');
+
+$date->addDays(1);
+
+// Friday, 2nd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (182)');
+compare('27', $date->formatLikeSQL('W1'), 'W1 (182)');
+compare('26', $date->formatLikeSQL('W4'), 'W4 (182)');
+compare('26', $date->formatLikeSQL('W7'), 'W7 (182)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (182)');
+
+$date->addDays(1);
+
+// Saturday, 3rd July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (183)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (183)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (183)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (183)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (183)');
+
+$date->addDays(1);
+
+// Sunday, 4th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (184)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (184)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (184)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (184)');
+compare('26', $date->formatLikeSQL('IW'), 'IW (184)');
+
+$date->addDays(1);
+
+// Monday, 5th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (185)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (185)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (185)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (185)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (185)');
+
+$date->addDays(1);
+
+// Tuesday, 6th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (186)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (186)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (186)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (186)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (186)');
+
+$date->addDays(1);
+
+// Wednesday, 7th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (187)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (187)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (187)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (187)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (187)');
+
+$date->addDays(1);
+
+// Thursday, 8th July 1999
+compare('27', $date->formatLikeSQL('WW'), 'WW (188)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (188)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (188)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (188)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (188)');
+
+$date->addDays(1);
+
+// Friday, 9th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (189)');
+compare('28', $date->formatLikeSQL('W1'), 'W1 (189)');
+compare('27', $date->formatLikeSQL('W4'), 'W4 (189)');
+compare('27', $date->formatLikeSQL('W7'), 'W7 (189)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (189)');
+
+$date->addDays(1);
+
+// Saturday, 10th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (190)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (190)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (190)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (190)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (190)');
+
+$date->addDays(1);
+
+// Sunday, 11th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (191)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (191)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (191)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (191)');
+compare('27', $date->formatLikeSQL('IW'), 'IW (191)');
+
+$date->addDays(1);
+
+// Monday, 12th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (192)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (192)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (192)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (192)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (192)');
+
+$date->addDays(1);
+
+// Tuesday, 13th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (193)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (193)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (193)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (193)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (193)');
+
+$date->addDays(1);
+
+// Wednesday, 14th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (194)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (194)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (194)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (194)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (194)');
+
+$date->addDays(1);
+
+// Thursday, 15th July 1999
+compare('28', $date->formatLikeSQL('WW'), 'WW (195)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (195)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (195)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (195)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (195)');
+
+$date->addDays(1);
+
+// Friday, 16th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (196)');
+compare('29', $date->formatLikeSQL('W1'), 'W1 (196)');
+compare('28', $date->formatLikeSQL('W4'), 'W4 (196)');
+compare('28', $date->formatLikeSQL('W7'), 'W7 (196)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (196)');
+
+$date->addDays(1);
+
+// Saturday, 17th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (197)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (197)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (197)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (197)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (197)');
+
+$date->addDays(1);
+
+// Sunday, 18th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (198)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (198)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (198)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (198)');
+compare('28', $date->formatLikeSQL('IW'), 'IW (198)');
+
+$date->addDays(1);
+
+// Monday, 19th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (199)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (199)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (199)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (199)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (199)');
+
+$date->addDays(1);
+
+// Tuesday, 20th July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (200)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (200)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (200)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (200)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (200)');
+
+$date->addDays(1);
+
+// Wednesday, 21st July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (201)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (201)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (201)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (201)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (201)');
+
+$date->addDays(1);
+
+// Thursday, 22nd July 1999
+compare('29', $date->formatLikeSQL('WW'), 'WW (202)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (202)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (202)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (202)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (202)');
+
+$date->addDays(1);
+
+// Friday, 23rd July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (203)');
+compare('30', $date->formatLikeSQL('W1'), 'W1 (203)');
+compare('29', $date->formatLikeSQL('W4'), 'W4 (203)');
+compare('29', $date->formatLikeSQL('W7'), 'W7 (203)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (203)');
+
+$date->addDays(1);
+
+// Saturday, 24th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (204)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (204)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (204)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (204)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (204)');
+
+$date->addDays(1);
+
+// Sunday, 25th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (205)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (205)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (205)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (205)');
+compare('29', $date->formatLikeSQL('IW'), 'IW (205)');
+
+$date->addDays(1);
+
+// Monday, 26th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (206)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (206)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (206)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (206)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (206)');
+
+$date->addDays(1);
+
+// Tuesday, 27th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (207)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (207)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (207)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (207)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (207)');
+
+$date->addDays(1);
+
+// Wednesday, 28th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (208)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (208)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (208)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (208)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (208)');
+
+$date->addDays(1);
+
+// Thursday, 29th July 1999
+compare('30', $date->formatLikeSQL('WW'), 'WW (209)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (209)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (209)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (209)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (209)');
+
+$date->addDays(1);
+
+// Friday, 30th July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (210)');
+compare('31', $date->formatLikeSQL('W1'), 'W1 (210)');
+compare('30', $date->formatLikeSQL('W4'), 'W4 (210)');
+compare('30', $date->formatLikeSQL('W7'), 'W7 (210)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (210)');
+
+$date->addDays(1);
+
+// Saturday, 31st July 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (211)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (211)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (211)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (211)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (211)');
+
+$date->addDays(1);
+
+// Sunday, 1st August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (212)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (212)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (212)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (212)');
+compare('30', $date->formatLikeSQL('IW'), 'IW (212)');
+
+$date->addDays(1);
+
+// Monday, 2nd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (213)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (213)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (213)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (213)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (213)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (214)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (214)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (214)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (214)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (214)');
+
+$date->addDays(1);
+
+// Wednesday, 4th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (215)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (215)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (215)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (215)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (215)');
+
+$date->addDays(1);
+
+// Thursday, 5th August 1999
+compare('31', $date->formatLikeSQL('WW'), 'WW (216)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (216)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (216)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (216)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (216)');
+
+$date->addDays(1);
+
+// Friday, 6th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (217)');
+compare('32', $date->formatLikeSQL('W1'), 'W1 (217)');
+compare('31', $date->formatLikeSQL('W4'), 'W4 (217)');
+compare('31', $date->formatLikeSQL('W7'), 'W7 (217)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (217)');
+
+$date->addDays(1);
+
+// Saturday, 7th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (218)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (218)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (218)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (218)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (218)');
+
+$date->addDays(1);
+
+// Sunday, 8th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (219)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (219)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (219)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (219)');
+compare('31', $date->formatLikeSQL('IW'), 'IW (219)');
+
+$date->addDays(1);
+
+// Monday, 9th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (220)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (220)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (220)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (220)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (220)');
+
+$date->addDays(1);
+
+// Tuesday, 10th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (221)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (221)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (221)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (221)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (221)');
+
+$date->addDays(1);
+
+// Wednesday, 11th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (222)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (222)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (222)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (222)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (222)');
+
+$date->addDays(1);
+
+// Thursday, 12th August 1999
+compare('32', $date->formatLikeSQL('WW'), 'WW (223)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (223)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (223)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (223)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (223)');
+
+$date->addDays(1);
+
+// Friday, 13th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (224)');
+compare('33', $date->formatLikeSQL('W1'), 'W1 (224)');
+compare('32', $date->formatLikeSQL('W4'), 'W4 (224)');
+compare('32', $date->formatLikeSQL('W7'), 'W7 (224)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (224)');
+
+$date->addDays(1);
+
+// Saturday, 14th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (225)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (225)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (225)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (225)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (225)');
+
+$date->addDays(1);
+
+// Sunday, 15th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (226)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (226)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (226)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (226)');
+compare('32', $date->formatLikeSQL('IW'), 'IW (226)');
+
+$date->addDays(1);
+
+// Monday, 16th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (227)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (227)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (227)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (227)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (227)');
+
+$date->addDays(1);
+
+// Tuesday, 17th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (228)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (228)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (228)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (228)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (228)');
+
+$date->addDays(1);
+
+// Wednesday, 18th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (229)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (229)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (229)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (229)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (229)');
+
+$date->addDays(1);
+
+// Thursday, 19th August 1999
+compare('33', $date->formatLikeSQL('WW'), 'WW (230)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (230)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (230)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (230)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (230)');
+
+$date->addDays(1);
+
+// Friday, 20th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (231)');
+compare('34', $date->formatLikeSQL('W1'), 'W1 (231)');
+compare('33', $date->formatLikeSQL('W4'), 'W4 (231)');
+compare('33', $date->formatLikeSQL('W7'), 'W7 (231)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (231)');
+
+$date->addDays(1);
+
+// Saturday, 21st August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (232)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (232)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (232)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (232)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (232)');
+
+$date->addDays(1);
+
+// Sunday, 22nd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (233)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (233)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (233)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (233)');
+compare('33', $date->formatLikeSQL('IW'), 'IW (233)');
+
+$date->addDays(1);
+
+// Monday, 23rd August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (234)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (234)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (234)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (234)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (234)');
+
+$date->addDays(1);
+
+// Tuesday, 24th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (235)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (235)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (235)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (235)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (235)');
+
+$date->addDays(1);
+
+// Wednesday, 25th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (236)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (236)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (236)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (236)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (236)');
+
+$date->addDays(1);
+
+// Thursday, 26th August 1999
+compare('34', $date->formatLikeSQL('WW'), 'WW (237)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (237)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (237)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (237)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (237)');
+
+$date->addDays(1);
+
+// Friday, 27th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (238)');
+compare('35', $date->formatLikeSQL('W1'), 'W1 (238)');
+compare('34', $date->formatLikeSQL('W4'), 'W4 (238)');
+compare('34', $date->formatLikeSQL('W7'), 'W7 (238)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (238)');
+
+$date->addDays(1);
+
+// Saturday, 28th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (239)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (239)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (239)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (239)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (239)');
+
+$date->addDays(1);
+
+// Sunday, 29th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (240)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (240)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (240)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (240)');
+compare('34', $date->formatLikeSQL('IW'), 'IW (240)');
+
+$date->addDays(1);
+
+// Monday, 30th August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (241)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (241)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (241)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (241)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (241)');
+
+$date->addDays(1);
+
+// Tuesday, 31st August 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (242)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (242)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (242)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (242)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (242)');
+
+$date->addDays(1);
+
+// Wednesday, 1st September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (243)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (243)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (243)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (243)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (243)');
+
+$date->addDays(1);
+
+// Thursday, 2nd September 1999
+compare('35', $date->formatLikeSQL('WW'), 'WW (244)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (244)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (244)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (244)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (244)');
+
+$date->addDays(1);
+
+// Friday, 3rd September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (245)');
+compare('36', $date->formatLikeSQL('W1'), 'W1 (245)');
+compare('35', $date->formatLikeSQL('W4'), 'W4 (245)');
+compare('35', $date->formatLikeSQL('W7'), 'W7 (245)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (245)');
+
+$date->addDays(1);
+
+// Saturday, 4th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (246)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (246)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (246)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (246)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (246)');
+
+$date->addDays(1);
+
+// Sunday, 5th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (247)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (247)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (247)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (247)');
+compare('35', $date->formatLikeSQL('IW'), 'IW (247)');
+
+$date->addDays(1);
+
+// Monday, 6th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (248)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (248)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (248)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (248)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (248)');
+
+$date->addDays(1);
+
+// Tuesday, 7th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (249)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (249)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (249)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (249)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (249)');
+
+$date->addDays(1);
+
+// Wednesday, 8th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (250)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (250)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (250)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (250)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (250)');
+
+$date->addDays(1);
+
+// Thursday, 9th September 1999
+compare('36', $date->formatLikeSQL('WW'), 'WW (251)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (251)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (251)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (251)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (251)');
+
+$date->addDays(1);
+
+// Friday, 10th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (252)');
+compare('37', $date->formatLikeSQL('W1'), 'W1 (252)');
+compare('36', $date->formatLikeSQL('W4'), 'W4 (252)');
+compare('36', $date->formatLikeSQL('W7'), 'W7 (252)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (252)');
+
+$date->addDays(1);
+
+// Saturday, 11th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (253)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (253)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (253)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (253)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (253)');
+
+$date->addDays(1);
+
+// Sunday, 12th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (254)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (254)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (254)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (254)');
+compare('36', $date->formatLikeSQL('IW'), 'IW (254)');
+
+$date->addDays(1);
+
+// Monday, 13th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (255)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (255)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (255)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (255)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (255)');
+
+$date->addDays(1);
+
+// Tuesday, 14th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (256)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (256)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (256)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (256)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (256)');
+
+$date->addDays(1);
+
+// Wednesday, 15th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (257)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (257)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (257)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (257)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (257)');
+
+$date->addDays(1);
+
+// Thursday, 16th September 1999
+compare('37', $date->formatLikeSQL('WW'), 'WW (258)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (258)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (258)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (258)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (258)');
+
+$date->addDays(1);
+
+// Friday, 17th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (259)');
+compare('38', $date->formatLikeSQL('W1'), 'W1 (259)');
+compare('37', $date->formatLikeSQL('W4'), 'W4 (259)');
+compare('37', $date->formatLikeSQL('W7'), 'W7 (259)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (259)');
+
+$date->addDays(1);
+
+// Saturday, 18th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (260)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (260)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (260)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (260)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (260)');
+
+$date->addDays(1);
+
+// Sunday, 19th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (261)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (261)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (261)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (261)');
+compare('37', $date->formatLikeSQL('IW'), 'IW (261)');
+
+$date->addDays(1);
+
+// Monday, 20th September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (262)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (262)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (262)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (262)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (262)');
+
+$date->addDays(1);
+
+// Tuesday, 21st September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (263)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (263)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (263)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (263)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (263)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (264)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (264)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (264)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (264)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (264)');
+
+$date->addDays(1);
+
+// Thursday, 23rd September 1999
+compare('38', $date->formatLikeSQL('WW'), 'WW (265)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (265)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (265)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (265)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (265)');
+
+$date->addDays(1);
+
+// Friday, 24th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (266)');
+compare('39', $date->formatLikeSQL('W1'), 'W1 (266)');
+compare('38', $date->formatLikeSQL('W4'), 'W4 (266)');
+compare('38', $date->formatLikeSQL('W7'), 'W7 (266)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (266)');
+
+$date->addDays(1);
+
+// Saturday, 25th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (267)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (267)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (267)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (267)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (267)');
+
+$date->addDays(1);
+
+// Sunday, 26th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (268)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (268)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (268)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (268)');
+compare('38', $date->formatLikeSQL('IW'), 'IW (268)');
+
+$date->addDays(1);
+
+// Monday, 27th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (269)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (269)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (269)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (269)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (269)');
+
+$date->addDays(1);
+
+// Tuesday, 28th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (270)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (270)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (270)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (270)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (270)');
+
+$date->addDays(1);
+
+// Wednesday, 29th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (271)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (271)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (271)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (271)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (271)');
+
+$date->addDays(1);
+
+// Thursday, 30th September 1999
+compare('39', $date->formatLikeSQL('WW'), 'WW (272)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (272)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (272)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (272)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (272)');
+
+$date->addDays(1);
+
+// Friday, 1st October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (273)');
+compare('40', $date->formatLikeSQL('W1'), 'W1 (273)');
+compare('39', $date->formatLikeSQL('W4'), 'W4 (273)');
+compare('39', $date->formatLikeSQL('W7'), 'W7 (273)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (273)');
+
+$date->addDays(1);
+
+// Saturday, 2nd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (274)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (274)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (274)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (274)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (274)');
+
+$date->addDays(1);
+
+// Sunday, 3rd October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (275)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (275)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (275)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (275)');
+compare('39', $date->formatLikeSQL('IW'), 'IW (275)');
+
+$date->addDays(1);
+
+// Monday, 4th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (276)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (276)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (276)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (276)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (276)');
+
+$date->addDays(1);
+
+// Tuesday, 5th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (277)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (277)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (277)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (277)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (277)');
+
+$date->addDays(1);
+
+// Wednesday, 6th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (278)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (278)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (278)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (278)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (278)');
+
+$date->addDays(1);
+
+// Thursday, 7th October 1999
+compare('40', $date->formatLikeSQL('WW'), 'WW (279)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (279)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (279)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (279)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (279)');
+
+$date->addDays(1);
+
+// Friday, 8th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (280)');
+compare('41', $date->formatLikeSQL('W1'), 'W1 (280)');
+compare('40', $date->formatLikeSQL('W4'), 'W4 (280)');
+compare('40', $date->formatLikeSQL('W7'), 'W7 (280)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (280)');
+
+$date->addDays(1);
+
+// Saturday, 9th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (281)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (281)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (281)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (281)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (281)');
+
+$date->addDays(1);
+
+// Sunday, 10th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (282)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (282)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (282)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (282)');
+compare('40', $date->formatLikeSQL('IW'), 'IW (282)');
+
+$date->addDays(1);
+
+// Monday, 11th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (283)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (283)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (283)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (283)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (283)');
+
+$date->addDays(1);
+
+// Tuesday, 12th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (284)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (284)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (284)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (284)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (284)');
+
+$date->addDays(1);
+
+// Wednesday, 13th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (285)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (285)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (285)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (285)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (285)');
+
+$date->addDays(1);
+
+// Thursday, 14th October 1999
+compare('41', $date->formatLikeSQL('WW'), 'WW (286)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (286)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (286)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (286)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (286)');
+
+$date->addDays(1);
+
+// Friday, 15th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (287)');
+compare('42', $date->formatLikeSQL('W1'), 'W1 (287)');
+compare('41', $date->formatLikeSQL('W4'), 'W4 (287)');
+compare('41', $date->formatLikeSQL('W7'), 'W7 (287)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (287)');
+
+$date->addDays(1);
+
+// Saturday, 16th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (288)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (288)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (288)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (288)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (288)');
+
+$date->addDays(1);
+
+// Sunday, 17th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (289)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (289)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (289)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (289)');
+compare('41', $date->formatLikeSQL('IW'), 'IW (289)');
+
+$date->addDays(1);
+
+// Monday, 18th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (290)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (290)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (290)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (290)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (290)');
+
+$date->addDays(1);
+
+// Tuesday, 19th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (291)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (291)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (291)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (291)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (291)');
+
+$date->addDays(1);
+
+// Wednesday, 20th October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (292)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (292)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (292)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (292)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (292)');
+
+$date->addDays(1);
+
+// Thursday, 21st October 1999
+compare('42', $date->formatLikeSQL('WW'), 'WW (293)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (293)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (293)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (293)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (293)');
+
+$date->addDays(1);
+
+// Friday, 22nd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (294)');
+compare('43', $date->formatLikeSQL('W1'), 'W1 (294)');
+compare('42', $date->formatLikeSQL('W4'), 'W4 (294)');
+compare('42', $date->formatLikeSQL('W7'), 'W7 (294)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (294)');
+
+$date->addDays(1);
+
+// Saturday, 23rd October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (295)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (295)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (295)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (295)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (295)');
+
+$date->addDays(1);
+
+// Sunday, 24th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (296)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (296)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (296)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (296)');
+compare('42', $date->formatLikeSQL('IW'), 'IW (296)');
+
+$date->addDays(1);
+
+// Monday, 25th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (297)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (297)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (297)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (297)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (297)');
+
+$date->addDays(1);
+
+// Tuesday, 26th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (298)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (298)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (298)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (298)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (298)');
+
+$date->addDays(1);
+
+// Wednesday, 27th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (299)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (299)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (299)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (299)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (299)');
+
+$date->addDays(1);
+
+// Thursday, 28th October 1999
+compare('43', $date->formatLikeSQL('WW'), 'WW (300)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (300)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (300)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (300)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (300)');
+
+$date->addDays(1);
+
+// Friday, 29th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (301)');
+compare('44', $date->formatLikeSQL('W1'), 'W1 (301)');
+compare('43', $date->formatLikeSQL('W4'), 'W4 (301)');
+compare('43', $date->formatLikeSQL('W7'), 'W7 (301)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (301)');
+
+$date->addDays(1);
+
+// Saturday, 30th October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (302)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (302)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (302)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (302)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (302)');
+
+$date->addDays(1);
+
+// Sunday, 31st October 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (303)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (303)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (303)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (303)');
+compare('43', $date->formatLikeSQL('IW'), 'IW (303)');
+
+$date->addDays(1);
+
+// Monday, 1st November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (304)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (304)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (304)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (304)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (304)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (305)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (305)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (305)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (305)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (305)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (306)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (306)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (306)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (306)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (306)');
+
+$date->addDays(1);
+
+// Thursday, 4th November 1999
+compare('44', $date->formatLikeSQL('WW'), 'WW (307)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (307)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (307)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (307)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (307)');
+
+$date->addDays(1);
+
+// Friday, 5th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (308)');
+compare('45', $date->formatLikeSQL('W1'), 'W1 (308)');
+compare('44', $date->formatLikeSQL('W4'), 'W4 (308)');
+compare('44', $date->formatLikeSQL('W7'), 'W7 (308)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (308)');
+
+$date->addDays(1);
+
+// Saturday, 6th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (309)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (309)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (309)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (309)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (309)');
+
+$date->addDays(1);
+
+// Sunday, 7th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (310)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (310)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (310)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (310)');
+compare('44', $date->formatLikeSQL('IW'), 'IW (310)');
+
+$date->addDays(1);
+
+// Monday, 8th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (311)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (311)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (311)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (311)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (311)');
+
+$date->addDays(1);
+
+// Tuesday, 9th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (312)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (312)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (312)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (312)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (312)');
+
+$date->addDays(1);
+
+// Wednesday, 10th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (313)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (313)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (313)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (313)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (313)');
+
+$date->addDays(1);
+
+// Thursday, 11th November 1999
+compare('45', $date->formatLikeSQL('WW'), 'WW (314)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (314)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (314)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (314)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (314)');
+
+$date->addDays(1);
+
+// Friday, 12th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (315)');
+compare('46', $date->formatLikeSQL('W1'), 'W1 (315)');
+compare('45', $date->formatLikeSQL('W4'), 'W4 (315)');
+compare('45', $date->formatLikeSQL('W7'), 'W7 (315)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (315)');
+
+$date->addDays(1);
+
+// Saturday, 13th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (316)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (316)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (316)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (316)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (316)');
+
+$date->addDays(1);
+
+// Sunday, 14th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (317)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (317)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (317)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (317)');
+compare('45', $date->formatLikeSQL('IW'), 'IW (317)');
+
+$date->addDays(1);
+
+// Monday, 15th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (318)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (318)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (318)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (318)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (318)');
+
+$date->addDays(1);
+
+// Tuesday, 16th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (319)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (319)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (319)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (319)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (319)');
+
+$date->addDays(1);
+
+// Wednesday, 17th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (320)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (320)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (320)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (320)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (320)');
+
+$date->addDays(1);
+
+// Thursday, 18th November 1999
+compare('46', $date->formatLikeSQL('WW'), 'WW (321)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (321)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (321)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (321)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (321)');
+
+$date->addDays(1);
+
+// Friday, 19th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (322)');
+compare('47', $date->formatLikeSQL('W1'), 'W1 (322)');
+compare('46', $date->formatLikeSQL('W4'), 'W4 (322)');
+compare('46', $date->formatLikeSQL('W7'), 'W7 (322)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (322)');
+
+$date->addDays(1);
+
+// Saturday, 20th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (323)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (323)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (323)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (323)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (323)');
+
+$date->addDays(1);
+
+// Sunday, 21st November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (324)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (324)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (324)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (324)');
+compare('46', $date->formatLikeSQL('IW'), 'IW (324)');
+
+$date->addDays(1);
+
+// Monday, 22nd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (325)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (325)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (325)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (325)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (325)');
+
+$date->addDays(1);
+
+// Tuesday, 23rd November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (326)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (326)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (326)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (326)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (326)');
+
+$date->addDays(1);
+
+// Wednesday, 24th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (327)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (327)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (327)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (327)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (327)');
+
+$date->addDays(1);
+
+// Thursday, 25th November 1999
+compare('47', $date->formatLikeSQL('WW'), 'WW (328)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (328)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (328)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (328)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (328)');
+
+$date->addDays(1);
+
+// Friday, 26th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (329)');
+compare('48', $date->formatLikeSQL('W1'), 'W1 (329)');
+compare('47', $date->formatLikeSQL('W4'), 'W4 (329)');
+compare('47', $date->formatLikeSQL('W7'), 'W7 (329)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (329)');
+
+$date->addDays(1);
+
+// Saturday, 27th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (330)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (330)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (330)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (330)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (330)');
+
+$date->addDays(1);
+
+// Sunday, 28th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (331)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (331)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (331)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (331)');
+compare('47', $date->formatLikeSQL('IW'), 'IW (331)');
+
+$date->addDays(1);
+
+// Monday, 29th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (332)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (332)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (332)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (332)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (332)');
+
+$date->addDays(1);
+
+// Tuesday, 30th November 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (333)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (333)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (333)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (333)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (333)');
+
+$date->addDays(1);
+
+// Wednesday, 1st December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (334)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (334)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (334)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (334)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (334)');
+
+$date->addDays(1);
+
+// Thursday, 2nd December 1999
+compare('48', $date->formatLikeSQL('WW'), 'WW (335)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (335)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (335)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (335)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (335)');
+
+$date->addDays(1);
+
+// Friday, 3rd December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (336)');
+compare('49', $date->formatLikeSQL('W1'), 'W1 (336)');
+compare('48', $date->formatLikeSQL('W4'), 'W4 (336)');
+compare('48', $date->formatLikeSQL('W7'), 'W7 (336)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (336)');
+
+$date->addDays(1);
+
+// Saturday, 4th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (337)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (337)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (337)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (337)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (337)');
+
+$date->addDays(1);
+
+// Sunday, 5th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (338)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (338)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (338)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (338)');
+compare('48', $date->formatLikeSQL('IW'), 'IW (338)');
+
+$date->addDays(1);
+
+// Monday, 6th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (339)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (339)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (339)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (339)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (339)');
+
+$date->addDays(1);
+
+// Tuesday, 7th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (340)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (340)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (340)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (340)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (340)');
+
+$date->addDays(1);
+
+// Wednesday, 8th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (341)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (341)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (341)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (341)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (341)');
+
+$date->addDays(1);
+
+// Thursday, 9th December 1999
+compare('49', $date->formatLikeSQL('WW'), 'WW (342)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (342)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (342)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (342)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (342)');
+
+$date->addDays(1);
+
+// Friday, 10th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (343)');
+compare('50', $date->formatLikeSQL('W1'), 'W1 (343)');
+compare('49', $date->formatLikeSQL('W4'), 'W4 (343)');
+compare('49', $date->formatLikeSQL('W7'), 'W7 (343)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (343)');
+
+$date->addDays(1);
+
+// Saturday, 11th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (344)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (344)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (344)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (344)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (344)');
+
+$date->addDays(1);
+
+// Sunday, 12th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (345)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (345)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (345)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (345)');
+compare('49', $date->formatLikeSQL('IW'), 'IW (345)');
+
+$date->addDays(1);
+
+// Monday, 13th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (346)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (346)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (346)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (346)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (346)');
+
+$date->addDays(1);
+
+// Tuesday, 14th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (347)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (347)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (347)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (347)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (347)');
+
+$date->addDays(1);
+
+// Wednesday, 15th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (348)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (348)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (348)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (348)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (348)');
+
+$date->addDays(1);
+
+// Thursday, 16th December 1999
+compare('50', $date->formatLikeSQL('WW'), 'WW (349)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (349)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (349)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (349)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (349)');
+
+$date->addDays(1);
+
+// Friday, 17th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (350)');
+compare('51', $date->formatLikeSQL('W1'), 'W1 (350)');
+compare('50', $date->formatLikeSQL('W4'), 'W4 (350)');
+compare('50', $date->formatLikeSQL('W7'), 'W7 (350)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (350)');
+
+$date->addDays(1);
+
+// Saturday, 18th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (351)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (351)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (351)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (351)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (351)');
+
+$date->addDays(1);
+
+// Sunday, 19th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (352)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (352)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (352)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (352)');
+compare('50', $date->formatLikeSQL('IW'), 'IW (352)');
+
+$date->addDays(1);
+
+// Monday, 20th December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (353)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (353)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (353)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (353)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (353)');
+
+$date->addDays(1);
+
+// Tuesday, 21st December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (354)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (354)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (354)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (354)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (354)');
+
+$date->addDays(1);
+
+// Wednesday, 22nd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (355)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (355)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (355)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (355)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (355)');
+
+$date->addDays(1);
+
+// Thursday, 23rd December 1999
+compare('51', $date->formatLikeSQL('WW'), 'WW (356)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (356)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (356)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (356)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (356)');
+
+$date->addDays(1);
+
+// Friday, 24th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (357)');
+compare('52', $date->formatLikeSQL('W1'), 'W1 (357)');
+compare('51', $date->formatLikeSQL('W4'), 'W4 (357)');
+compare('51', $date->formatLikeSQL('W7'), 'W7 (357)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (357)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (358)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (358)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (358)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (358)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (358)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (359)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (359)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (359)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (359)');
+compare('51', $date->formatLikeSQL('IW'), 'IW (359)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (360)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (360)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (360)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (360)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (360)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (361)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (361)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (361)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (361)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (361)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (362)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (362)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (362)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (362)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (362)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('52', $date->formatLikeSQL('WW'), 'WW (363)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (363)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (363)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (363)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (363)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('53', $date->formatLikeSQL('WW'), 'WW (364)');
+compare('53', $date->formatLikeSQL('W1'), 'W1 (364)');
+compare('52', $date->formatLikeSQL('W4'), 'W4 (364)');
+compare('52', $date->formatLikeSQL('W7'), 'W7 (364)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (364)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (365)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (365)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (365)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (365)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (365)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (366)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (366)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (366)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (366)');
+compare('52', $date->formatLikeSQL('IW'), 'IW (366)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (367)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (367)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (367)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (367)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (367)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (368)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (368)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (368)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (368)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (369)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (369)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (370)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (370)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
+compare('01', $date->formatLikeSQL('W1'), 'W1 (371)');
+compare('01', $date->formatLikeSQL('W4'), 'W4 (371)');
+compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
+compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
+compare('02', $date->formatLikeSQL('W4'), 'W4 (372)');
+compare('02', $date->formatLikeSQL('W7'), 'W7 (372)');
+compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
diff --git a/extlib/Date/tests/test_weeknumbers_ISO.php b/extlib/Date/tests/test_weeknumbers_ISO.php
new file mode 100644 (file)
index 0000000..42dbc92
--- /dev/null
@@ -0,0 +1,1934 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Tests for the Date_Calc::isoWeekDate() function
+ *
+ * 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.  Otherwise, use the local development
+ * copy of Date.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * All rights reserved.
+ *
+ * This source file is subject to the New BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to pear-dev@lists.php.net so we can send you a copy immediately.
+ *
+ * @category   Date and Time
+ * @package    Date
+ * @author     C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @copyright  Copyright (c) 2007 C.A. Woodcock <c01234@netcomuk.co.uk>
+ * @license    http://www.opensource.org/licenses/bsd-license.php
+ *             BSD License
+ * @link       http://pear.php.net/package/Date
+ * @since      [next version]
+ */
+
+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.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 "<pre>\n";
+}
+
+
+$date = new Date("1989-12-24 00:00:00Z");
+
+// Sunday, 24th December 1989
+compare('1989 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -8)');
+
+$date->addDays(1);
+
+// Monday, 25th December 1989
+compare('1989 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -7)');
+
+$date->addDays(1);
+
+// Tuesday, 26th December 1989
+compare('1989 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -6)');
+
+$date->addDays(1);
+
+// Wednesday, 27th December 1989
+compare('1989 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -5)');
+
+$date->addDays(1);
+
+// Thursday, 28th December 1989
+compare('1989 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -4)');
+
+$date->addDays(1);
+
+// Friday, 29th December 1989
+compare('1989 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -3)');
+
+$date->addDays(1);
+
+// Saturday, 30th December 1989
+compare('1989 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -2)');
+
+$date->addDays(1);
+
+// Sunday, 31st December 1989
+compare('1989 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 -1)');
+
+$date->addDays(1);
+
+// Monday, 1st January 1990
+compare('1990 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 0)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd January 1990
+compare('1990 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 1)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd January 1990
+compare('1990 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 2)');
+
+$date->addDays(1);
+
+// Thursday, 4th January 1990
+compare('1990 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 3)');
+
+$date->addDays(1);
+
+// Friday, 5th January 1990
+compare('1990 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 4)');
+
+$date->addDays(1);
+
+// Saturday, 6th January 1990
+compare('1990 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 5)');
+
+$date->addDays(1);
+
+// Sunday, 7th January 1990
+compare('1990 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 6)');
+
+$date->addDays(1);
+
+// Monday, 8th January 1990
+compare('1990 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1990 7)');
+
+$date->setDayMonthYear(24, 12, 1990);
+
+// Monday, 24th December 1990
+compare('1990 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -8)');
+
+$date->addDays(1);
+
+// Tuesday, 25th December 1990
+compare('1990 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -7)');
+
+$date->addDays(1);
+
+// Wednesday, 26th December 1990
+compare('1990 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -6)');
+
+$date->addDays(1);
+
+// Thursday, 27th December 1990
+compare('1990 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -5)');
+
+$date->addDays(1);
+
+// Friday, 28th December 1990
+compare('1990 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -4)');
+
+$date->addDays(1);
+
+// Saturday, 29th December 1990
+compare('1990 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -3)');
+
+$date->addDays(1);
+
+// Sunday, 30th December 1990
+compare('1990 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -2)');
+
+$date->addDays(1);
+
+// Monday, 31st December 1990
+compare('1991 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 -1)');
+
+$date->addDays(1);
+
+// Tuesday, 1st January 1991
+compare('1991 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 0)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd January 1991
+compare('1991 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 1)');
+
+$date->addDays(1);
+
+// Thursday, 3rd January 1991
+compare('1991 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 2)');
+
+$date->addDays(1);
+
+// Friday, 4th January 1991
+compare('1991 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 3)');
+
+$date->addDays(1);
+
+// Saturday, 5th January 1991
+compare('1991 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 4)');
+
+$date->addDays(1);
+
+// Sunday, 6th January 1991
+compare('1991 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 5)');
+
+$date->addDays(1);
+
+// Monday, 7th January 1991
+compare('1991 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 6)');
+
+$date->addDays(1);
+
+// Tuesday, 8th January 1991
+compare('1991 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1991 7)');
+
+$date->setDayMonthYear(24, 12, 1991);
+
+// Tuesday, 24th December 1991
+compare('1991 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -8)');
+
+$date->addDays(1);
+
+// Wednesday, 25th December 1991
+compare('1991 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -7)');
+
+$date->addDays(1);
+
+// Thursday, 26th December 1991
+compare('1991 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -6)');
+
+$date->addDays(1);
+
+// Friday, 27th December 1991
+compare('1991 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -5)');
+
+$date->addDays(1);
+
+// Saturday, 28th December 1991
+compare('1991 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -4)');
+
+$date->addDays(1);
+
+// Sunday, 29th December 1991
+compare('1991 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -3)');
+
+$date->addDays(1);
+
+// Monday, 30th December 1991
+compare('1992 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -2)');
+
+$date->addDays(1);
+
+// Tuesday, 31st December 1991
+compare('1992 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 -1)');
+
+$date->addDays(1);
+
+// Wednesday, 1st January 1992
+compare('1992 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 0)');
+
+$date->addDays(1);
+
+// Thursday, 2nd January 1992
+compare('1992 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 1)');
+
+$date->addDays(1);
+
+// Friday, 3rd January 1992
+compare('1992 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 2)');
+
+$date->addDays(1);
+
+// Saturday, 4th January 1992
+compare('1992 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 3)');
+
+$date->addDays(1);
+
+// Sunday, 5th January 1992
+compare('1992 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 4)');
+
+$date->addDays(1);
+
+// Monday, 6th January 1992
+compare('1992 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 5)');
+
+$date->addDays(1);
+
+// Tuesday, 7th January 1992
+compare('1992 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 6)');
+
+$date->addDays(1);
+
+// Wednesday, 8th January 1992
+compare('1992 02 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1992 7)');
+
+$date->setDayMonthYear(24, 12, 1992);
+
+// Thursday, 24th December 1992
+compare('1992 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1992
+compare('1992 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1992
+compare('1992 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1992
+compare('1992 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1992
+compare('1992 53 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1992
+compare('1992 53 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1992
+compare('1992 53 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1992
+compare('1992 53 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 -1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1993
+compare('1992 53 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1993
+compare('1992 53 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1993
+compare('1992 53 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1993
+compare('1993 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1993
+compare('1993 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1993
+compare('1993 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1993
+compare('1993 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1993
+compare('1993 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1993 7)');
+
+$date->setDayMonthYear(24, 12, 1993);
+
+// Friday, 24th December 1993
+compare('1993 51 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -8)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1993
+compare('1993 51 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -7)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1993
+compare('1993 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -6)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1993
+compare('1993 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -5)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1993
+compare('1993 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -4)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1993
+compare('1993 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -3)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1993
+compare('1993 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -2)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1993
+compare('1993 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 -1)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 1994
+compare('1993 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 0)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 1994
+compare('1993 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 1)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 1994
+compare('1994 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 2)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 1994
+compare('1994 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 3)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 1994
+compare('1994 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 4)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 1994
+compare('1994 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 5)');
+
+$date->addDays(1);
+
+// Friday, 7th January 1994
+compare('1994 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 6)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 1994
+compare('1994 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1994 7)');
+
+$date->setDayMonthYear(24, 12, 1994);
+
+// Saturday, 24th December 1994
+compare('1994 51 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -8)');
+
+$date->addDays(1);
+
+// Sunday, 25th December 1994
+compare('1994 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -7)');
+
+$date->addDays(1);
+
+// Monday, 26th December 1994
+compare('1994 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -6)');
+
+$date->addDays(1);
+
+// Tuesday, 27th December 1994
+compare('1994 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -5)');
+
+$date->addDays(1);
+
+// Wednesday, 28th December 1994
+compare('1994 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -4)');
+
+$date->addDays(1);
+
+// Thursday, 29th December 1994
+compare('1994 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -3)');
+
+$date->addDays(1);
+
+// Friday, 30th December 1994
+compare('1994 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -2)');
+
+$date->addDays(1);
+
+// Saturday, 31st December 1994
+compare('1994 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 -1)');
+
+$date->addDays(1);
+
+// Sunday, 1st January 1995
+compare('1994 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 0)');
+
+$date->addDays(1);
+
+// Monday, 2nd January 1995
+compare('1995 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 1)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd January 1995
+compare('1995 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 2)');
+
+$date->addDays(1);
+
+// Wednesday, 4th January 1995
+compare('1995 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 3)');
+
+$date->addDays(1);
+
+// Thursday, 5th January 1995
+compare('1995 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 4)');
+
+$date->addDays(1);
+
+// Friday, 6th January 1995
+compare('1995 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 5)');
+
+$date->addDays(1);
+
+// Saturday, 7th January 1995
+compare('1995 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 6)');
+
+$date->addDays(1);
+
+// Sunday, 8th January 1995
+compare('1995 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1995 7)');
+
+$date->setDayMonthYear(24, 12, 1995);
+
+// Sunday, 24th December 1995
+compare('1995 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -8)');
+
+$date->addDays(1);
+
+// Monday, 25th December 1995
+compare('1995 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -7)');
+
+$date->addDays(1);
+
+// Tuesday, 26th December 1995
+compare('1995 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -6)');
+
+$date->addDays(1);
+
+// Wednesday, 27th December 1995
+compare('1995 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -5)');
+
+$date->addDays(1);
+
+// Thursday, 28th December 1995
+compare('1995 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -4)');
+
+$date->addDays(1);
+
+// Friday, 29th December 1995
+compare('1995 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -3)');
+
+$date->addDays(1);
+
+// Saturday, 30th December 1995
+compare('1995 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -2)');
+
+$date->addDays(1);
+
+// Sunday, 31st December 1995
+compare('1995 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 -1)');
+
+$date->addDays(1);
+
+// Monday, 1st January 1996
+compare('1996 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 0)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd January 1996
+compare('1996 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 1)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd January 1996
+compare('1996 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 2)');
+
+$date->addDays(1);
+
+// Thursday, 4th January 1996
+compare('1996 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 3)');
+
+$date->addDays(1);
+
+// Friday, 5th January 1996
+compare('1996 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 4)');
+
+$date->addDays(1);
+
+// Saturday, 6th January 1996
+compare('1996 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 5)');
+
+$date->addDays(1);
+
+// Sunday, 7th January 1996
+compare('1996 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 6)');
+
+$date->addDays(1);
+
+// Monday, 8th January 1996
+compare('1996 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1996 7)');
+
+$date->setDayMonthYear(24, 12, 1996);
+
+// Tuesday, 24th December 1996
+compare('1996 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -8)');
+
+$date->addDays(1);
+
+// Wednesday, 25th December 1996
+compare('1996 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -7)');
+
+$date->addDays(1);
+
+// Thursday, 26th December 1996
+compare('1996 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -6)');
+
+$date->addDays(1);
+
+// Friday, 27th December 1996
+compare('1996 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -5)');
+
+$date->addDays(1);
+
+// Saturday, 28th December 1996
+compare('1996 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -4)');
+
+$date->addDays(1);
+
+// Sunday, 29th December 1996
+compare('1996 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -3)');
+
+$date->addDays(1);
+
+// Monday, 30th December 1996
+compare('1997 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -2)');
+
+$date->addDays(1);
+
+// Tuesday, 31st December 1996
+compare('1997 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 -1)');
+
+$date->addDays(1);
+
+// Wednesday, 1st January 1997
+compare('1997 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 0)');
+
+$date->addDays(1);
+
+// Thursday, 2nd January 1997
+compare('1997 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 1)');
+
+$date->addDays(1);
+
+// Friday, 3rd January 1997
+compare('1997 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 2)');
+
+$date->addDays(1);
+
+// Saturday, 4th January 1997
+compare('1997 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 3)');
+
+$date->addDays(1);
+
+// Sunday, 5th January 1997
+compare('1997 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 4)');
+
+$date->addDays(1);
+
+// Monday, 6th January 1997
+compare('1997 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 5)');
+
+$date->addDays(1);
+
+// Tuesday, 7th January 1997
+compare('1997 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 6)');
+
+$date->addDays(1);
+
+// Wednesday, 8th January 1997
+compare('1997 02 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1997 7)');
+
+$date->setDayMonthYear(24, 12, 1997);
+
+// Wednesday, 24th December 1997
+compare('1997 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -8)');
+
+$date->addDays(1);
+
+// Thursday, 25th December 1997
+compare('1997 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -7)');
+
+$date->addDays(1);
+
+// Friday, 26th December 1997
+compare('1997 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -6)');
+
+$date->addDays(1);
+
+// Saturday, 27th December 1997
+compare('1997 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -5)');
+
+$date->addDays(1);
+
+// Sunday, 28th December 1997
+compare('1997 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -4)');
+
+$date->addDays(1);
+
+// Monday, 29th December 1997
+compare('1998 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -3)');
+
+$date->addDays(1);
+
+// Tuesday, 30th December 1997
+compare('1998 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -2)');
+
+$date->addDays(1);
+
+// Wednesday, 31st December 1997
+compare('1998 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 -1)');
+
+$date->addDays(1);
+
+// Thursday, 1st January 1998
+compare('1998 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 0)');
+
+$date->addDays(1);
+
+// Friday, 2nd January 1998
+compare('1998 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 1)');
+
+$date->addDays(1);
+
+// Saturday, 3rd January 1998
+compare('1998 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 2)');
+
+$date->addDays(1);
+
+// Sunday, 4th January 1998
+compare('1998 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 3)');
+
+$date->addDays(1);
+
+// Monday, 5th January 1998
+compare('1998 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 4)');
+
+$date->addDays(1);
+
+// Tuesday, 6th January 1998
+compare('1998 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 5)');
+
+$date->addDays(1);
+
+// Wednesday, 7th January 1998
+compare('1998 02 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 6)');
+
+$date->addDays(1);
+
+// Thursday, 8th January 1998
+compare('1998 02 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1998 7)');
+
+$date->setDayMonthYear(24, 12, 1998);
+
+// Thursday, 24th December 1998
+compare('1998 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 1998
+compare('1998 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 1998
+compare('1998 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 1998
+compare('1998 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 1998
+compare('1998 53 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 1998
+compare('1998 53 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 1998
+compare('1998 53 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 1998
+compare('1998 53 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 -1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 1999
+compare('1998 53 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 1999
+compare('1998 53 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 1999
+compare('1998 53 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 1999
+compare('1999 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 1999
+compare('1999 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 1999
+compare('1999 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 1999
+compare('1999 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 1999
+compare('1999 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (1999 7)');
+
+$date->setDayMonthYear(24, 12, 1999);
+
+// Friday, 24th December 1999
+compare('1999 51 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -8)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 1999
+compare('1999 51 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -7)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 1999
+compare('1999 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -6)');
+
+$date->addDays(1);
+
+// Monday, 27th December 1999
+compare('1999 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -5)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 1999
+compare('1999 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -4)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 1999
+compare('1999 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -3)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 1999
+compare('1999 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -2)');
+
+$date->addDays(1);
+
+// Friday, 31st December 1999
+compare('1999 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 -1)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2000
+compare('1999 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 0)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2000
+compare('1999 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 1)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2000
+compare('2000 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 2)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2000
+compare('2000 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 3)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2000
+compare('2000 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 4)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2000
+compare('2000 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 5)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2000
+compare('2000 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 6)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2000
+compare('2000 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2000 7)');
+
+$date->setDayMonthYear(24, 12, 2000);
+
+// Sunday, 24th December 2000
+compare('2000 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -8)');
+
+$date->addDays(1);
+
+// Monday, 25th December 2000
+compare('2000 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -7)');
+
+$date->addDays(1);
+
+// Tuesday, 26th December 2000
+compare('2000 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -6)');
+
+$date->addDays(1);
+
+// Wednesday, 27th December 2000
+compare('2000 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -5)');
+
+$date->addDays(1);
+
+// Thursday, 28th December 2000
+compare('2000 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -4)');
+
+$date->addDays(1);
+
+// Friday, 29th December 2000
+compare('2000 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -3)');
+
+$date->addDays(1);
+
+// Saturday, 30th December 2000
+compare('2000 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -2)');
+
+$date->addDays(1);
+
+// Sunday, 31st December 2000
+compare('2000 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 -1)');
+
+$date->addDays(1);
+
+// Monday, 1st January 2001
+compare('2001 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 0)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd January 2001
+compare('2001 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 1)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd January 2001
+compare('2001 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 2)');
+
+$date->addDays(1);
+
+// Thursday, 4th January 2001
+compare('2001 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 3)');
+
+$date->addDays(1);
+
+// Friday, 5th January 2001
+compare('2001 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 4)');
+
+$date->addDays(1);
+
+// Saturday, 6th January 2001
+compare('2001 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 5)');
+
+$date->addDays(1);
+
+// Sunday, 7th January 2001
+compare('2001 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 6)');
+
+$date->addDays(1);
+
+// Monday, 8th January 2001
+compare('2001 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2001 7)');
+
+$date->setDayMonthYear(24, 12, 2001);
+
+// Monday, 24th December 2001
+compare('2001 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -8)');
+
+$date->addDays(1);
+
+// Tuesday, 25th December 2001
+compare('2001 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -7)');
+
+$date->addDays(1);
+
+// Wednesday, 26th December 2001
+compare('2001 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -6)');
+
+$date->addDays(1);
+
+// Thursday, 27th December 2001
+compare('2001 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -5)');
+
+$date->addDays(1);
+
+// Friday, 28th December 2001
+compare('2001 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -4)');
+
+$date->addDays(1);
+
+// Saturday, 29th December 2001
+compare('2001 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -3)');
+
+$date->addDays(1);
+
+// Sunday, 30th December 2001
+compare('2001 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -2)');
+
+$date->addDays(1);
+
+// Monday, 31st December 2001
+compare('2002 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 -1)');
+
+$date->addDays(1);
+
+// Tuesday, 1st January 2002
+compare('2002 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 0)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd January 2002
+compare('2002 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 1)');
+
+$date->addDays(1);
+
+// Thursday, 3rd January 2002
+compare('2002 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 2)');
+
+$date->addDays(1);
+
+// Friday, 4th January 2002
+compare('2002 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 3)');
+
+$date->addDays(1);
+
+// Saturday, 5th January 2002
+compare('2002 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 4)');
+
+$date->addDays(1);
+
+// Sunday, 6th January 2002
+compare('2002 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 5)');
+
+$date->addDays(1);
+
+// Monday, 7th January 2002
+compare('2002 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 6)');
+
+$date->addDays(1);
+
+// Tuesday, 8th January 2002
+compare('2002 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2002 7)');
+
+$date->setDayMonthYear(24, 12, 2002);
+
+// Tuesday, 24th December 2002
+compare('2002 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -8)');
+
+$date->addDays(1);
+
+// Wednesday, 25th December 2002
+compare('2002 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -7)');
+
+$date->addDays(1);
+
+// Thursday, 26th December 2002
+compare('2002 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -6)');
+
+$date->addDays(1);
+
+// Friday, 27th December 2002
+compare('2002 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -5)');
+
+$date->addDays(1);
+
+// Saturday, 28th December 2002
+compare('2002 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -4)');
+
+$date->addDays(1);
+
+// Sunday, 29th December 2002
+compare('2002 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -3)');
+
+$date->addDays(1);
+
+// Monday, 30th December 2002
+compare('2003 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -2)');
+
+$date->addDays(1);
+
+// Tuesday, 31st December 2002
+compare('2003 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 -1)');
+
+$date->addDays(1);
+
+// Wednesday, 1st January 2003
+compare('2003 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 0)');
+
+$date->addDays(1);
+
+// Thursday, 2nd January 2003
+compare('2003 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 1)');
+
+$date->addDays(1);
+
+// Friday, 3rd January 2003
+compare('2003 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 2)');
+
+$date->addDays(1);
+
+// Saturday, 4th January 2003
+compare('2003 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 3)');
+
+$date->addDays(1);
+
+// Sunday, 5th January 2003
+compare('2003 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 4)');
+
+$date->addDays(1);
+
+// Monday, 6th January 2003
+compare('2003 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 5)');
+
+$date->addDays(1);
+
+// Tuesday, 7th January 2003
+compare('2003 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 6)');
+
+$date->addDays(1);
+
+// Wednesday, 8th January 2003
+compare('2003 02 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2003 7)');
+
+$date->setDayMonthYear(24, 12, 2003);
+
+// Wednesday, 24th December 2003
+compare('2003 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -8)');
+
+$date->addDays(1);
+
+// Thursday, 25th December 2003
+compare('2003 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -7)');
+
+$date->addDays(1);
+
+// Friday, 26th December 2003
+compare('2003 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -6)');
+
+$date->addDays(1);
+
+// Saturday, 27th December 2003
+compare('2003 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -5)');
+
+$date->addDays(1);
+
+// Sunday, 28th December 2003
+compare('2003 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -4)');
+
+$date->addDays(1);
+
+// Monday, 29th December 2003
+compare('2004 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -3)');
+
+$date->addDays(1);
+
+// Tuesday, 30th December 2003
+compare('2004 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -2)');
+
+$date->addDays(1);
+
+// Wednesday, 31st December 2003
+compare('2004 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 -1)');
+
+$date->addDays(1);
+
+// Thursday, 1st January 2004
+compare('2004 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 0)');
+
+$date->addDays(1);
+
+// Friday, 2nd January 2004
+compare('2004 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 1)');
+
+$date->addDays(1);
+
+// Saturday, 3rd January 2004
+compare('2004 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 2)');
+
+$date->addDays(1);
+
+// Sunday, 4th January 2004
+compare('2004 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 3)');
+
+$date->addDays(1);
+
+// Monday, 5th January 2004
+compare('2004 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 4)');
+
+$date->addDays(1);
+
+// Tuesday, 6th January 2004
+compare('2004 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 5)');
+
+$date->addDays(1);
+
+// Wednesday, 7th January 2004
+compare('2004 02 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 6)');
+
+$date->addDays(1);
+
+// Thursday, 8th January 2004
+compare('2004 02 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2004 7)');
+
+$date->setDayMonthYear(24, 12, 2004);
+
+// Friday, 24th December 2004
+compare('2004 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -8)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 2004
+compare('2004 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -7)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 2004
+compare('2004 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -6)');
+
+$date->addDays(1);
+
+// Monday, 27th December 2004
+compare('2004 53 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -5)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 2004
+compare('2004 53 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -4)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 2004
+compare('2004 53 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -3)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 2004
+compare('2004 53 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -2)');
+
+$date->addDays(1);
+
+// Friday, 31st December 2004
+compare('2004 53 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 -1)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2005
+compare('2004 53 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 0)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2005
+compare('2004 53 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 1)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2005
+compare('2005 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 2)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2005
+compare('2005 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 3)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2005
+compare('2005 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 4)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2005
+compare('2005 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 5)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2005
+compare('2005 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 6)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2005
+compare('2005 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2005 7)');
+
+$date->setDayMonthYear(24, 12, 2005);
+
+// Saturday, 24th December 2005
+compare('2005 51 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -8)');
+
+$date->addDays(1);
+
+// Sunday, 25th December 2005
+compare('2005 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -7)');
+
+$date->addDays(1);
+
+// Monday, 26th December 2005
+compare('2005 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -6)');
+
+$date->addDays(1);
+
+// Tuesday, 27th December 2005
+compare('2005 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -5)');
+
+$date->addDays(1);
+
+// Wednesday, 28th December 2005
+compare('2005 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -4)');
+
+$date->addDays(1);
+
+// Thursday, 29th December 2005
+compare('2005 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -3)');
+
+$date->addDays(1);
+
+// Friday, 30th December 2005
+compare('2005 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -2)');
+
+$date->addDays(1);
+
+// Saturday, 31st December 2005
+compare('2005 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 -1)');
+
+$date->addDays(1);
+
+// Sunday, 1st January 2006
+compare('2005 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 0)');
+
+$date->addDays(1);
+
+// Monday, 2nd January 2006
+compare('2006 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 1)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd January 2006
+compare('2006 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 2)');
+
+$date->addDays(1);
+
+// Wednesday, 4th January 2006
+compare('2006 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 3)');
+
+$date->addDays(1);
+
+// Thursday, 5th January 2006
+compare('2006 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 4)');
+
+$date->addDays(1);
+
+// Friday, 6th January 2006
+compare('2006 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 5)');
+
+$date->addDays(1);
+
+// Saturday, 7th January 2006
+compare('2006 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 6)');
+
+$date->addDays(1);
+
+// Sunday, 8th January 2006
+compare('2006 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2006 7)');
+
+$date->setDayMonthYear(24, 12, 2006);
+
+// Sunday, 24th December 2006
+compare('2006 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -8)');
+
+$date->addDays(1);
+
+// Monday, 25th December 2006
+compare('2006 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -7)');
+
+$date->addDays(1);
+
+// Tuesday, 26th December 2006
+compare('2006 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -6)');
+
+$date->addDays(1);
+
+// Wednesday, 27th December 2006
+compare('2006 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -5)');
+
+$date->addDays(1);
+
+// Thursday, 28th December 2006
+compare('2006 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -4)');
+
+$date->addDays(1);
+
+// Friday, 29th December 2006
+compare('2006 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -3)');
+
+$date->addDays(1);
+
+// Saturday, 30th December 2006
+compare('2006 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -2)');
+
+$date->addDays(1);
+
+// Sunday, 31st December 2006
+compare('2006 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 -1)');
+
+$date->addDays(1);
+
+// Monday, 1st January 2007
+compare('2007 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 0)');
+
+$date->addDays(1);
+
+// Tuesday, 2nd January 2007
+compare('2007 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 1)');
+
+$date->addDays(1);
+
+// Wednesday, 3rd January 2007
+compare('2007 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 2)');
+
+$date->addDays(1);
+
+// Thursday, 4th January 2007
+compare('2007 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 3)');
+
+$date->addDays(1);
+
+// Friday, 5th January 2007
+compare('2007 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 4)');
+
+$date->addDays(1);
+
+// Saturday, 6th January 2007
+compare('2007 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 5)');
+
+$date->addDays(1);
+
+// Sunday, 7th January 2007
+compare('2007 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 6)');
+
+$date->addDays(1);
+
+// Monday, 8th January 2007
+compare('2007 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2007 7)');
+
+$date->setDayMonthYear(24, 12, 2007);
+
+// Monday, 24th December 2007
+compare('2007 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -8)');
+
+$date->addDays(1);
+
+// Tuesday, 25th December 2007
+compare('2007 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -7)');
+
+$date->addDays(1);
+
+// Wednesday, 26th December 2007
+compare('2007 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -6)');
+
+$date->addDays(1);
+
+// Thursday, 27th December 2007
+compare('2007 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -5)');
+
+$date->addDays(1);
+
+// Friday, 28th December 2007
+compare('2007 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -4)');
+
+$date->addDays(1);
+
+// Saturday, 29th December 2007
+compare('2007 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -3)');
+
+$date->addDays(1);
+
+// Sunday, 30th December 2007
+compare('2007 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -2)');
+
+$date->addDays(1);
+
+// Monday, 31st December 2007
+compare('2008 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 -1)');
+
+$date->addDays(1);
+
+// Tuesday, 1st January 2008
+compare('2008 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 0)');
+
+$date->addDays(1);
+
+// Wednesday, 2nd January 2008
+compare('2008 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 1)');
+
+$date->addDays(1);
+
+// Thursday, 3rd January 2008
+compare('2008 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 2)');
+
+$date->addDays(1);
+
+// Friday, 4th January 2008
+compare('2008 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 3)');
+
+$date->addDays(1);
+
+// Saturday, 5th January 2008
+compare('2008 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 4)');
+
+$date->addDays(1);
+
+// Sunday, 6th January 2008
+compare('2008 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 5)');
+
+$date->addDays(1);
+
+// Monday, 7th January 2008
+compare('2008 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 6)');
+
+$date->addDays(1);
+
+// Tuesday, 8th January 2008
+compare('2008 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2008 7)');
+
+$date->setDayMonthYear(24, 12, 2008);
+
+// Wednesday, 24th December 2008
+compare('2008 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -8)');
+
+$date->addDays(1);
+
+// Thursday, 25th December 2008
+compare('2008 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -7)');
+
+$date->addDays(1);
+
+// Friday, 26th December 2008
+compare('2008 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -6)');
+
+$date->addDays(1);
+
+// Saturday, 27th December 2008
+compare('2008 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -5)');
+
+$date->addDays(1);
+
+// Sunday, 28th December 2008
+compare('2008 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -4)');
+
+$date->addDays(1);
+
+// Monday, 29th December 2008
+compare('2009 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -3)');
+
+$date->addDays(1);
+
+// Tuesday, 30th December 2008
+compare('2009 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -2)');
+
+$date->addDays(1);
+
+// Wednesday, 31st December 2008
+compare('2009 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 -1)');
+
+$date->addDays(1);
+
+// Thursday, 1st January 2009
+compare('2009 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 0)');
+
+$date->addDays(1);
+
+// Friday, 2nd January 2009
+compare('2009 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 1)');
+
+$date->addDays(1);
+
+// Saturday, 3rd January 2009
+compare('2009 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 2)');
+
+$date->addDays(1);
+
+// Sunday, 4th January 2009
+compare('2009 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 3)');
+
+$date->addDays(1);
+
+// Monday, 5th January 2009
+compare('2009 02 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 4)');
+
+$date->addDays(1);
+
+// Tuesday, 6th January 2009
+compare('2009 02 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 5)');
+
+$date->addDays(1);
+
+// Wednesday, 7th January 2009
+compare('2009 02 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 6)');
+
+$date->addDays(1);
+
+// Thursday, 8th January 2009
+compare('2009 02 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2009 7)');
+
+$date->setDayMonthYear(24, 12, 2009);
+
+// Thursday, 24th December 2009
+compare('2009 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -8)');
+
+$date->addDays(1);
+
+// Friday, 25th December 2009
+compare('2009 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -7)');
+
+$date->addDays(1);
+
+// Saturday, 26th December 2009
+compare('2009 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -6)');
+
+$date->addDays(1);
+
+// Sunday, 27th December 2009
+compare('2009 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -5)');
+
+$date->addDays(1);
+
+// Monday, 28th December 2009
+compare('2009 53 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -4)');
+
+$date->addDays(1);
+
+// Tuesday, 29th December 2009
+compare('2009 53 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -3)');
+
+$date->addDays(1);
+
+// Wednesday, 30th December 2009
+compare('2009 53 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -2)');
+
+$date->addDays(1);
+
+// Thursday, 31st December 2009
+compare('2009 53 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 -1)');
+
+$date->addDays(1);
+
+// Friday, 1st January 2010
+compare('2009 53 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 0)');
+
+$date->addDays(1);
+
+// Saturday, 2nd January 2010
+compare('2009 53 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 1)');
+
+$date->addDays(1);
+
+// Sunday, 3rd January 2010
+compare('2009 53 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 2)');
+
+$date->addDays(1);
+
+// Monday, 4th January 2010
+compare('2010 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 3)');
+
+$date->addDays(1);
+
+// Tuesday, 5th January 2010
+compare('2010 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 4)');
+
+$date->addDays(1);
+
+// Wednesday, 6th January 2010
+compare('2010 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 5)');
+
+$date->addDays(1);
+
+// Thursday, 7th January 2010
+compare('2010 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 6)');
+
+$date->addDays(1);
+
+// Friday, 8th January 2010
+compare('2010 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2010 7)');
+
+$date->setDayMonthYear(24, 12, 2010);
+
+// Friday, 24th December 2010
+compare('2010 51 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -8)');
+
+$date->addDays(1);
+
+// Saturday, 25th December 2010
+compare('2010 51 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -7)');
+
+$date->addDays(1);
+
+// Sunday, 26th December 2010
+compare('2010 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -6)');
+
+$date->addDays(1);
+
+// Monday, 27th December 2010
+compare('2010 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -5)');
+
+$date->addDays(1);
+
+// Tuesday, 28th December 2010
+compare('2010 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -4)');
+
+$date->addDays(1);
+
+// Wednesday, 29th December 2010
+compare('2010 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -3)');
+
+$date->addDays(1);
+
+// Thursday, 30th December 2010
+compare('2010 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -2)');
+
+$date->addDays(1);
+
+// Friday, 31st December 2010
+compare('2010 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 -1)');
+
+$date->addDays(1);
+
+// Saturday, 1st January 2011
+compare('2010 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 0)');
+
+$date->addDays(1);
+
+// Sunday, 2nd January 2011
+compare('2010 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 1)');
+
+$date->addDays(1);
+
+// Monday, 3rd January 2011
+compare('2011 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 2)');
+
+$date->addDays(1);
+
+// Tuesday, 4th January 2011
+compare('2011 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 3)');
+
+$date->addDays(1);
+
+// Wednesday, 5th January 2011
+compare('2011 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 4)');
+
+$date->addDays(1);
+
+// Thursday, 6th January 2011
+compare('2011 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 5)');
+
+$date->addDays(1);
+
+// Friday, 7th January 2011
+compare('2011 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 6)');
+
+$date->addDays(1);
+
+// Saturday, 8th January 2011
+compare('2011 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2011 7)');
+
+$date->setDayMonthYear(24, 12, 2011);
+
+// Saturday, 24th December 2011
+compare('2011 51 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -8)');
+
+$date->addDays(1);
+
+// Sunday, 25th December 2011
+compare('2011 51 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -7)');
+
+$date->addDays(1);
+
+// Monday, 26th December 2011
+compare('2011 52 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -6)');
+
+$date->addDays(1);
+
+// Tuesday, 27th December 2011
+compare('2011 52 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -5)');
+
+$date->addDays(1);
+
+// Wednesday, 28th December 2011
+compare('2011 52 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -4)');
+
+$date->addDays(1);
+
+// Thursday, 29th December 2011
+compare('2011 52 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -3)');
+
+$date->addDays(1);
+
+// Friday, 30th December 2011
+compare('2011 52 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -2)');
+
+$date->addDays(1);
+
+// Saturday, 31st December 2011
+compare('2011 52 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 -1)');
+
+$date->addDays(1);
+
+// Sunday, 1st January 2012
+compare('2011 52 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 0)');
+
+$date->addDays(1);
+
+// Monday, 2nd January 2012
+compare('2012 01 1', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 1)');
+
+$date->addDays(1);
+
+// Tuesday, 3rd January 2012
+compare('2012 01 2', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 2)');
+
+$date->addDays(1);
+
+// Wednesday, 4th January 2012
+compare('2012 01 3', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 3)');
+
+$date->addDays(1);
+
+// Thursday, 5th January 2012
+compare('2012 01 4', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 4)');
+
+$date->addDays(1);
+
+// Friday, 6th January 2012
+compare('2012 01 5', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 5)');
+
+$date->addDays(1);
+
+// Saturday, 7th January 2012
+compare('2012 01 6', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 6)');
+
+$date->addDays(1);
+
+// Sunday, 8th January 2012
+compare('2012 01 7', $date->formatLikeSQL('IYYY IW ID'), 'IW (2012 7)');
diff --git a/extlib/Net/IDNA.php b/extlib/Net/IDNA.php
deleted file mode 100644 (file)
index 987a37e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-// {{{ license
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-//
-// +----------------------------------------------------------------------+
-// | This library is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU Lesser General Public License as       |
-// | published by the Free Software Foundation; either version 2.1 of the |
-// | License, or (at your option) any later version.                      |
-// |                                                                      |
-// | This library is distributed in the hope that it will be useful, but  |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of           |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
-// | Lesser General Public License for more details.                      |
-// |                                                                      |
-// | You should have received a copy of the GNU Lesser General Public     |
-// | License along with this library; if not, write to the Free Software  |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 |
-// | USA.                                                                 |
-// +----------------------------------------------------------------------+
-//
-
-// }}}
-
-
-/**
- * Encode/decode Internationalized Domain Names.
- * Factory class to get correct implementation either for php4 or php5.
- *
- * @author  Markus Nix <mnix@docuverse.de>
- * @author  Matthias Sommerfeld <mso@phlylabs.de>
- * @package Net
- * @version $Id: IDNA.php 284681 2009-07-24 04:24:27Z clockwerx $
- */
-
-class Net_IDNA
-{
-    // {{{ factory
-    /**
-     * Attempts to return a concrete IDNA instance for either php4 or php5.
-     *
-     * @param  array  $params   Set of paramaters
-     * @return object IDNA      The newly created concrete Log instance, or an
-     *                          false on an error.
-     * @access public
-     */
-    function getInstance($params = array())
-    {
-        $version   = explode( '.', phpversion() );
-        $handler   = ((int)$version[0] > 4) ? 'php5' : 'php4';
-        $class     = 'Net_IDNA_' . $handler;
-        $classfile = 'Net/IDNA/' . $handler . '.php';
-
-        /*
-         * Attempt to include our version of the named class, but don't treat
-         * a failure as fatal.  The caller may have already included their own
-         * version of the named class.
-         */
-        @include_once $classfile;
-
-        /* If the class exists, return a new instance of it. */
-        if (class_exists($class)) {
-            return new $class($params);
-        }
-
-        return false;
-    }
-    // }}}
-
-    // {{{ singleton
-    /**
-     * Attempts to return a concrete IDNA instance for either php4 or php5,
-     * only creating a new instance if no IDNA instance with the same
-     * parameters currently exists.
-     *
-     * @param  array  $params   Set of paramaters
-     * @return object IDNA      The newly created concrete Log instance, or an
-     *                          false on an error.
-     * @access public
-     */
-    function singleton($params = array())
-    {
-        static $instances;
-        if (!isset($instances)) {
-            $instances = array();
-        }
-
-        $signature = serialize($params);
-        if (!isset($instances[$signature])) {
-            $instances[$signature] = Net_IDNA::getInstance($params);
-        }
-
-        return $instances[$signature];
-    }
-    // }}}
-}
-
-?>
diff --git a/extlib/Net/IDNA/php5.php b/extlib/Net/IDNA/php5.php
deleted file mode 100644 (file)
index d617721..0000000
+++ /dev/null
@@ -1,3269 +0,0 @@
-<?php
-
-// {{{ license
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-//
-// +----------------------------------------------------------------------+
-// | This library is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU Lesser General Public License as       |
-// | published by the Free Software Foundation; either version 2.1 of the |
-// | License, or (at your option) any later version.                      |
-// |                                                                      |
-// | This library is distributed in the hope that it will be useful, but  |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of           |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
-// | Lesser General Public License for more details.                      |
-// |                                                                      |
-// | You should have received a copy of the GNU Lesser General Public     |
-// | License along with this library; if not, write to the Free Software  |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 |
-// | USA.                                                                 |
-// +----------------------------------------------------------------------+
-//
-
-// }}}
-
-
-/**
- * Encode/decode Internationalized Domain Names.
- *
- * The class allows to convert internationalized domain names
- * (see RFC 3490 for details) as they can be used with various registries worldwide
- * to be translated between their original (localized) form and their encoded form
- * as it will be used in the DNS (Domain Name System).
- *
- * The class provides two public methods, encode() and decode(), which do exactly
- * what you would expect them to do. You are allowed to use complete domain names,
- * simple strings and complete email addresses as well. That means, that you might
- * use any of the following notations:
- *
- * - www.n�rgler.com
- * - xn--nrgler-wxa
- * - xn--brse-5qa.xn--knrz-1ra.info
- *
- * Unicode input might be given as either UTF-8 string, UCS-4 string or UCS-4
- * array. Unicode output is available in the same formats.
- * You can select your preferred format via {@link set_paramter()}.
- *
- * ACE input and output is always expected to be ASCII.
- *
- * @author  Markus Nix <mnix@docuverse.de>
- * @author  Matthias Sommerfeld <mso@phlylabs.de>
- * @author  Stefan Neufeind <pear.neufeind@speedpartner.de>
- * @package Net
- * @version $Id: php5.php 284682 2009-07-24 04:27:35Z clockwerx $
- */
-
-class Net_IDNA_php5
-{
-    // {{{ npdata
-    /**
-     * These Unicode codepoints are
-     * mapped to nothing, See RFC3454 for details
-     *
-     * @static
-     * @var array
-     * @access private
-     */
-    private static $_np_map_nothing = array(
-        0xAD,
-        0x34F,
-        0x1806,
-        0x180B,
-        0x180C,
-        0x180D,
-        0x200B,
-        0x200C,
-        0x200D,
-        0x2060,
-        0xFE00,
-        0xFE01,
-        0xFE02,
-        0xFE03,
-        0xFE04,
-        0xFE05,
-        0xFE06,
-        0xFE07,
-        0xFE08,
-        0xFE09,
-        0xFE0A,
-        0xFE0B,
-        0xFE0C,
-        0xFE0D,
-        0xFE0E,
-        0xFE0F,
-        0xFEFF
-    );
-
-    /**
-     * Prohibited codepints
-     *
-     * @static
-     * @var array
-     * @access private
-     */
-    private static $_general_prohibited = array(
-        0,
-        1,
-        2,
-        3,
-        4,
-        5,
-        6,
-        7,
-        8,
-        9,
-        0xA,
-        0xB,
-        0xC,
-        0xD,
-        0xE,
-        0xF,
-        0x10,
-        0x11,
-        0x12,
-        0x13,
-        0x14,
-        0x15,
-        0x16,
-        0x17,
-        0x18,
-        0x19,
-        0x1A,
-        0x1B,
-        0x1C,
-        0x1D,
-        0x1E,
-        0x1F,
-        0x20,
-        0x21,
-        0x22,
-        0x23,
-        0x24,
-        0x25,
-        0x26,
-        0x27,
-        0x28,
-        0x29,
-        0x2A,
-        0x2B,
-        0x2C,
-        0x2F,
-        0x3B,
-        0x3C,
-        0x3D,
-        0x3E,
-        0x3F,
-        0x40,
-        0x5B,
-        0x5C,
-        0x5D,
-        0x5E,
-        0x5F,
-        0x60,
-        0x7B,
-        0x7C,
-        0x7D,
-        0x7E,
-        0x7F,
-        0x3002
-    );
-
-    /**
-     * Codepints prohibited by Nameprep
-     * @static
-     * @var array
-     * @access private
-     */
-    private static $_np_prohibit = array(
-        0xA0,
-        0x1680,
-        0x2000,
-        0x2001,
-        0x2002,
-        0x2003,
-        0x2004,
-        0x2005,
-        0x2006,
-        0x2007,
-        0x2008,
-        0x2009,
-        0x200A,
-        0x200B,
-        0x202F,
-        0x205F,
-        0x3000,
-        0x6DD,
-        0x70F,
-        0x180E,
-        0x200C,
-        0x200D,
-        0x2028,
-        0x2029,
-        0xFEFF,
-        0xFFF9,
-        0xFFFA,
-        0xFFFB,
-        0xFFFC,
-        0xFFFE,
-        0xFFFF,
-        0x1FFFE,
-        0x1FFFF,
-        0x2FFFE,
-        0x2FFFF,
-        0x3FFFE,
-        0x3FFFF,
-        0x4FFFE,
-        0x4FFFF,
-        0x5FFFE,
-        0x5FFFF,
-        0x6FFFE,
-        0x6FFFF,
-        0x7FFFE,
-        0x7FFFF,
-        0x8FFFE,
-        0x8FFFF,
-        0x9FFFE,
-        0x9FFFF,
-        0xAFFFE,
-        0xAFFFF,
-        0xBFFFE,
-        0xBFFFF,
-        0xCFFFE,
-        0xCFFFF,
-        0xDFFFE,
-        0xDFFFF,
-        0xEFFFE,
-        0xEFFFF,
-        0xFFFFE,
-        0xFFFFF,
-        0x10FFFE,
-        0x10FFFF,
-        0xFFF9,
-        0xFFFA,
-        0xFFFB,
-        0xFFFC,
-        0xFFFD,
-        0x340,
-        0x341,
-        0x200E,
-        0x200F,
-        0x202A,
-        0x202B,
-        0x202C,
-        0x202D,
-        0x202E,
-        0x206A,
-        0x206B,
-        0x206C,
-        0x206D,
-        0x206E,
-        0x206F,
-        0xE0001
-    );
-
-    /**
-     * Codepoint ranges prohibited by nameprep
-     *
-     * @static
-     * @var array
-     * @access private
-     */
-    private static $_np_prohibit_ranges = array(
-        array(0x80,     0x9F    ),
-        array(0x2060,   0x206F  ),
-        array(0x1D173,  0x1D17A ),
-        array(0xE000,   0xF8FF  ),
-        array(0xF0000,  0xFFFFD ),
-        array(0x100000, 0x10FFFD),
-        array(0xFDD0,   0xFDEF  ),
-        array(0xD800,   0xDFFF  ),
-        array(0x2FF0,   0x2FFB  ),
-        array(0xE0020,  0xE007F )
-    );
-
-    /**
-     * Replacement mappings (casemapping, replacement sequences, ...)
-     *
-     * @static
-     * @var array
-     * @access private
-     */
-    private static $_np_replacemaps = array(
-        0x41    => array(0x61),
-        0x42    => array(0x62),
-        0x43    => array(0x63),
-        0x44    => array(0x64),
-        0x45    => array(0x65),
-        0x46    => array(0x66),
-        0x47    => array(0x67),
-        0x48    => array(0x68),
-        0x49    => array(0x69),
-        0x4A    => array(0x6A),
-        0x4B    => array(0x6B),
-        0x4C    => array(0x6C),
-        0x4D    => array(0x6D),
-        0x4E    => array(0x6E),
-        0x4F    => array(0x6F),
-        0x50    => array(0x70),
-        0x51    => array(0x71),
-        0x52    => array(0x72),
-        0x53    => array(0x73),
-        0x54    => array(0x74),
-        0x55    => array(0x75),
-        0x56    => array(0x76),
-        0x57    => array(0x77),
-        0x58    => array(0x78),
-        0x59    => array(0x79),
-        0x5A    => array(0x7A),
-        0xB5    => array(0x3BC),
-        0xC0    => array(0xE0),
-        0xC1    => array(0xE1),
-        0xC2    => array(0xE2),
-        0xC3    => array(0xE3),
-        0xC4    => array(0xE4),
-        0xC5    => array(0xE5),
-        0xC6    => array(0xE6),
-        0xC7    => array(0xE7),
-        0xC8    => array(0xE8),
-        0xC9    => array(0xE9),
-        0xCA    => array(0xEA),
-        0xCB    => array(0xEB),
-        0xCC    => array(0xEC),
-        0xCD    => array(0xED),
-        0xCE    => array(0xEE),
-        0xCF    => array(0xEF),
-        0xD0    => array(0xF0),
-        0xD1    => array(0xF1),
-        0xD2    => array(0xF2),
-        0xD3    => array(0xF3),
-        0xD4    => array(0xF4),
-        0xD5    => array(0xF5),
-        0xD6    => array(0xF6),
-        0xD8    => array(0xF8),
-        0xD9    => array(0xF9),
-        0xDA    => array(0xFA),
-        0xDB    => array(0xFB),
-        0xDC    => array(0xFC),
-        0xDD    => array(0xFD),
-        0xDE    => array(0xFE),
-        0xDF    => array(0x73, 0x73),
-        0x100   => array(0x101),
-        0x102   => array(0x103),
-        0x104   => array(0x105),
-        0x106   => array(0x107),
-        0x108   => array(0x109),
-        0x10A   => array(0x10B),
-        0x10C   => array(0x10D),
-        0x10E   => array(0x10F),
-        0x110   => array(0x111),
-        0x112   => array(0x113),
-        0x114   => array(0x115),
-        0x116   => array(0x117),
-        0x118   => array(0x119),
-        0x11A   => array(0x11B),
-        0x11C   => array(0x11D),
-        0x11E   => array(0x11F),
-        0x120   => array(0x121),
-        0x122   => array(0x123),
-        0x124   => array(0x125),
-        0x126   => array(0x127),
-        0x128   => array(0x129),
-        0x12A   => array(0x12B),
-        0x12C   => array(0x12D),
-        0x12E   => array(0x12F),
-        0x130   => array(0x69, 0x307),
-        0x132   => array(0x133),
-        0x134   => array(0x135),
-        0x136   => array(0x137),
-        0x139   => array(0x13A),
-        0x13B   => array(0x13C),
-        0x13D   => array(0x13E),
-        0x13F   => array(0x140),
-        0x141   => array(0x142),
-        0x143   => array(0x144),
-        0x145   => array(0x146),
-        0x147   => array(0x148),
-        0x149   => array(0x2BC, 0x6E),
-        0x14A   => array(0x14B),
-        0x14C   => array(0x14D),
-        0x14E   => array(0x14F),
-        0x150   => array(0x151),
-        0x152   => array(0x153),
-        0x154   => array(0x155),
-        0x156   => array(0x157),
-        0x158   => array(0x159),
-        0x15A   => array(0x15B),
-        0x15C   => array(0x15D),
-        0x15E   => array(0x15F),
-        0x160   => array(0x161),
-        0x162   => array(0x163),
-        0x164   => array(0x165),
-        0x166   => array(0x167),
-        0x168   => array(0x169),
-        0x16A   => array(0x16B),
-        0x16C   => array(0x16D),
-        0x16E   => array(0x16F),
-        0x170   => array(0x171),
-        0x172   => array(0x173),
-        0x174   => array(0x175),
-        0x176   => array(0x177),
-        0x178   => array(0xFF),
-        0x179   => array(0x17A),
-        0x17B   => array(0x17C),
-        0x17D   => array(0x17E),
-        0x17F   => array(0x73),
-        0x181   => array(0x253),
-        0x182   => array(0x183),
-        0x184   => array(0x185),
-        0x186   => array(0x254),
-        0x187   => array(0x188),
-        0x189   => array(0x256),
-        0x18A   => array(0x257),
-        0x18B   => array(0x18C),
-        0x18E   => array(0x1DD),
-        0x18F   => array(0x259),
-        0x190   => array(0x25B),
-        0x191   => array(0x192),
-        0x193   => array(0x260),
-        0x194   => array(0x263),
-        0x196   => array(0x269),
-        0x197   => array(0x268),
-        0x198   => array(0x199),
-        0x19C   => array(0x26F),
-        0x19D   => array(0x272),
-        0x19F   => array(0x275),
-        0x1A0   => array(0x1A1),
-        0x1A2   => array(0x1A3),
-        0x1A4   => array(0x1A5),
-        0x1A6   => array(0x280),
-        0x1A7   => array(0x1A8),
-        0x1A9   => array(0x283),
-        0x1AC   => array(0x1AD),
-        0x1AE   => array(0x288),
-        0x1AF   => array(0x1B0),
-        0x1B1   => array(0x28A),
-        0x1B2   => array(0x28B),
-        0x1B3   => array(0x1B4),
-        0x1B5   => array(0x1B6),
-        0x1B7   => array(0x292),
-        0x1B8   => array(0x1B9),
-        0x1BC   => array(0x1BD),
-        0x1C4   => array(0x1C6),
-        0x1C5   => array(0x1C6),
-        0x1C7   => array(0x1C9),
-        0x1C8   => array(0x1C9),
-        0x1CA   => array(0x1CC),
-        0x1CB   => array(0x1CC),
-        0x1CD   => array(0x1CE),
-        0x1CF   => array(0x1D0),
-        0x1D1   => array(0x1D2),
-        0x1D3   => array(0x1D4),
-        0x1D5   => array(0x1D6),
-        0x1D7   => array(0x1D8),
-        0x1D9   => array(0x1DA),
-        0x1DB   => array(0x1DC),
-        0x1DE   => array(0x1DF),
-        0x1E0   => array(0x1E1),
-        0x1E2   => array(0x1E3),
-        0x1E4   => array(0x1E5),
-        0x1E6   => array(0x1E7),
-        0x1E8   => array(0x1E9),
-        0x1EA   => array(0x1EB),
-        0x1EC   => array(0x1ED),
-        0x1EE   => array(0x1EF),
-        0x1F0   => array(0x6A, 0x30C),
-        0x1F1   => array(0x1F3),
-        0x1F2   => array(0x1F3),
-        0x1F4   => array(0x1F5),
-        0x1F6   => array(0x195),
-        0x1F7   => array(0x1BF),
-        0x1F8   => array(0x1F9),
-        0x1FA   => array(0x1FB),
-        0x1FC   => array(0x1FD),
-        0x1FE   => array(0x1FF),
-        0x200   => array(0x201),
-        0x202   => array(0x203),
-        0x204   => array(0x205),
-        0x206   => array(0x207),
-        0x208   => array(0x209),
-        0x20A   => array(0x20B),
-        0x20C   => array(0x20D),
-        0x20E   => array(0x20F),
-        0x210   => array(0x211),
-        0x212   => array(0x213),
-        0x214   => array(0x215),
-        0x216   => array(0x217),
-        0x218   => array(0x219),
-        0x21A   => array(0x21B),
-        0x21C   => array(0x21D),
-        0x21E   => array(0x21F),
-        0x220   => array(0x19E),
-        0x222   => array(0x223),
-        0x224   => array(0x225),
-        0x226   => array(0x227),
-        0x228   => array(0x229),
-        0x22A   => array(0x22B),
-        0x22C   => array(0x22D),
-        0x22E   => array(0x22F),
-        0x230   => array(0x231),
-        0x232   => array(0x233),
-        0x345   => array(0x3B9),
-        0x37A   => array(0x20, 0x3B9),
-        0x386   => array(0x3AC),
-        0x388   => array(0x3AD),
-        0x389   => array(0x3AE),
-        0x38A   => array(0x3AF),
-        0x38C   => array(0x3CC),
-        0x38E   => array(0x3CD),
-        0x38F   => array(0x3CE),
-        0x390   => array(0x3B9, 0x308, 0x301),
-        0x391   => array(0x3B1),
-        0x392   => array(0x3B2),
-        0x393   => array(0x3B3),
-        0x394   => array(0x3B4),
-        0x395   => array(0x3B5),
-        0x396   => array(0x3B6),
-        0x397   => array(0x3B7),
-        0x398   => array(0x3B8),
-        0x399   => array(0x3B9),
-        0x39A   => array(0x3BA),
-        0x39B   => array(0x3BB),
-        0x39C   => array(0x3BC),
-        0x39D   => array(0x3BD),
-        0x39E   => array(0x3BE),
-        0x39F   => array(0x3BF),
-        0x3A0   => array(0x3C0),
-        0x3A1   => array(0x3C1),
-        0x3A3   => array(0x3C3),
-        0x3A4   => array(0x3C4),
-        0x3A5   => array(0x3C5),
-        0x3A6   => array(0x3C6),
-        0x3A7   => array(0x3C7),
-        0x3A8   => array(0x3C8),
-        0x3A9   => array(0x3C9),
-        0x3AA   => array(0x3CA),
-        0x3AB   => array(0x3CB),
-        0x3B0   => array(0x3C5, 0x308, 0x301),
-        0x3C2   => array(0x3C3),
-        0x3D0   => array(0x3B2),
-        0x3D1   => array(0x3B8),
-        0x3D2   => array(0x3C5),
-        0x3D3   => array(0x3CD),
-        0x3D4   => array(0x3CB),
-        0x3D5   => array(0x3C6),
-        0x3D6   => array(0x3C0),
-        0x3D8   => array(0x3D9),
-        0x3DA   => array(0x3DB),
-        0x3DC   => array(0x3DD),
-        0x3DE   => array(0x3DF),
-        0x3E0   => array(0x3E1),
-        0x3E2   => array(0x3E3),
-        0x3E4   => array(0x3E5),
-        0x3E6   => array(0x3E7),
-        0x3E8   => array(0x3E9),
-        0x3EA   => array(0x3EB),
-        0x3EC   => array(0x3ED),
-        0x3EE   => array(0x3EF),
-        0x3F0   => array(0x3BA),
-        0x3F1   => array(0x3C1),
-        0x3F2   => array(0x3C3),
-        0x3F4   => array(0x3B8),
-        0x3F5   => array(0x3B5),
-        0x400   => array(0x450),
-        0x401   => array(0x451),
-        0x402   => array(0x452),
-        0x403   => array(0x453),
-        0x404   => array(0x454),
-        0x405   => array(0x455),
-        0x406   => array(0x456),
-        0x407   => array(0x457),
-        0x408   => array(0x458),
-        0x409   => array(0x459),
-        0x40A   => array(0x45A),
-        0x40B   => array(0x45B),
-        0x40C   => array(0x45C),
-        0x40D   => array(0x45D),
-        0x40E   => array(0x45E),
-        0x40F   => array(0x45F),
-        0x410   => array(0x430),
-        0x411   => array(0x431),
-        0x412   => array(0x432),
-        0x413   => array(0x433),
-        0x414   => array(0x434),
-        0x415   => array(0x435),
-        0x416   => array(0x436),
-        0x417   => array(0x437),
-        0x418   => array(0x438),
-        0x419   => array(0x439),
-        0x41A   => array(0x43A),
-        0x41B   => array(0x43B),
-        0x41C   => array(0x43C),
-        0x41D   => array(0x43D),
-        0x41E   => array(0x43E),
-        0x41F   => array(0x43F),
-        0x420   => array(0x440),
-        0x421   => array(0x441),
-        0x422   => array(0x442),
-        0x423   => array(0x443),
-        0x424   => array(0x444),
-        0x425   => array(0x445),
-        0x426   => array(0x446),
-        0x427   => array(0x447),
-        0x428   => array(0x448),
-        0x429   => array(0x449),
-        0x42A   => array(0x44A),
-        0x42B   => array(0x44B),
-        0x42C   => array(0x44C),
-        0x42D   => array(0x44D),
-        0x42E   => array(0x44E),
-        0x42F   => array(0x44F),
-        0x460   => array(0x461),
-        0x462   => array(0x463),
-        0x464   => array(0x465),
-        0x466   => array(0x467),
-        0x468   => array(0x469),
-        0x46A   => array(0x46B),
-        0x46C   => array(0x46D),
-        0x46E   => array(0x46F),
-        0x470   => array(0x471),
-        0x472   => array(0x473),
-        0x474   => array(0x475),
-        0x476   => array(0x477),
-        0x478   => array(0x479),
-        0x47A   => array(0x47B),
-        0x47C   => array(0x47D),
-        0x47E   => array(0x47F),
-        0x480   => array(0x481),
-        0x48A   => array(0x48B),
-        0x48C   => array(0x48D),
-        0x48E   => array(0x48F),
-        0x490   => array(0x491),
-        0x492   => array(0x493),
-        0x494   => array(0x495),
-        0x496   => array(0x497),
-        0x498   => array(0x499),
-        0x49A   => array(0x49B),
-        0x49C   => array(0x49D),
-        0x49E   => array(0x49F),
-        0x4A0   => array(0x4A1),
-        0x4A2   => array(0x4A3),
-        0x4A4   => array(0x4A5),
-        0x4A6   => array(0x4A7),
-        0x4A8   => array(0x4A9),
-        0x4AA   => array(0x4AB),
-        0x4AC   => array(0x4AD),
-        0x4AE   => array(0x4AF),
-        0x4B0   => array(0x4B1),
-        0x4B2   => array(0x4B3),
-        0x4B4   => array(0x4B5),
-        0x4B6   => array(0x4B7),
-        0x4B8   => array(0x4B9),
-        0x4BA   => array(0x4BB),
-        0x4BC   => array(0x4BD),
-        0x4BE   => array(0x4BF),
-        0x4C1   => array(0x4C2),
-        0x4C3   => array(0x4C4),
-        0x4C5   => array(0x4C6),
-        0x4C7   => array(0x4C8),
-        0x4C9   => array(0x4CA),
-        0x4CB   => array(0x4CC),
-        0x4CD   => array(0x4CE),
-        0x4D0   => array(0x4D1),
-        0x4D2   => array(0x4D3),
-        0x4D4   => array(0x4D5),
-        0x4D6   => array(0x4D7),
-        0x4D8   => array(0x4D9),
-        0x4DA   => array(0x4DB),
-        0x4DC   => array(0x4DD),
-        0x4DE   => array(0x4DF),
-        0x4E0   => array(0x4E1),
-        0x4E2   => array(0x4E3),
-        0x4E4   => array(0x4E5),
-        0x4E6   => array(0x4E7),
-        0x4E8   => array(0x4E9),
-        0x4EA   => array(0x4EB),
-        0x4EC   => array(0x4ED),
-        0x4EE   => array(0x4EF),
-        0x4F0   => array(0x4F1),
-        0x4F2   => array(0x4F3),
-        0x4F4   => array(0x4F5),
-        0x4F8   => array(0x4F9),
-        0x500   => array(0x501),
-        0x502   => array(0x503),
-        0x504   => array(0x505),
-        0x506   => array(0x507),
-        0x508   => array(0x509),
-        0x50A   => array(0x50B),
-        0x50C   => array(0x50D),
-        0x50E   => array(0x50F),
-        0x531   => array(0x561),
-        0x532   => array(0x562),
-        0x533   => array(0x563),
-        0x534   => array(0x564),
-        0x535   => array(0x565),
-        0x536   => array(0x566),
-        0x537   => array(0x567),
-        0x538   => array(0x568),
-        0x539   => array(0x569),
-        0x53A   => array(0x56A),
-        0x53B   => array(0x56B),
-        0x53C   => array(0x56C),
-        0x53D   => array(0x56D),
-        0x53E   => array(0x56E),
-        0x53F   => array(0x56F),
-        0x540   => array(0x570),
-        0x541   => array(0x571),
-        0x542   => array(0x572),
-        0x543   => array(0x573),
-        0x544   => array(0x574),
-        0x545   => array(0x575),
-        0x546   => array(0x576),
-        0x547   => array(0x577),
-        0x548   => array(0x578),
-        0x549   => array(0x579),
-        0x54A   => array(0x57A),
-        0x54B   => array(0x57B),
-        0x54C   => array(0x57C),
-        0x54D   => array(0x57D),
-        0x54E   => array(0x57E),
-        0x54F   => array(0x57F),
-        0x550   => array(0x580),
-        0x551   => array(0x581),
-        0x552   => array(0x582),
-        0x553   => array(0x583),
-        0x554   => array(0x584),
-        0x555   => array(0x585),
-        0x556   => array(0x586),
-        0x587   => array(0x565, 0x582),
-        0x1E00  => array(0x1E01),
-        0x1E02  => array(0x1E03),
-        0x1E04  => array(0x1E05),
-        0x1E06  => array(0x1E07),
-        0x1E08  => array(0x1E09),
-        0x1E0A  => array(0x1E0B),
-        0x1E0C  => array(0x1E0D),
-        0x1E0E  => array(0x1E0F),
-        0x1E10  => array(0x1E11),
-        0x1E12  => array(0x1E13),
-        0x1E14  => array(0x1E15),
-        0x1E16  => array(0x1E17),
-        0x1E18  => array(0x1E19),
-        0x1E1A  => array(0x1E1B),
-        0x1E1C  => array(0x1E1D),
-        0x1E1E  => array(0x1E1F),
-        0x1E20  => array(0x1E21),
-        0x1E22  => array(0x1E23),
-        0x1E24  => array(0x1E25),
-        0x1E26  => array(0x1E27),
-        0x1E28  => array(0x1E29),
-        0x1E2A  => array(0x1E2B),
-        0x1E2C  => array(0x1E2D),
-        0x1E2E  => array(0x1E2F),
-        0x1E30  => array(0x1E31),
-        0x1E32  => array(0x1E33),
-        0x1E34  => array(0x1E35),
-        0x1E36  => array(0x1E37),
-        0x1E38  => array(0x1E39),
-        0x1E3A  => array(0x1E3B),
-        0x1E3C  => array(0x1E3D),
-        0x1E3E  => array(0x1E3F),
-        0x1E40  => array(0x1E41),
-        0x1E42  => array(0x1E43),
-        0x1E44  => array(0x1E45),
-        0x1E46  => array(0x1E47),
-        0x1E48  => array(0x1E49),
-        0x1E4A  => array(0x1E4B),
-        0x1E4C  => array(0x1E4D),
-        0x1E4E  => array(0x1E4F),
-        0x1E50  => array(0x1E51),
-        0x1E52  => array(0x1E53),
-        0x1E54  => array(0x1E55),
-        0x1E56  => array(0x1E57),
-        0x1E58  => array(0x1E59),
-        0x1E5A  => array(0x1E5B),
-        0x1E5C  => array(0x1E5D),
-        0x1E5E  => array(0x1E5F),
-        0x1E60  => array(0x1E61),
-        0x1E62  => array(0x1E63),
-        0x1E64  => array(0x1E65),
-        0x1E66  => array(0x1E67),
-        0x1E68  => array(0x1E69),
-        0x1E6A  => array(0x1E6B),
-        0x1E6C  => array(0x1E6D),
-        0x1E6E  => array(0x1E6F),
-        0x1E70  => array(0x1E71),
-        0x1E72  => array(0x1E73),
-        0x1E74  => array(0x1E75),
-        0x1E76  => array(0x1E77),
-        0x1E78  => array(0x1E79),
-        0x1E7A  => array(0x1E7B),
-        0x1E7C  => array(0x1E7D),
-        0x1E7E  => array(0x1E7F),
-        0x1E80  => array(0x1E81),
-        0x1E82  => array(0x1E83),
-        0x1E84  => array(0x1E85),
-        0x1E86  => array(0x1E87),
-        0x1E88  => array(0x1E89),
-        0x1E8A  => array(0x1E8B),
-        0x1E8C  => array(0x1E8D),
-        0x1E8E  => array(0x1E8F),
-        0x1E90  => array(0x1E91),
-        0x1E92  => array(0x1E93),
-        0x1E94  => array(0x1E95),
-        0x1E96  => array(0x68, 0x331),
-        0x1E97  => array(0x74, 0x308),
-        0x1E98  => array(0x77, 0x30A),
-        0x1E99  => array(0x79, 0x30A),
-        0x1E9A  => array(0x61, 0x2BE),
-        0x1E9B  => array(0x1E61),
-        0x1EA0  => array(0x1EA1),
-        0x1EA2  => array(0x1EA3),
-        0x1EA4  => array(0x1EA5),
-        0x1EA6  => array(0x1EA7),
-        0x1EA8  => array(0x1EA9),
-        0x1EAA  => array(0x1EAB),
-        0x1EAC  => array(0x1EAD),
-        0x1EAE  => array(0x1EAF),
-        0x1EB0  => array(0x1EB1),
-        0x1EB2  => array(0x1EB3),
-        0x1EB4  => array(0x1EB5),
-        0x1EB6  => array(0x1EB7),
-        0x1EB8  => array(0x1EB9),
-        0x1EBA  => array(0x1EBB),
-        0x1EBC  => array(0x1EBD),
-        0x1EBE  => array(0x1EBF),
-        0x1EC0  => array(0x1EC1),
-        0x1EC2  => array(0x1EC3),
-        0x1EC4  => array(0x1EC5),
-        0x1EC6  => array(0x1EC7),
-        0x1EC8  => array(0x1EC9),
-        0x1ECA  => array(0x1ECB),
-        0x1ECC  => array(0x1ECD),
-        0x1ECE  => array(0x1ECF),
-        0x1ED0  => array(0x1ED1),
-        0x1ED2  => array(0x1ED3),
-        0x1ED4  => array(0x1ED5),
-        0x1ED6  => array(0x1ED7),
-        0x1ED8  => array(0x1ED9),
-        0x1EDA  => array(0x1EDB),
-        0x1EDC  => array(0x1EDD),
-        0x1EDE  => array(0x1EDF),
-        0x1EE0  => array(0x1EE1),
-        0x1EE2  => array(0x1EE3),
-        0x1EE4  => array(0x1EE5),
-        0x1EE6  => array(0x1EE7),
-        0x1EE8  => array(0x1EE9),
-        0x1EEA  => array(0x1EEB),
-        0x1EEC  => array(0x1EED),
-        0x1EEE  => array(0x1EEF),
-        0x1EF0  => array(0x1EF1),
-        0x1EF2  => array(0x1EF3),
-        0x1EF4  => array(0x1EF5),
-        0x1EF6  => array(0x1EF7),
-        0x1EF8  => array(0x1EF9),
-        0x1F08  => array(0x1F00),
-        0x1F09  => array(0x1F01),
-        0x1F0A  => array(0x1F02),
-        0x1F0B  => array(0x1F03),
-        0x1F0C  => array(0x1F04),
-        0x1F0D  => array(0x1F05),
-        0x1F0E  => array(0x1F06),
-        0x1F0F  => array(0x1F07),
-        0x1F18  => array(0x1F10),
-        0x1F19  => array(0x1F11),
-        0x1F1A  => array(0x1F12),
-        0x1F1B  => array(0x1F13),
-        0x1F1C  => array(0x1F14),
-        0x1F1D  => array(0x1F15),
-        0x1F28  => array(0x1F20),
-        0x1F29  => array(0x1F21),
-        0x1F2A  => array(0x1F22),
-        0x1F2B  => array(0x1F23),
-        0x1F2C  => array(0x1F24),
-        0x1F2D  => array(0x1F25),
-        0x1F2E  => array(0x1F26),
-        0x1F2F  => array(0x1F27),
-        0x1F38  => array(0x1F30),
-        0x1F39  => array(0x1F31),
-        0x1F3A  => array(0x1F32),
-        0x1F3B  => array(0x1F33),
-        0x1F3C  => array(0x1F34),
-        0x1F3D  => array(0x1F35),
-        0x1F3E  => array(0x1F36),
-        0x1F3F  => array(0x1F37),
-        0x1F48  => array(0x1F40),
-        0x1F49  => array(0x1F41),
-        0x1F4A  => array(0x1F42),
-        0x1F4B  => array(0x1F43),
-        0x1F4C  => array(0x1F44),
-        0x1F4D  => array(0x1F45),
-        0x1F50  => array(0x3C5, 0x313),
-        0x1F52  => array(0x3C5, 0x313, 0x300),
-        0x1F54  => array(0x3C5, 0x313, 0x301),
-        0x1F56  => array(0x3C5, 0x313, 0x342),
-        0x1F59  => array(0x1F51),
-        0x1F5B  => array(0x1F53),
-        0x1F5D  => array(0x1F55),
-        0x1F5F  => array(0x1F57),
-        0x1F68  => array(0x1F60),
-        0x1F69  => array(0x1F61),
-        0x1F6A  => array(0x1F62),
-        0x1F6B  => array(0x1F63),
-        0x1F6C  => array(0x1F64),
-        0x1F6D  => array(0x1F65),
-        0x1F6E  => array(0x1F66),
-        0x1F6F  => array(0x1F67),
-        0x1F80  => array(0x1F00, 0x3B9),
-        0x1F81  => array(0x1F01, 0x3B9),
-        0x1F82  => array(0x1F02, 0x3B9),
-        0x1F83  => array(0x1F03, 0x3B9),
-        0x1F84  => array(0x1F04, 0x3B9),
-        0x1F85  => array(0x1F05, 0x3B9),
-        0x1F86  => array(0x1F06, 0x3B9),
-        0x1F87  => array(0x1F07, 0x3B9),
-        0x1F88  => array(0x1F00, 0x3B9),
-        0x1F89  => array(0x1F01, 0x3B9),
-        0x1F8A  => array(0x1F02, 0x3B9),
-        0x1F8B  => array(0x1F03, 0x3B9),
-        0x1F8C  => array(0x1F04, 0x3B9),
-        0x1F8D  => array(0x1F05, 0x3B9),
-        0x1F8E  => array(0x1F06, 0x3B9),
-        0x1F8F  => array(0x1F07, 0x3B9),
-        0x1F90  => array(0x1F20, 0x3B9),
-        0x1F91  => array(0x1F21, 0x3B9),
-        0x1F92  => array(0x1F22, 0x3B9),
-        0x1F93  => array(0x1F23, 0x3B9),
-        0x1F94  => array(0x1F24, 0x3B9),
-        0x1F95  => array(0x1F25, 0x3B9),
-        0x1F96  => array(0x1F26, 0x3B9),
-        0x1F97  => array(0x1F27, 0x3B9),
-        0x1F98  => array(0x1F20, 0x3B9),
-        0x1F99  => array(0x1F21, 0x3B9),
-        0x1F9A  => array(0x1F22, 0x3B9),
-        0x1F9B  => array(0x1F23, 0x3B9),
-        0x1F9C  => array(0x1F24, 0x3B9),
-        0x1F9D  => array(0x1F25, 0x3B9),
-        0x1F9E  => array(0x1F26, 0x3B9),
-        0x1F9F  => array(0x1F27, 0x3B9),
-        0x1FA0  => array(0x1F60, 0x3B9),
-        0x1FA1  => array(0x1F61, 0x3B9),
-        0x1FA2  => array(0x1F62, 0x3B9),
-        0x1FA3  => array(0x1F63, 0x3B9),
-        0x1FA4  => array(0x1F64, 0x3B9),
-        0x1FA5  => array(0x1F65, 0x3B9),
-        0x1FA6  => array(0x1F66, 0x3B9),
-        0x1FA7  => array(0x1F67, 0x3B9),
-        0x1FA8  => array(0x1F60, 0x3B9),
-        0x1FA9  => array(0x1F61, 0x3B9),
-        0x1FAA  => array(0x1F62, 0x3B9),
-        0x1FAB  => array(0x1F63, 0x3B9),
-        0x1FAC  => array(0x1F64, 0x3B9),
-        0x1FAD  => array(0x1F65, 0x3B9),
-        0x1FAE  => array(0x1F66, 0x3B9),
-        0x1FAF  => array(0x1F67, 0x3B9),
-        0x1FB2  => array(0x1F70, 0x3B9),
-        0x1FB3  => array(0x3B1, 0x3B9),
-        0x1FB4  => array(0x3AC, 0x3B9),
-        0x1FB6  => array(0x3B1, 0x342),
-        0x1FB7  => array(0x3B1, 0x342, 0x3B9),
-        0x1FB8  => array(0x1FB0),
-        0x1FB9  => array(0x1FB1),
-        0x1FBA  => array(0x1F70),
-        0x1FBB  => array(0x1F71),
-        0x1FBC  => array(0x3B1, 0x3B9),
-        0x1FBE  => array(0x3B9),
-        0x1FC2  => array(0x1F74, 0x3B9),
-        0x1FC3  => array(0x3B7, 0x3B9),
-        0x1FC4  => array(0x3AE, 0x3B9),
-        0x1FC6  => array(0x3B7, 0x342),
-        0x1FC7  => array(0x3B7, 0x342, 0x3B9),
-        0x1FC8  => array(0x1F72),
-        0x1FC9  => array(0x1F73),
-        0x1FCA  => array(0x1F74),
-        0x1FCB  => array(0x1F75),
-        0x1FCC  => array(0x3B7, 0x3B9),
-        0x1FD2  => array(0x3B9, 0x308, 0x300),
-        0x1FD3  => array(0x3B9, 0x308, 0x301),
-        0x1FD6  => array(0x3B9, 0x342),
-        0x1FD7  => array(0x3B9, 0x308, 0x342),
-        0x1FD8  => array(0x1FD0),
-        0x1FD9  => array(0x1FD1),
-        0x1FDA  => array(0x1F76),
-        0x1FDB  => array(0x1F77),
-        0x1FE2  => array(0x3C5, 0x308, 0x300),
-        0x1FE3  => array(0x3C5, 0x308, 0x301),
-        0x1FE4  => array(0x3C1, 0x313),
-        0x1FE6  => array(0x3C5, 0x342),
-        0x1FE7  => array(0x3C5, 0x308, 0x342),
-        0x1FE8  => array(0x1FE0),
-        0x1FE9  => array(0x1FE1),
-        0x1FEA  => array(0x1F7A),
-        0x1FEB  => array(0x1F7B),
-        0x1FEC  => array(0x1FE5),
-        0x1FF2  => array(0x1F7C, 0x3B9),
-        0x1FF3  => array(0x3C9, 0x3B9),
-        0x1FF4  => array(0x3CE, 0x3B9),
-        0x1FF6  => array(0x3C9, 0x342),
-        0x1FF7  => array(0x3C9, 0x342, 0x3B9),
-        0x1FF8  => array(0x1F78),
-        0x1FF9  => array(0x1F79),
-        0x1FFA  => array(0x1F7C),
-        0x1FFB  => array(0x1F7D),
-        0x1FFC  => array(0x3C9, 0x3B9),
-        0x20A8  => array(0x72, 0x73),
-        0x2102  => array(0x63),
-        0x2103  => array(0xB0, 0x63),
-        0x2107  => array(0x25B),
-        0x2109  => array(0xB0, 0x66),
-        0x210B  => array(0x68),
-        0x210C  => array(0x68),
-        0x210D  => array(0x68),
-        0x2110  => array(0x69),
-        0x2111  => array(0x69),
-        0x2112  => array(0x6C),
-        0x2115  => array(0x6E),
-        0x2116  => array(0x6E, 0x6F),
-        0x2119  => array(0x70),
-        0x211A  => array(0x71),
-        0x211B  => array(0x72),
-        0x211C  => array(0x72),
-        0x211D  => array(0x72),
-        0x2120  => array(0x73, 0x6D),
-        0x2121  => array(0x74, 0x65, 0x6C),
-        0x2122  => array(0x74, 0x6D),
-        0x2124  => array(0x7A),
-        0x2126  => array(0x3C9),
-        0x2128  => array(0x7A),
-        0x212A  => array(0x6B),
-        0x212B  => array(0xE5),
-        0x212C  => array(0x62),
-        0x212D  => array(0x63),
-        0x2130  => array(0x65),
-        0x2131  => array(0x66),
-        0x2133  => array(0x6D),
-        0x213E  => array(0x3B3),
-        0x213F  => array(0x3C0),
-        0x2145  => array(0x64),
-        0x2160  => array(0x2170),
-        0x2161  => array(0x2171),
-        0x2162  => array(0x2172),
-        0x2163  => array(0x2173),
-        0x2164  => array(0x2174),
-        0x2165  => array(0x2175),
-        0x2166  => array(0x2176),
-        0x2167  => array(0x2177),
-        0x2168  => array(0x2178),
-        0x2169  => array(0x2179),
-        0x216A  => array(0x217A),
-        0x216B  => array(0x217B),
-        0x216C  => array(0x217C),
-        0x216D  => array(0x217D),
-        0x216E  => array(0x217E),
-        0x216F  => array(0x217F),
-        0x24B6  => array(0x24D0),
-        0x24B7  => array(0x24D1),
-        0x24B8  => array(0x24D2),
-        0x24B9  => array(0x24D3),
-        0x24BA  => array(0x24D4),
-        0x24BB  => array(0x24D5),
-        0x24BC  => array(0x24D6),
-        0x24BD  => array(0x24D7),
-        0x24BE  => array(0x24D8),
-        0x24BF  => array(0x24D9),
-        0x24C0  => array(0x24DA),
-        0x24C1  => array(0x24DB),
-        0x24C2  => array(0x24DC),
-        0x24C3  => array(0x24DD),
-        0x24C4  => array(0x24DE),
-        0x24C5  => array(0x24DF),
-        0x24C6  => array(0x24E0),
-        0x24C7  => array(0x24E1),
-        0x24C8  => array(0x24E2),
-        0x24C9  => array(0x24E3),
-        0x24CA  => array(0x24E4),
-        0x24CB  => array(0x24E5),
-        0x24CC  => array(0x24E6),
-        0x24CD  => array(0x24E7),
-        0x24CE  => array(0x24E8),
-        0x24CF  => array(0x24E9),
-        0x3371  => array(0x68, 0x70, 0x61),
-        0x3373  => array(0x61, 0x75),
-        0x3375  => array(0x6F, 0x76),
-        0x3380  => array(0x70, 0x61),
-        0x3381  => array(0x6E, 0x61),
-        0x3382  => array(0x3BC, 0x61),
-        0x3383  => array(0x6D, 0x61),
-        0x3384  => array(0x6B, 0x61),
-        0x3385  => array(0x6B, 0x62),
-        0x3386  => array(0x6D, 0x62),
-        0x3387  => array(0x67, 0x62),
-        0x338A  => array(0x70, 0x66),
-        0x338B  => array(0x6E, 0x66),
-        0x338C  => array(0x3BC, 0x66),
-        0x3390  => array(0x68, 0x7A),
-        0x3391  => array(0x6B, 0x68, 0x7A),
-        0x3392  => array(0x6D, 0x68, 0x7A),
-        0x3393  => array(0x67, 0x68, 0x7A),
-        0x3394  => array(0x74, 0x68, 0x7A),
-        0x33A9  => array(0x70, 0x61),
-        0x33AA  => array(0x6B, 0x70, 0x61),
-        0x33AB  => array(0x6D, 0x70, 0x61),
-        0x33AC  => array(0x67, 0x70, 0x61),
-        0x33B4  => array(0x70, 0x76),
-        0x33B5  => array(0x6E, 0x76),
-        0x33B6  => array(0x3BC, 0x76),
-        0x33B7  => array(0x6D, 0x76),
-        0x33B8  => array(0x6B, 0x76),
-        0x33B9  => array(0x6D, 0x76),
-        0x33BA  => array(0x70, 0x77),
-        0x33BB  => array(0x6E, 0x77),
-        0x33BC  => array(0x3BC, 0x77),
-        0x33BD  => array(0x6D, 0x77),
-        0x33BE  => array(0x6B, 0x77),
-        0x33BF  => array(0x6D, 0x77),
-        0x33C0  => array(0x6B, 0x3C9),
-        0x33C1  => array(0x6D, 0x3C9), /*
-        0x33C2  => array(0x61, 0x2E, 0x6D, 0x2E), */
-        0x33C3  => array(0x62, 0x71),
-        0x33C6  => array(0x63, 0x2215, 0x6B, 0x67),
-        0x33C7  => array(0x63, 0x6F, 0x2E),
-        0x33C8  => array(0x64, 0x62),
-        0x33C9  => array(0x67, 0x79),
-        0x33CB  => array(0x68, 0x70),
-        0x33CD  => array(0x6B, 0x6B),
-        0x33CE  => array(0x6B, 0x6D),
-        0x33D7  => array(0x70, 0x68),
-        0x33D9  => array(0x70, 0x70, 0x6D),
-        0x33DA  => array(0x70, 0x72),
-        0x33DC  => array(0x73, 0x76),
-        0x33DD  => array(0x77, 0x62),
-        0xFB00  => array(0x66, 0x66),
-        0xFB01  => array(0x66, 0x69),
-        0xFB02  => array(0x66, 0x6C),
-        0xFB03  => array(0x66, 0x66, 0x69),
-        0xFB04  => array(0x66, 0x66, 0x6C),
-        0xFB05  => array(0x73, 0x74),
-        0xFB06  => array(0x73, 0x74),
-        0xFB13  => array(0x574, 0x576),
-        0xFB14  => array(0x574, 0x565),
-        0xFB15  => array(0x574, 0x56B),
-        0xFB16  => array(0x57E, 0x576),
-        0xFB17  => array(0x574, 0x56D),
-        0xFF21  => array(0xFF41),
-        0xFF22  => array(0xFF42),
-        0xFF23  => array(0xFF43),
-        0xFF24  => array(0xFF44),
-        0xFF25  => array(0xFF45),
-        0xFF26  => array(0xFF46),
-        0xFF27  => array(0xFF47),
-        0xFF28  => array(0xFF48),
-        0xFF29  => array(0xFF49),
-        0xFF2A  => array(0xFF4A),
-        0xFF2B  => array(0xFF4B),
-        0xFF2C  => array(0xFF4C),
-        0xFF2D  => array(0xFF4D),
-        0xFF2E  => array(0xFF4E),
-        0xFF2F  => array(0xFF4F),
-        0xFF30  => array(0xFF50),
-        0xFF31  => array(0xFF51),
-        0xFF32  => array(0xFF52),
-        0xFF33  => array(0xFF53),
-        0xFF34  => array(0xFF54),
-        0xFF35  => array(0xFF55),
-        0xFF36  => array(0xFF56),
-        0xFF37  => array(0xFF57),
-        0xFF38  => array(0xFF58),
-        0xFF39  => array(0xFF59),
-        0xFF3A  => array(0xFF5A),
-        0x10400 => array(0x10428),
-        0x10401 => array(0x10429),
-        0x10402 => array(0x1042A),
-        0x10403 => array(0x1042B),
-        0x10404 => array(0x1042C),
-        0x10405 => array(0x1042D),
-        0x10406 => array(0x1042E),
-        0x10407 => array(0x1042F),
-        0x10408 => array(0x10430),
-        0x10409 => array(0x10431),
-        0x1040A => array(0x10432),
-        0x1040B => array(0x10433),
-        0x1040C => array(0x10434),
-        0x1040D => array(0x10435),
-        0x1040E => array(0x10436),
-        0x1040F => array(0x10437),
-        0x10410 => array(0x10438),
-        0x10411 => array(0x10439),
-        0x10412 => array(0x1043A),
-        0x10413 => array(0x1043B),
-        0x10414 => array(0x1043C),
-        0x10415 => array(0x1043D),
-        0x10416 => array(0x1043E),
-        0x10417 => array(0x1043F),
-        0x10418 => array(0x10440),
-        0x10419 => array(0x10441),
-        0x1041A => array(0x10442),
-        0x1041B => array(0x10443),
-        0x1041C => array(0x10444),
-        0x1041D => array(0x10445),
-        0x1041E => array(0x10446),
-        0x1041F => array(0x10447),
-        0x10420 => array(0x10448),
-        0x10421 => array(0x10449),
-        0x10422 => array(0x1044A),
-        0x10423 => array(0x1044B),
-        0x10424 => array(0x1044C),
-        0x10425 => array(0x1044D),
-        0x1D400 => array(0x61),
-        0x1D401 => array(0x62),
-        0x1D402 => array(0x63),
-        0x1D403 => array(0x64),
-        0x1D404 => array(0x65),
-        0x1D405 => array(0x66),
-        0x1D406 => array(0x67),
-        0x1D407 => array(0x68),
-        0x1D408 => array(0x69),
-        0x1D409 => array(0x6A),
-        0x1D40A => array(0x6B),
-        0x1D40B => array(0x6C),
-        0x1D40C => array(0x6D),
-        0x1D40D => array(0x6E),
-        0x1D40E => array(0x6F),
-        0x1D40F => array(0x70),
-        0x1D410 => array(0x71),
-        0x1D411 => array(0x72),
-        0x1D412 => array(0x73),
-        0x1D413 => array(0x74),
-        0x1D414 => array(0x75),
-        0x1D415 => array(0x76),
-        0x1D416 => array(0x77),
-        0x1D417 => array(0x78),
-        0x1D418 => array(0x79),
-        0x1D419 => array(0x7A),
-        0x1D434 => array(0x61),
-        0x1D435 => array(0x62),
-        0x1D436 => array(0x63),
-        0x1D437 => array(0x64),
-        0x1D438 => array(0x65),
-        0x1D439 => array(0x66),
-        0x1D43A => array(0x67),
-        0x1D43B => array(0x68),
-        0x1D43C => array(0x69),
-        0x1D43D => array(0x6A),
-        0x1D43E => array(0x6B),
-        0x1D43F => array(0x6C),
-        0x1D440 => array(0x6D),
-        0x1D441 => array(0x6E),
-        0x1D442 => array(0x6F),
-        0x1D443 => array(0x70),
-        0x1D444 => array(0x71),
-        0x1D445 => array(0x72),
-        0x1D446 => array(0x73),
-        0x1D447 => array(0x74),
-        0x1D448 => array(0x75),
-        0x1D449 => array(0x76),
-        0x1D44A => array(0x77),
-        0x1D44B => array(0x78),
-        0x1D44C => array(0x79),
-        0x1D44D => array(0x7A),
-        0x1D468 => array(0x61),
-        0x1D469 => array(0x62),
-        0x1D46A => array(0x63),
-        0x1D46B => array(0x64),
-        0x1D46C => array(0x65),
-        0x1D46D => array(0x66),
-        0x1D46E => array(0x67),
-        0x1D46F => array(0x68),
-        0x1D470 => array(0x69),
-        0x1D471 => array(0x6A),
-        0x1D472 => array(0x6B),
-        0x1D473 => array(0x6C),
-        0x1D474 => array(0x6D),
-        0x1D475 => array(0x6E),
-        0x1D476 => array(0x6F),
-        0x1D477 => array(0x70),
-        0x1D478 => array(0x71),
-        0x1D479 => array(0x72),
-        0x1D47A => array(0x73),
-        0x1D47B => array(0x74),
-        0x1D47C => array(0x75),
-        0x1D47D => array(0x76),
-        0x1D47E => array(0x77),
-        0x1D47F => array(0x78),
-        0x1D480 => array(0x79),
-        0x1D481 => array(0x7A),
-        0x1D49C => array(0x61),
-        0x1D49E => array(0x63),
-        0x1D49F => array(0x64),
-        0x1D4A2 => array(0x67),
-        0x1D4A5 => array(0x6A),
-        0x1D4A6 => array(0x6B),
-        0x1D4A9 => array(0x6E),
-        0x1D4AA => array(0x6F),
-        0x1D4AB => array(0x70),
-        0x1D4AC => array(0x71),
-        0x1D4AE => array(0x73),
-        0x1D4AF => array(0x74),
-        0x1D4B0 => array(0x75),
-        0x1D4B1 => array(0x76),
-        0x1D4B2 => array(0x77),
-        0x1D4B3 => array(0x78),
-        0x1D4B4 => array(0x79),
-        0x1D4B5 => array(0x7A),
-        0x1D4D0 => array(0x61),
-        0x1D4D1 => array(0x62),
-        0x1D4D2 => array(0x63),
-        0x1D4D3 => array(0x64),
-        0x1D4D4 => array(0x65),
-        0x1D4D5 => array(0x66),
-        0x1D4D6 => array(0x67),
-        0x1D4D7 => array(0x68),
-        0x1D4D8 => array(0x69),
-        0x1D4D9 => array(0x6A),
-        0x1D4DA => array(0x6B),
-        0x1D4DB => array(0x6C),
-        0x1D4DC => array(0x6D),
-        0x1D4DD => array(0x6E),
-        0x1D4DE => array(0x6F),
-        0x1D4DF => array(0x70),
-        0x1D4E0 => array(0x71),
-        0x1D4E1 => array(0x72),
-        0x1D4E2 => array(0x73),
-        0x1D4E3 => array(0x74),
-        0x1D4E4 => array(0x75),
-        0x1D4E5 => array(0x76),
-        0x1D4E6 => array(0x77),
-        0x1D4E7 => array(0x78),
-        0x1D4E8 => array(0x79),
-        0x1D4E9 => array(0x7A),
-        0x1D504 => array(0x61),
-        0x1D505 => array(0x62),
-        0x1D507 => array(0x64),
-        0x1D508 => array(0x65),
-        0x1D509 => array(0x66),
-        0x1D50A => array(0x67),
-        0x1D50D => array(0x6A),
-        0x1D50E => array(0x6B),
-        0x1D50F => array(0x6C),
-        0x1D510 => array(0x6D),
-        0x1D511 => array(0x6E),
-        0x1D512 => array(0x6F),
-        0x1D513 => array(0x70),
-        0x1D514 => array(0x71),
-        0x1D516 => array(0x73),
-        0x1D517 => array(0x74),
-        0x1D518 => array(0x75),
-        0x1D519 => array(0x76),
-        0x1D51A => array(0x77),
-        0x1D51B => array(0x78),
-        0x1D51C => array(0x79),
-        0x1D538 => array(0x61),
-        0x1D539 => array(0x62),
-        0x1D53B => array(0x64),
-        0x1D53C => array(0x65),
-        0x1D53D => array(0x66),
-        0x1D53E => array(0x67),
-        0x1D540 => array(0x69),
-        0x1D541 => array(0x6A),
-        0x1D542 => array(0x6B),
-        0x1D543 => array(0x6C),
-        0x1D544 => array(0x6D),
-        0x1D546 => array(0x6F),
-        0x1D54A => array(0x73),
-        0x1D54B => array(0x74),
-        0x1D54C => array(0x75),
-        0x1D54D => array(0x76),
-        0x1D54E => array(0x77),
-        0x1D54F => array(0x78),
-        0x1D550 => array(0x79),
-        0x1D56C => array(0x61),
-        0x1D56D => array(0x62),
-        0x1D56E => array(0x63),
-        0x1D56F => array(0x64),
-        0x1D570 => array(0x65),
-        0x1D571 => array(0x66),
-        0x1D572 => array(0x67),
-        0x1D573 => array(0x68),
-        0x1D574 => array(0x69),
-        0x1D575 => array(0x6A),
-        0x1D576 => array(0x6B),
-        0x1D577 => array(0x6C),
-        0x1D578 => array(0x6D),
-        0x1D579 => array(0x6E),
-        0x1D57A => array(0x6F),
-        0x1D57B => array(0x70),
-        0x1D57C => array(0x71),
-        0x1D57D => array(0x72),
-        0x1D57E => array(0x73),
-        0x1D57F => array(0x74),
-        0x1D580 => array(0x75),
-        0x1D581 => array(0x76),
-        0x1D582 => array(0x77),
-        0x1D583 => array(0x78),
-        0x1D584 => array(0x79),
-        0x1D585 => array(0x7A),
-        0x1D5A0 => array(0x61),
-        0x1D5A1 => array(0x62),
-        0x1D5A2 => array(0x63),
-        0x1D5A3 => array(0x64),
-        0x1D5A4 => array(0x65),
-        0x1D5A5 => array(0x66),
-        0x1D5A6 => array(0x67),
-        0x1D5A7 => array(0x68),
-        0x1D5A8 => array(0x69),
-        0x1D5A9 => array(0x6A),
-        0x1D5AA => array(0x6B),
-        0x1D5AB => array(0x6C),
-        0x1D5AC => array(0x6D),
-        0x1D5AD => array(0x6E),
-        0x1D5AE => array(0x6F),
-        0x1D5AF => array(0x70),
-        0x1D5B0 => array(0x71),
-        0x1D5B1 => array(0x72),
-        0x1D5B2 => array(0x73),
-        0x1D5B3 => array(0x74),
-        0x1D5B4 => array(0x75),
-        0x1D5B5 => array(0x76),
-        0x1D5B6 => array(0x77),
-        0x1D5B7 => array(0x78),
-        0x1D5B8 => array(0x79),
-        0x1D5B9 => array(0x7A),
-        0x1D5D4 => array(0x61),
-        0x1D5D5 => array(0x62),
-        0x1D5D6 => array(0x63),
-        0x1D5D7 => array(0x64),
-        0x1D5D8 => array(0x65),
-        0x1D5D9 => array(0x66),
-        0x1D5DA => array(0x67),
-        0x1D5DB => array(0x68),
-        0x1D5DC => array(0x69),
-        0x1D5DD => array(0x6A),
-        0x1D5DE => array(0x6B),
-        0x1D5DF => array(0x6C),
-        0x1D5E0 => array(0x6D),
-        0x1D5E1 => array(0x6E),
-        0x1D5E2 => array(0x6F),
-        0x1D5E3 => array(0x70),
-        0x1D5E4 => array(0x71),
-        0x1D5E5 => array(0x72),
-        0x1D5E6 => array(0x73),
-        0x1D5E7 => array(0x74),
-        0x1D5E8 => array(0x75),
-        0x1D5E9 => array(0x76),
-        0x1D5EA => array(0x77),
-        0x1D5EB => array(0x78),
-        0x1D5EC => array(0x79),
-        0x1D5ED => array(0x7A),
-        0x1D608 => array(0x61),
-        0x1D609 => array(0x62),
-        0x1D60A => array(0x63),
-        0x1D60B => array(0x64),
-        0x1D60C => array(0x65),
-        0x1D60D => array(0x66),
-        0x1D60E => array(0x67),
-        0x1D60F => array(0x68),
-        0x1D610 => array(0x69),
-        0x1D611 => array(0x6A),
-        0x1D612 => array(0x6B),
-        0x1D613 => array(0x6C),
-        0x1D614 => array(0x6D),
-        0x1D615 => array(0x6E),
-        0x1D616 => array(0x6F),
-        0x1D617 => array(0x70),
-        0x1D618 => array(0x71),
-        0x1D619 => array(0x72),
-        0x1D61A => array(0x73),
-        0x1D61B => array(0x74),
-        0x1D61C => array(0x75),
-        0x1D61D => array(0x76),
-        0x1D61E => array(0x77),
-        0x1D61F => array(0x78),
-        0x1D620 => array(0x79),
-        0x1D621 => array(0x7A),
-        0x1D63C => array(0x61),
-        0x1D63D => array(0x62),
-        0x1D63E => array(0x63),
-        0x1D63F => array(0x64),
-        0x1D640 => array(0x65),
-        0x1D641 => array(0x66),
-        0x1D642 => array(0x67),
-        0x1D643 => array(0x68),
-        0x1D644 => array(0x69),
-        0x1D645 => array(0x6A),
-        0x1D646 => array(0x6B),
-        0x1D647 => array(0x6C),
-        0x1D648 => array(0x6D),
-        0x1D649 => array(0x6E),
-        0x1D64A => array(0x6F),
-        0x1D64B => array(0x70),
-        0x1D64C => array(0x71),
-        0x1D64D => array(0x72),
-        0x1D64E => array(0x73),
-        0x1D64F => array(0x74),
-        0x1D650 => array(0x75),
-        0x1D651 => array(0x76),
-        0x1D652 => array(0x77),
-        0x1D653 => array(0x78),
-        0x1D654 => array(0x79),
-        0x1D655 => array(0x7A),
-        0x1D670 => array(0x61),
-        0x1D671 => array(0x62),
-        0x1D672 => array(0x63),
-        0x1D673 => array(0x64),
-        0x1D674 => array(0x65),
-        0x1D675 => array(0x66),
-        0x1D676 => array(0x67),
-        0x1D677 => array(0x68),
-        0x1D678 => array(0x69),
-        0x1D679 => array(0x6A),
-        0x1D67A => array(0x6B),
-        0x1D67B => array(0x6C),
-        0x1D67C => array(0x6D),
-        0x1D67D => array(0x6E),
-        0x1D67E => array(0x6F),
-        0x1D67F => array(0x70),
-        0x1D680 => array(0x71),
-        0x1D681 => array(0x72),
-        0x1D682 => array(0x73),
-        0x1D683 => array(0x74),
-        0x1D684 => array(0x75),
-        0x1D685 => array(0x76),
-        0x1D686 => array(0x77),
-        0x1D687 => array(0x78),
-        0x1D688 => array(0x79),
-        0x1D689 => array(0x7A),
-        0x1D6A8 => array(0x3B1),
-        0x1D6A9 => array(0x3B2),
-        0x1D6AA => array(0x3B3),
-        0x1D6AB => array(0x3B4),
-        0x1D6AC => array(0x3B5),
-        0x1D6AD => array(0x3B6),
-        0x1D6AE => array(0x3B7),
-        0x1D6AF => array(0x3B8),
-        0x1D6B0 => array(0x3B9),
-        0x1D6B1 => array(0x3BA),
-        0x1D6B2 => array(0x3BB),
-        0x1D6B3 => array(0x3BC),
-        0x1D6B4 => array(0x3BD),
-        0x1D6B5 => array(0x3BE),
-        0x1D6B6 => array(0x3BF),
-        0x1D6B7 => array(0x3C0),
-        0x1D6B8 => array(0x3C1),
-        0x1D6B9 => array(0x3B8),
-        0x1D6BA => array(0x3C3),
-        0x1D6BB => array(0x3C4),
-        0x1D6BC => array(0x3C5),
-        0x1D6BD => array(0x3C6),
-        0x1D6BE => array(0x3C7),
-        0x1D6BF => array(0x3C8),
-        0x1D6C0 => array(0x3C9),
-        0x1D6D3 => array(0x3C3),
-        0x1D6E2 => array(0x3B1),
-        0x1D6E3 => array(0x3B2),
-        0x1D6E4 => array(0x3B3),
-        0x1D6E5 => array(0x3B4),
-        0x1D6E6 => array(0x3B5),
-        0x1D6E7 => array(0x3B6),
-        0x1D6E8 => array(0x3B7),
-        0x1D6E9 => array(0x3B8),
-        0x1D6EA => array(0x3B9),
-        0x1D6EB => array(0x3BA),
-        0x1D6EC => array(0x3BB),
-        0x1D6ED => array(0x3BC),
-        0x1D6EE => array(0x3BD),
-        0x1D6EF => array(0x3BE),
-        0x1D6F0 => array(0x3BF),
-        0x1D6F1 => array(0x3C0),
-        0x1D6F2 => array(0x3C1),
-        0x1D6F3 => array(0x3B8),
-        0x1D6F4 => array(0x3C3),
-        0x1D6F5 => array(0x3C4),
-        0x1D6F6 => array(0x3C5),
-        0x1D6F7 => array(0x3C6),
-        0x1D6F8 => array(0x3C7),
-        0x1D6F9 => array(0x3C8),
-        0x1D6FA => array(0x3C9),
-        0x1D70D => array(0x3C3),
-        0x1D71C => array(0x3B1),
-        0x1D71D => array(0x3B2),
-        0x1D71E => array(0x3B3),
-        0x1D71F => array(0x3B4),
-        0x1D720 => array(0x3B5),
-        0x1D721 => array(0x3B6),
-        0x1D722 => array(0x3B7),
-        0x1D723 => array(0x3B8),
-        0x1D724 => array(0x3B9),
-        0x1D725 => array(0x3BA),
-        0x1D726 => array(0x3BB),
-        0x1D727 => array(0x3BC),
-        0x1D728 => array(0x3BD),
-        0x1D729 => array(0x3BE),
-        0x1D72A => array(0x3BF),
-        0x1D72B => array(0x3C0),
-        0x1D72C => array(0x3C1),
-        0x1D72D => array(0x3B8),
-        0x1D72E => array(0x3C3),
-        0x1D72F => array(0x3C4),
-        0x1D730 => array(0x3C5),
-        0x1D731 => array(0x3C6),
-        0x1D732 => array(0x3C7),
-        0x1D733 => array(0x3C8),
-        0x1D734 => array(0x3C9),
-        0x1D747 => array(0x3C3),
-        0x1D756 => array(0x3B1),
-        0x1D757 => array(0x3B2),
-        0x1D758 => array(0x3B3),
-        0x1D759 => array(0x3B4),
-        0x1D75A => array(0x3B5),
-        0x1D75B => array(0x3B6),
-        0x1D75C => array(0x3B7),
-        0x1D75D => array(0x3B8),
-        0x1D75E => array(0x3B9),
-        0x1D75F => array(0x3BA),
-        0x1D760 => array(0x3BB),
-        0x1D761 => array(0x3BC),
-        0x1D762 => array(0x3BD),
-        0x1D763 => array(0x3BE),
-        0x1D764 => array(0x3BF),
-        0x1D765 => array(0x3C0),
-        0x1D766 => array(0x3C1),
-        0x1D767 => array(0x3B8),
-        0x1D768 => array(0x3C3),
-        0x1D769 => array(0x3C4),
-        0x1D76A => array(0x3C5),
-        0x1D76B => array(0x3C6),
-        0x1D76C => array(0x3C7),
-        0x1D76D => array(0x3C8),
-        0x1D76E => array(0x3C9),
-        0x1D781 => array(0x3C3),
-        0x1D790 => array(0x3B1),
-        0x1D791 => array(0x3B2),
-        0x1D792 => array(0x3B3),
-        0x1D793 => array(0x3B4),
-        0x1D794 => array(0x3B5),
-        0x1D795 => array(0x3B6),
-        0x1D796 => array(0x3B7),
-        0x1D797 => array(0x3B8),
-        0x1D798 => array(0x3B9),
-        0x1D799 => array(0x3BA),
-        0x1D79A => array(0x3BB),
-        0x1D79B => array(0x3BC),
-        0x1D79C => array(0x3BD),
-        0x1D79D => array(0x3BE),
-        0x1D79E => array(0x3BF),
-        0x1D79F => array(0x3C0),
-        0x1D7A0 => array(0x3C1),
-        0x1D7A1 => array(0x3B8),
-        0x1D7A2 => array(0x3C3),
-        0x1D7A3 => array(0x3C4),
-        0x1D7A4 => array(0x3C5),
-        0x1D7A5 => array(0x3C6),
-        0x1D7A6 => array(0x3C7),
-        0x1D7A7 => array(0x3C8),
-        0x1D7A8 => array(0x3C9),
-        0x1D7BB => array(0x3C3),
-        0x3F9   => array(0x3C3),
-        0x1D2C  => array(0x61),
-        0x1D2D  => array(0xE6),
-        0x1D2E  => array(0x62),
-        0x1D30  => array(0x64),
-        0x1D31  => array(0x65),
-        0x1D32  => array(0x1DD),
-        0x1D33  => array(0x67),
-        0x1D34  => array(0x68),
-        0x1D35  => array(0x69),
-        0x1D36  => array(0x6A),
-        0x1D37  => array(0x6B),
-        0x1D38  => array(0x6C),
-        0x1D39  => array(0x6D),
-        0x1D3A  => array(0x6E),
-        0x1D3C  => array(0x6F),
-        0x1D3D  => array(0x223),
-        0x1D3E  => array(0x70),
-        0x1D3F  => array(0x72),
-        0x1D40  => array(0x74),
-        0x1D41  => array(0x75),
-        0x1D42  => array(0x77),
-        0x213B  => array(0x66, 0x61, 0x78),
-        0x3250  => array(0x70, 0x74, 0x65),
-        0x32CC  => array(0x68, 0x67),
-        0x32CE  => array(0x65, 0x76),
-        0x32CF  => array(0x6C, 0x74, 0x64),
-        0x337A  => array(0x69, 0x75),
-        0x33DE  => array(0x76, 0x2215, 0x6D),
-        0x33DF  => array(0x61, 0x2215, 0x6D)
-    );
-
-    /**
-     * Normalization Combining Classes; Code Points not listed
-     * got Combining Class 0.
-     *
-     * @static
-     * @var array
-     * @access private
-     */
-    private static $_np_norm_combcls = array(
-        0x334   => 1,
-        0x335   => 1,
-        0x336   => 1,
-        0x337   => 1,
-        0x338   => 1,
-        0x93C   => 7,
-        0x9BC   => 7,
-        0xA3C   => 7,
-        0xABC   => 7,
-        0xB3C   => 7,
-        0xCBC   => 7,
-        0x1037  => 7,
-        0x3099  => 8,
-        0x309A  => 8,
-        0x94D   => 9,
-        0x9CD   => 9,
-        0xA4D   => 9,
-        0xACD   => 9,
-        0xB4D   => 9,
-        0xBCD   => 9,
-        0xC4D   => 9,
-        0xCCD   => 9,
-        0xD4D   => 9,
-        0xDCA   => 9,
-        0xE3A   => 9,
-        0xF84   => 9,
-        0x1039  => 9,
-        0x1714  => 9,
-        0x1734  => 9,
-        0x17D2  => 9,
-        0x5B0   => 10,
-        0x5B1   => 11,
-        0x5B2   => 12,
-        0x5B3   => 13,
-        0x5B4   => 14,
-        0x5B5   => 15,
-        0x5B6   => 16,
-        0x5B7   => 17,
-        0x5B8   => 18,
-        0x5B9   => 19,
-        0x5BB   => 20,
-        0x5Bc   => 21,
-        0x5BD   => 22,
-        0x5BF   => 23,
-        0x5C1   => 24,
-        0x5C2   => 25,
-        0xFB1E  => 26,
-        0x64B   => 27,
-        0x64C   => 28,
-        0x64D   => 29,
-        0x64E   => 30,
-        0x64F   => 31,
-        0x650   => 32,
-        0x651   => 33,
-        0x652   => 34,
-        0x670   => 35,
-        0x711   => 36,
-        0xC55   => 84,
-        0xC56   => 91,
-        0xE38   => 103,
-        0xE39   => 103,
-        0xE48   => 107,
-        0xE49   => 107,
-        0xE4A   => 107,
-        0xE4B   => 107,
-        0xEB8   => 118,
-        0xEB9   => 118,
-        0xEC8   => 122,
-        0xEC9   => 122,
-        0xECA   => 122,
-        0xECB   => 122,
-        0xF71   => 129,
-        0xF72   => 130,
-        0xF7A   => 130,
-        0xF7B   => 130,
-        0xF7C   => 130,
-        0xF7D   => 130,
-        0xF80   => 130,
-        0xF74   => 132,
-        0x321   => 202,
-        0x322   => 202,
-        0x327   => 202,
-        0x328   => 202,
-        0x31B   => 216,
-        0xF39   => 216,
-        0x1D165 => 216,
-        0x1D166 => 216,
-        0x1D16E => 216,
-        0x1D16F => 216,
-        0x1D170 => 216,
-        0x1D171 => 216,
-        0x1D172 => 216,
-        0x302A  => 218,
-        0x316   => 220,
-        0x317   => 220,
-        0x318   => 220,
-        0x319   => 220,
-        0x31C   => 220,
-        0x31D   => 220,
-        0x31E   => 220,
-        0x31F   => 220,
-        0x320   => 220,
-        0x323   => 220,
-        0x324   => 220,
-        0x325   => 220,
-        0x326   => 220,
-        0x329   => 220,
-        0x32A   => 220,
-        0x32B   => 220,
-        0x32C   => 220,
-        0x32D   => 220,
-        0x32E   => 220,
-        0x32F   => 220,
-        0x330   => 220,
-        0x331   => 220,
-        0x332   => 220,
-        0x333   => 220,
-        0x339   => 220,
-        0x33A   => 220,
-        0x33B   => 220,
-        0x33C   => 220,
-        0x347   => 220,
-        0x348   => 220,
-        0x349   => 220,
-        0x34D   => 220,
-        0x34E   => 220,
-        0x353   => 220,
-        0x354   => 220,
-        0x355   => 220,
-        0x356   => 220,
-        0x591   => 220,
-        0x596   => 220,
-        0x59B   => 220,
-        0x5A3   => 220,
-        0x5A4   => 220,
-        0x5A5   => 220,
-        0x5A6   => 220,
-        0x5A7   => 220,
-        0x5AA   => 220,
-        0x655   => 220,
-        0x656   => 220,
-        0x6E3   => 220,
-        0x6EA   => 220,
-        0x6ED   => 220,
-        0x731   => 220,
-        0x734   => 220,
-        0x737   => 220,
-        0x738   => 220,
-        0x739   => 220,
-        0x73B   => 220,
-        0x73C   => 220,
-        0x73E   => 220,
-        0x742   => 220,
-        0x744   => 220,
-        0x746   => 220,
-        0x748   => 220,
-        0x952   => 220,
-        0xF18   => 220,
-        0xF19   => 220,
-        0xF35   => 220,
-        0xF37   => 220,
-        0xFC6   => 220,
-        0x193B  => 220,
-        0x20E8  => 220,
-        0x1D17B => 220,
-        0x1D17C => 220,
-        0x1D17D => 220,
-        0x1D17E => 220,
-        0x1D17F => 220,
-        0x1D180 => 220,
-        0x1D181 => 220,
-        0x1D182 => 220,
-        0x1D18A => 220,
-        0x1D18B => 220,
-        0x59A   => 222,
-        0x5AD   => 222,
-        0x1929  => 222,
-        0x302D  => 222,
-        0x302E  => 224,
-        0x302F  => 224,
-        0x1D16D => 226,
-        0x5AE   => 228,
-        0x18A9  => 228,
-        0x302B  => 228,
-        0x300   => 230,
-        0x301   => 230,
-        0x302   => 230,
-        0x303   => 230,
-        0x304   => 230,
-        0x305   => 230,
-        0x306   => 230,
-        0x307   => 230,
-        0x308   => 230,
-        0x309   => 230,
-        0x30A   => 230,
-        0x30B   => 230,
-        0x30C   => 230,
-        0x30D   => 230,
-        0x30E   => 230,
-        0x30F   => 230,
-        0x310   => 230,
-        0x311   => 230,
-        0x312   => 230,
-        0x313   => 230,
-        0x314   => 230,
-        0x33D   => 230,
-        0x33E   => 230,
-        0x33F   => 230,
-        0x340   => 230,
-        0x341   => 230,
-        0x342   => 230,
-        0x343   => 230,
-        0x344   => 230,
-        0x346   => 230,
-        0x34A   => 230,
-        0x34B   => 230,
-        0x34C   => 230,
-        0x350   => 230,
-        0x351   => 230,
-        0x352   => 230,
-        0x357   => 230,
-        0x363   => 230,
-        0x364   => 230,
-        0x365   => 230,
-        0x366   => 230,
-        0x367   => 230,
-        0x368   => 230,
-        0x369   => 230,
-        0x36A   => 230,
-        0x36B   => 230,
-        0x36C   => 230,
-        0x36D   => 230,
-        0x36E   => 230,
-        0x36F   => 230,
-        0x483   => 230,
-        0x484   => 230,
-        0x485   => 230,
-        0x486   => 230,
-        0x592   => 230,
-        0x593   => 230,
-        0x594   => 230,
-        0x595   => 230,
-        0x597   => 230,
-        0x598   => 230,
-        0x599   => 230,
-        0x59C   => 230,
-        0x59D   => 230,
-        0x59E   => 230,
-        0x59F   => 230,
-        0x5A0   => 230,
-        0x5A1   => 230,
-        0x5A8   => 230,
-        0x5A9   => 230,
-        0x5AB   => 230,
-        0x5AC   => 230,
-        0x5AF   => 230,
-        0x5C4   => 230,
-        0x610   => 230,
-        0x611   => 230,
-        0x612   => 230,
-        0x613   => 230,
-        0x614   => 230,
-        0x615   => 230,
-        0x653   => 230,
-        0x654   => 230,
-        0x657   => 230,
-        0x658   => 230,
-        0x6D6   => 230,
-        0x6D7   => 230,
-        0x6D8   => 230,
-        0x6D9   => 230,
-        0x6DA   => 230,
-        0x6DB   => 230,
-        0x6DC   => 230,
-        0x6DF   => 230,
-        0x6E0   => 230,
-        0x6E1   => 230,
-        0x6E2   => 230,
-        0x6E4   => 230,
-        0x6E7   => 230,
-        0x6E8   => 230,
-        0x6EB   => 230,
-        0x6EC   => 230,
-        0x730   => 230,
-        0x732   => 230,
-        0x733   => 230,
-        0x735   => 230,
-        0x736   => 230,
-        0x73A   => 230,
-        0x73D   => 230,
-        0x73F   => 230,
-        0x740   => 230,
-        0x741   => 230,
-        0x743   => 230,
-        0x745   => 230,
-        0x747   => 230,
-        0x749   => 230,
-        0x74A   => 230,
-        0x951   => 230,
-        0x953   => 230,
-        0x954   => 230,
-        0xF82   => 230,
-        0xF83   => 230,
-        0xF86   => 230,
-        0xF87   => 230,
-        0x170D  => 230,
-        0x193A  => 230,
-        0x20D0  => 230,
-        0x20D1  => 230,
-        0x20D4  => 230,
-        0x20D5  => 230,
-        0x20D6  => 230,
-        0x20D7  => 230,
-        0x20DB  => 230,
-        0x20DC  => 230,
-        0x20E1  => 230,
-        0x20E7  => 230,
-        0x20E9  => 230,
-        0xFE20  => 230,
-        0xFE21  => 230,
-        0xFE22  => 230,
-        0xFE23  => 230,
-        0x1D185 => 230,
-        0x1D186 => 230,
-        0x1D187 => 230,
-        0x1D189 => 230,
-        0x1D188 => 230,
-        0x1D1AA => 230,
-        0x1D1AB => 230,
-        0x1D1AC => 230,
-        0x1D1AD => 230,
-        0x315   => 232,
-        0x31A   => 232,
-        0x302C  => 232,
-        0x35F   => 233,
-        0x362   => 233,
-        0x35D   => 234,
-        0x35E   => 234,
-        0x360   => 234,
-        0x361   => 234,
-        0x345   => 240
-    );
-    // }}}
-
-    // {{{ properties
-    /**
-     * @var string
-     * @access private
-     */
-    private $_punycode_prefix = 'xn--';
-
-    /**
-     * @access private
-     */
-    private $_invalid_ucs = 0x80000000;
-
-    /**
-     * @access private
-     */
-    private $_max_ucs = 0x10FFFF;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_base = 36;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_tmin = 1;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_tmax = 26;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_skew = 38;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_damp = 700;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_initial_bias = 72;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_initial_n = 0x80;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_slast;
-
-    /**
-     * @access private
-     */
-    private $_sbase = 0xAC00;
-
-    /**
-     * @access private
-     */
-    private $_lbase = 0x1100;
-
-    /**
-     * @access private
-     */
-    private $_vbase = 0x1161;
-
-    /**
-     * @access private
-     */
-    private $_tbase = 0x11a7;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_lcount = 19;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_vcount = 21;
-
-    /**
-     * @var int
-     * @access private
-     */
-    private $_tcount = 28;
-
-    /**
-     * vcount * tcount
-     *
-     * @var int
-     * @access private
-     */
-    private $_ncount = 588;
-
-    /**
-     * lcount * tcount * vcount
-     *
-     * @var int
-     * @access private
-     */
-    private $_scount = 11172;
-
-    /**
-     * Default encoding for encode()'s input and decode()'s output is UTF-8;
-     * Other possible encodings are ucs4_string and ucs4_array
-     * See {@link setParams()} for how to select these
-     *
-     * @var bool
-     * @access private
-     */
-    private $_api_encoding = 'utf8';
-
-    /**
-     * Overlong UTF-8 encodings are forbidden
-     *
-     * @var bool
-     * @access private
-     */
-    private $_allow_overlong = false;
-
-    /**
-     * Behave strict or not
-     *
-     * @var bool
-     * @access private
-     */
-    private $_strict_mode = false;
-
-    /**
-     * Cached value indicating whether or not mbstring function overloading is
-     * on for strlen
-     *
-     * This is cached for optimal performance.
-     *
-     * @var boolean
-     * @see Net_IDNA_php5::_byteLength()
-     */
-    private static $_mb_string_overload = null;
-    // }}}
-
-
-    // {{{ constructor
-    /**
-     * Constructor
-     *
-     * @param  array  $options
-     * @access public
-     * @see    setParams()
-     */
-    public function __construct($options = null)
-    {
-        $this->_slast = $this->_sbase + $this->_lcount * $this->_vcount * $this->_tcount;
-
-        if (is_array($options)) {
-            $this->setParams($options);
-        }
-
-        // populate mbstring overloading cache if not set
-        if (self::$_mb_string_overload === null) {
-            self::$_mb_string_overload = (extension_loaded('mbstring')
-                && (ini_get('mbstring.func_overload') & 0x02) === 0x02);
-        }
-    }
-    // }}}
-
-
-    /**
-     * Sets a new option value. Available options and values:
-     *
-     * [utf8 -     Use either UTF-8 or ISO-8859-1 as input (true for UTF-8, false
-     *             otherwise); The output is always UTF-8]
-     * [overlong - Unicode does not allow unnecessarily long encodings of chars,
-     *             to allow this, set this parameter to true, else to false;
-     *             default is false.]
-     * [strict -   true: strict mode, good for registration purposes - Causes errors
-     *             on failures; false: loose mode, ideal for "wildlife" applications
-     *             by silently ignoring errors and returning the original input instead]
-     *
-     * @param    mixed     $option      Parameter to set (string: single parameter; array of Parameter => Value pairs)
-     * @param    string    $value       Value to use (if parameter 1 is a string)
-     * @return   boolean                true on success, false otherwise
-     * @access   public
-     */
-    public function setParams($option, $value = false)
-    {
-        if (!is_array($option)) {
-            $option = array($option => $value);
-        }
-
-        foreach ($option as $k => $v) {
-            switch ($k) {
-            case 'encoding':
-                switch ($v) {
-                case 'utf8':
-                case 'ucs4_string':
-                case 'ucs4_array':
-                    $this->_api_encoding = $v;
-                    break;
-
-                default:
-                    throw new Exception('Set Parameter: Unknown parameter '.$v.' for option '.$k);
-                }
-
-                break;
-
-            case 'overlong':
-                $this->_allow_overlong = ($v) ? true : false;
-                break;
-
-            case 'strict':
-                $this->_strict_mode = ($v) ? true : false;
-                break;
-
-            default:
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Encode a given UTF-8 domain name.
-     *
-     * @param    string     $decoded     Domain name (UTF-8 or UCS-4)
-     * [@param    string     $encoding    Desired input encoding, see {@link set_parameter}]
-     * @return   string                  Encoded Domain name (ACE string)
-     * @return   mixed                   processed string
-     * @throws   Exception
-     * @access   public
-     */
-    public function encode($decoded, $one_time_encoding = false)
-    {
-        // Forcing conversion of input to UCS4 array
-        // If one time encoding is given, use this, else the objects property
-        switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
-        case 'utf8':
-            $decoded = $this->_utf8_to_ucs4($decoded);
-            break;
-        case 'ucs4_string':
-           $decoded = $this->_ucs4_string_to_ucs4($decoded);
-        case 'ucs4_array': // No break; before this line. Catch case, but do nothing
-           break;
-        default:
-            throw new Exception('Unsupported input format');
-        }
-
-        // No input, no output, what else did you expect?
-        if (empty($decoded)) return '';
-
-        // Anchors for iteration
-        $last_begin = 0;
-        // Output string
-        $output = '';
-
-        foreach ($decoded as $k => $v) {
-            // Make sure to use just the plain dot
-            switch($v) {
-            case 0x3002:
-            case 0xFF0E:
-            case 0xFF61:
-                $decoded[$k] = 0x2E;
-                // It's right, no break here
-                // The codepoints above have to be converted to dots anyway
-
-            // Stumbling across an anchoring character
-            case 0x2E:
-            case 0x2F:
-            case 0x3A:
-            case 0x3F:
-            case 0x40:
-                // Neither email addresses nor URLs allowed in strict mode
-                if ($this->_strict_mode) {
-                   throw new Exception('Neither email addresses nor URLs are allowed in strict mode.');
-                } else {
-                    // Skip first char
-                    if ($k) {
-                        $encoded = '';
-                        $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin)));
-                        if ($encoded) {
-                            $output .= $encoded;
-                        } else {
-                            $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin)));
-                        }
-                        $output .= chr($decoded[$k]);
-                    }
-                    $last_begin = $k + 1;
-                }
-            }
-        }
-        // Catch the rest of the string
-        if ($last_begin) {
-            $inp_len = sizeof($decoded);
-            $encoded = '';
-            $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin)));
-            if ($encoded) {
-                $output .= $encoded;
-            } else {
-                $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin)));
-            }
-            return $output;
-        } else {
-            if ($output = $this->_encode($decoded)) {
-                return $output;
-            } else {
-                return $this->_ucs4_to_utf8($decoded);
-            }
-        }
-    }
-
-    /**
-     * Decode a given ACE domain name.
-     *
-     * @param    string     $encoded     Domain name (ACE string)
-     * @param    string     $encoding    Desired output encoding, see {@link set_parameter}
-     * @return   string                  Decoded Domain name (UTF-8 or UCS-4)
-     * @throws   Exception
-     * @access   public
-     */
-    public function decode($input, $one_time_encoding = false)
-    {
-        // Optionally set
-        if ($one_time_encoding) {
-            switch ($one_time_encoding) {
-            case 'utf8':
-            case 'ucs4_string':
-            case 'ucs4_array':
-                break;
-            default:
-                throw new Exception('Unknown encoding '.$one_time_encoding);
-                return false;
-            }
-        }
-        // Make sure to drop any newline characters around
-        $input = trim($input);
-
-        // Negotiate input and try to determine, wether it is a plain string,
-        // an email address or something like a complete URL
-        if (strpos($input, '@')) { // Maybe it is an email address
-            // No no in strict mode
-            if ($this->_strict_mode) {
-                throw new Exception('Only simple domain name parts can be handled in strict mode');
-            }
-            list($email_pref, $input) = explode('@', $input, 2);
-            $arr = explode('.', $input);
-            foreach ($arr as $k => $v) {
-                $conv = $this->_decode($v);
-                if ($conv) $arr[$k] = $conv;
-            }
-            $return = $email_pref . '@' . join('.', $arr);
-        } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters)
-            // No no in strict mode
-            if ($this->_strict_mode) {
-                throw new Exception('Only simple domain name parts can be handled in strict mode');
-            }
-            $parsed = parse_url($input);
-            if (isset($parsed['host'])) {
-                $arr = explode('.', $parsed['host']);
-                foreach ($arr as $k => $v) {
-                    $conv = $this->_decode($v);
-                    if ($conv) $arr[$k] = $conv;
-                }
-                $parsed['host'] = join('.', $arr);
-                if (isset($parsed['scheme'])) {
-                    $parsed['scheme'] .= (strtolower($parsed['scheme']) == 'mailto') ? ':' : '://';
-                }
-                $return = join('', $parsed);
-            } else { // parse_url seems to have failed, try without it
-                $arr = explode('.', $input);
-                foreach ($arr as $k => $v) {
-                    $conv = $this->_decode($v);
-                    if ($conv) $arr[$k] = $conv;
-                }
-                $return = join('.', $arr);
-            }
-        } else { // Otherwise we consider it being a pure domain name string
-            $return = $this->_decode($input);
-        }
-        // The output is UTF-8 by default, other output formats need conversion here
-        // If one time encoding is given, use this, else the objects property
-        switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
-        case 'utf8':
-            return $return;
-            break;
-        case 'ucs4_string':
-           return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));
-           break;
-        case 'ucs4_array':
-            return $this->_utf8_to_ucs4($return);
-            break;
-        default:
-            throw new Exception('Unsupported output format');
-        }
-    }
-
-
-    // {{{ private
-    /**
-     * The actual encoding algorithm.
-     *
-     * @return   string
-     * @throws   Exception
-     * @access   private
-     */
-    private function _encode($decoded)
-    {
-        // We cannot encode a domain name containing the Punycode prefix
-        $extract = self::_byteLength($this->_punycode_prefix);
-        $check_pref = $this->_utf8_to_ucs4($this->_punycode_prefix);
-        $check_deco = array_slice($decoded, 0, $extract);
-
-        if ($check_pref == $check_deco) {
-            throw new Exception('This is already a punycode string');
-        }
-        // We will not try to encode strings consisting of basic code points only
-        $encodable = false;
-        foreach ($decoded as $k => $v) {
-            if ($v > 0x7a) {
-                $encodable = true;
-                break;
-            }
-        }
-        if (!$encodable) {
-            if ($this->_strict_mode) {
-                throw new Exception('The given string does not contain encodable chars');
-            } else {
-                return false;
-            }
-        }
-
-        // Do NAMEPREP
-        try {
-            $decoded = $this->_nameprep($decoded);
-        } catch (Exception $e) {
-            // hmm, serious - rethrow
-            throw $e;
-        }
-
-        $deco_len = count($decoded);
-
-        // Empty array
-        if (!$deco_len) {
-            return false;
-        }
-
-        // How many chars have been consumed
-        $codecount = 0;
-
-        // Start with the prefix; copy it to output
-        $encoded = $this->_punycode_prefix;
-
-        $encoded = '';
-        // Copy all basic code points to output
-        for ($i = 0; $i < $deco_len; ++$i) {
-            $test = $decoded[$i];
-            // Will match [0-9a-zA-Z-]
-            if ((0x2F < $test && $test < 0x40)
-                    || (0x40 < $test && $test < 0x5B)
-                    || (0x60 < $test && $test <= 0x7B)
-                    || (0x2D == $test)) {
-                $encoded .= chr($decoded[$i]);
-                $codecount++;
-            }
-        }
-
-        // All codepoints were basic ones
-        if ($codecount == $deco_len) {
-            return $encoded;
-        }
-
-        // Start with the prefix; copy it to output
-        $encoded = $this->_punycode_prefix . $encoded;
-
-        // If we have basic code points in output, add an hyphen to the end
-        if ($codecount) {
-            $encoded .= '-';
-        }
-
-        // Now find and encode all non-basic code points
-        $is_first  = true;
-        $cur_code  = $this->_initial_n;
-        $bias      = $this->_initial_bias;
-        $delta     = 0;
-
-        while ($codecount < $deco_len) {
-            // Find the smallest code point >= the current code point and
-            // remember the last ouccrence of it in the input
-            for ($i = 0, $next_code = $this->_max_ucs; $i < $deco_len; $i++) {
-                if ($decoded[$i] >= $cur_code && $decoded[$i] <= $next_code) {
-                    $next_code = $decoded[$i];
-                }
-            }
-
-            $delta += ($next_code - $cur_code) * ($codecount + 1);
-            $cur_code = $next_code;
-
-            // Scan input again and encode all characters whose code point is $cur_code
-            for ($i = 0; $i < $deco_len; $i++) {
-                if ($decoded[$i] < $cur_code) {
-                    $delta++;
-                } else if ($decoded[$i] == $cur_code) {
-                    for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) {
-                        $t = ($k <= $bias)?
-                            $this->_tmin :
-                            (($k >= $bias + $this->_tmax)? $this->_tmax : $k - $bias);
-
-                        if ($q < $t) {
-                            break;
-                        }
-
-                        $encoded .= $this->_encodeDigit(ceil($t + (($q - $t) % ($this->_base - $t))));
-                        $q = ($q - $t) / ($this->_base - $t);
-                    }
-
-                    $encoded .= $this->_encodeDigit($q);
-                    $bias = $this->_adapt($delta, $codecount + 1, $is_first);
-                    $codecount++;
-                    $delta = 0;
-                    $is_first = false;
-                }
-            }
-
-            $delta++;
-            $cur_code++;
-        }
-
-        return $encoded;
-    }
-
-    /**
-     * The actual decoding algorithm.
-     *
-     * @return   string
-     * @throws   Exception
-     * @access   private
-     */
-    private function _decode($encoded)
-    {
-        // We do need to find the Punycode prefix
-        if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) {
-            return false;
-        }
-
-        $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded);
-
-        // If nothing left after removing the prefix, it is hopeless
-        if (!$encode_test) {
-            return false;
-        }
-
-        // Find last occurence of the delimiter
-        $delim_pos = strrpos($encoded, '-');
-
-        if ($delim_pos > self::_byteLength($this->_punycode_prefix)) {
-            for ($k = self::_byteLength($this->_punycode_prefix); $k < $delim_pos; ++$k) {
-                $decoded[] = ord($encoded{$k});
-            }
-        } else {
-            $decoded = array();
-        }
-
-        $deco_len = count($decoded);
-        $enco_len = self::_byteLength($encoded);
-
-        // Wandering through the strings; init
-        $is_first = true;
-        $bias     = $this->_initial_bias;
-        $idx      = 0;
-        $char     = $this->_initial_n;
-
-        for ($enco_idx = ($delim_pos)? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
-            for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) {
-                $digit = $this->_decodeDigit($encoded{$enco_idx++});
-                $idx += $digit * $w;
-
-                $t = ($k <= $bias) ?
-                    $this->_tmin :
-                    (($k >= $bias + $this->_tmax)? $this->_tmax : ($k - $bias));
-
-                if ($digit < $t) {
-                    break;
-                }
-
-                $w = (int)($w * ($this->_base - $t));
-            }
-
-            $bias      = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first);
-            $is_first  = false;
-            $char     += (int) ($idx / ($deco_len + 1));
-            $idx      %= ($deco_len + 1);
-
-            if ($deco_len > 0) {
-                // Make room for the decoded char
-                for ($i = $deco_len; $i > $idx; $i--) {
-                    $decoded[$i] = $decoded[($i - 1)];
-                }
-            }
-
-            $decoded[$idx++] = $char;
-        }
-
-        try {
-            return $this->_ucs4_to_utf8($decoded);
-        } catch (Exception $e) {
-            // rethrow
-            throw $e;
-        }
-    }
-
-    /**
-     * Adapt the bias according to the current code point and position.
-     *
-     * @access   private
-     */
-    private function _adapt($delta, $npoints, $is_first)
-    {
-        $delta = (int) ($is_first ? ($delta / $this->_damp) : ($delta / 2));
-        $delta += (int) ($delta / $npoints);
-
-        for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) {
-            $delta = (int) ($delta / ($this->_base - $this->_tmin));
-        }
-
-        return (int) ($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew));
-    }
-
-    /**
-     * Encoding a certain digit.
-     *
-     * @access   private
-     */
-    private function _encodeDigit($d)
-    {
-        return chr($d + 22 + 75 * ($d < 26));
-    }
-
-    /**
-     * Decode a certain digit.
-     *
-     * @access   private
-     */
-    private function _decodeDigit($cp)
-    {
-        $cp = ord($cp);
-        return ($cp - 48 < 10)? $cp - 22 : (($cp - 65 < 26)? $cp - 65 : (($cp - 97 < 26)? $cp - 97 : $this->_base));
-    }
-
-    /**
-     * Do Nameprep according to RFC3491 and RFC3454.
-     *
-     * @param    array      $input       Unicode Characters
-     * @return   string                  Unicode Characters, Nameprep'd
-     * @throws   Exception
-     * @access   private
-     */
-    private function _nameprep($input)
-    {
-        $output = array();
-
-        // Walking through the input array, performing the required steps on each of
-        // the input chars and putting the result into the output array
-        // While mapping required chars we apply the cannonical ordering
-
-        foreach ($input as $v) {
-            // Map to nothing == skip that code point
-            if (in_array($v, self::$_np_map_nothing)) {
-                continue;
-            }
-
-            // Try to find prohibited input
-            if (in_array($v, self::$_np_prohibit) || in_array($v, self::$_general_prohibited)) {
-                throw new Exception('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v));
-            }
-
-            foreach (self::$_np_prohibit_ranges as $range) {
-                if ($range[0] <= $v && $v <= $range[1]) {
-                    throw new Exception('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v));
-                }
-            }
-
-            // Hangul syllable decomposition
-            if (0xAC00 <= $v && $v <= 0xD7AF) {
-                foreach ($this->_hangulDecompose($v) as $out) {
-                    $output[] = $out;
-                }
-            } else if (isset(self::$_np_replacemaps[$v])) { // There's a decomposition mapping for that code point
-                foreach ($this->_applyCannonicalOrdering(self::$_np_replacemaps[$v]) as $out) {
-                    $output[] = $out;
-                }
-            } else {
-                $output[] = $v;
-            }
-        }
-
-        // Combine code points
-
-        $last_class   = 0;
-        $last_starter = 0;
-        $out_len      = count($output);
-
-        for ($i = 0; $i < $out_len; ++$i) {
-            $class = $this->_getCombiningClass($output[$i]);
-
-            if ((!$last_class || $last_class != $class) && $class) {
-                // Try to match
-                $seq_len = $i - $last_starter;
-                $out = $this->_combine(array_slice($output, $last_starter, $seq_len));
-
-                // On match: Replace the last starter with the composed character and remove
-                // the now redundant non-starter(s)
-                if ($out) {
-                    $output[$last_starter] = $out;
-
-                    if (count($out) != $seq_len) {
-                        for ($j = $i + 1; $j < $out_len; ++$j) {
-                            $output[$j - 1] = $output[$j];
-                        }
-
-                        unset($output[$out_len]);
-                    }
-
-                    // Rewind the for loop by one, since there can be more possible compositions
-                    $i--;
-                    $out_len--;
-                    $last_class = ($i == $last_starter)? 0 : $this->_getCombiningClass($output[$i - 1]);
-
-                    continue;
-                }
-            }
-
-            // The current class is 0
-            if (!$class) {
-                $last_starter = $i;
-            }
-
-            $last_class = $class;
-        }
-
-        return $output;
-    }
-
-    /**
-     * Decomposes a Hangul syllable
-     * (see http://www.unicode.org/unicode/reports/tr15/#Hangul).
-     *
-     * @param    integer    $char        32bit UCS4 code point
-     * @return   array                   Either Hangul Syllable decomposed or original 32bit
-     *                                   value as one value array
-     * @access   private
-     */
-    private function _hangulDecompose($char)
-    {
-        $sindex = $char - $this->_sbase;
-
-        if ($sindex < 0 || $sindex >= $this->_scount) {
-            return array($char);
-        }
-
-        $result   = array();
-        $T        = $this->_tbase + $sindex % $this->_tcount;
-        $result[] = (int)($this->_lbase +  $sindex / $this->_ncount);
-        $result[] = (int)($this->_vbase + ($sindex % $this->_ncount) / $this->_tcount);
-
-        if ($T != $this->_tbase) {
-            $result[] = $T;
-        }
-
-        return $result;
-    }
-
-    /**
-     * Ccomposes a Hangul syllable
-     * (see http://www.unicode.org/unicode/reports/tr15/#Hangul).
-     *
-     * @param    array      $input       Decomposed UCS4 sequence
-     * @return   array                   UCS4 sequence with syllables composed
-     * @access   private
-     */
-    private function _hangulCompose($input)
-    {
-        $inp_len = count($input);
-
-        if (!$inp_len) {
-            return array();
-        }
-
-        $result   = array();
-        $last     = $input[0];
-        $result[] = $last; // copy first char from input to output
-
-        for ($i = 1; $i < $inp_len; ++$i) {
-            $char = $input[$i];
-
-            // Find out, wether two current characters from L and V
-            $lindex = $last - $this->_lbase;
-
-            if (0 <= $lindex && $lindex < $this->_lcount) {
-                $vindex = $char - $this->_vbase;
-
-                if (0 <= $vindex && $vindex < $this->_vcount) {
-                    // create syllable of form LV
-                    $last    = ($this->_sbase + ($lindex * $this->_vcount + $vindex) * $this->_tcount);
-                    $out_off = count($result) - 1;
-                    $result[$out_off] = $last; // reset last
-
-                    // discard char
-                    continue;
-                }
-            }
-
-            // Find out, wether two current characters are LV and T
-            $sindex = $last - $this->_sbase;
-
-            if (0 <= $sindex && $sindex < $this->_scount && ($sindex % $this->_tcount) == 0) {
-                $tindex = $char - $this->_tbase;
-
-                if (0 <= $tindex && $tindex <= $this->_tcount) {
-                    // create syllable of form LVT
-                    $last += $tindex;
-                    $out_off = count($result) - 1;
-                    $result[$out_off] = $last; // reset last
-
-                    // discard char
-                    continue;
-                }
-            }
-
-            // if neither case was true, just add the character
-            $last = $char;
-            $result[] = $char;
-        }
-
-        return $result;
-    }
-
-    /**
-     * Returns the combining class of a certain wide char.
-     *
-     * @param    integer    $char        Wide char to check (32bit integer)
-     * @return   integer                 Combining class if found, else 0
-     * @access   private
-     */
-    private function _getCombiningClass($char)
-    {
-        return isset(self::$_np_norm_combcls[$char])? self::$_np_norm_combcls[$char] : 0;
-    }
-
-    /**
-     * Apllies the cannonical ordering of a decomposed UCS4 sequence.
-     *
-     * @param    array      $input       Decomposed UCS4 sequence
-     * @return   array                   Ordered USC4 sequence
-     * @access   private
-     */
-    private function _applyCannonicalOrdering($input)
-    {
-        $swap = true;
-        $size = count($input);
-
-        while ($swap) {
-            $swap = false;
-            $last = $this->_getCombiningClass($input[0]);
-
-            for ($i = 0; $i < $size - 1; ++$i) {
-                $next = $this->_getCombiningClass($input[$i + 1]);
-
-                if ($next != 0 && $last > $next) {
-                    // Move item leftward until it fits
-                    for ($j = $i + 1; $j > 0; --$j) {
-                        if ($this->_getCombiningClass($input[$j - 1]) <= $next) {
-                            break;
-                        }
-
-                        $t = $input[$j];
-                        $input[$j] = $input[$j - 1];
-                        $input[$j - 1] = $t;
-                        $swap = 1;
-                    }
-
-                    // Reentering the loop looking at the old character again
-                    $next = $last;
-                }
-
-                $last = $next;
-            }
-        }
-
-        return $input;
-    }
-
-    /**
-     * Do composition of a sequence of starter and non-starter.
-     *
-     * @param    array      $input       UCS4 Decomposed sequence
-     * @return   array                   Ordered USC4 sequence
-     * @access   private
-     */
-    private function _combine($input)
-    {
-        $inp_len = count($input);
-
-        // Is it a Hangul syllable?
-        if (1 != $inp_len) {
-            $hangul = $this->_hangulCompose($input);
-
-            // This place is probably wrong
-            if (count($hangul) != $inp_len) {
-                return $hangul;
-            }
-        }
-
-        foreach (self::$_np_replacemaps as $np_src => $np_target) {
-            if ($np_target[0] != $input[0]) {
-                continue;
-            }
-
-            if (count($np_target) != $inp_len) {
-                continue;
-            }
-
-            $hit = false;
-
-            foreach ($input as $k2 => $v2) {
-                if ($v2 == $np_target[$k2]) {
-                    $hit = true;
-                } else {
-                    $hit = false;
-                    break;
-                }
-            }
-
-            if ($hit) {
-                return $np_src;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * This converts an UTF-8 encoded string to its UCS-4 (array) representation
-     * By talking about UCS-4 we mean arrays of 32bit integers representing
-     * each of the "chars". This is due to PHP not being able to handle strings with
-     * bit depth different from 8. This applies to the reverse method _ucs4_to_utf8(), too.
-     * The following UTF-8 encodings are supported:
-     *
-     * bytes bits  representation
-     * 1        7  0xxxxxxx
-     * 2       11  110xxxxx 10xxxxxx
-     * 3       16  1110xxxx 10xxxxxx 10xxxxxx
-     * 4       21  11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-     * 5       26  111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-     * 6       31  1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-     *
-     * Each x represents a bit that can be used to store character data.
-     *
-     * @access   private
-     */
-    private function _utf8_to_ucs4($input)
-    {
-        $output = array();
-        $out_len = 0;
-        $inp_len = self::_byteLength($input, '8bit');
-        $mode = 'next';
-        $test = 'none';
-        for ($k = 0; $k < $inp_len; ++$k) {
-            $v = ord($input{$k}); // Extract byte from input string
-
-            if ($v < 128) { // We found an ASCII char - put into stirng as is
-                $output[$out_len] = $v;
-                ++$out_len;
-                if ('add' == $mode) {
-                    throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
-                    return false;
-                }
-                continue;
-            }
-            if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char
-                $start_byte = $v;
-                $mode = 'add';
-                $test = 'range';
-                if ($v >> 5 == 6) { // &110xxxxx 10xxxxx
-                    $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left
-                    $v = ($v - 192) << 6;
-                } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx
-                    $next_byte = 1;
-                    $v = ($v - 224) << 12;
-                } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-                    $next_byte = 2;
-                    $v = ($v - 240) << 18;
-                } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-                    $next_byte = 3;
-                    $v = ($v - 248) << 24;
-                } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-                    $next_byte = 4;
-                    $v = ($v - 252) << 30;
-                } else {
-                    throw new Exception('This might be UTF-8, but I don\'t understand it at byte '.$k);
-                    return false;
-                }
-                if ('add' == $mode) {
-                    $output[$out_len] = (int) $v;
-                    ++$out_len;
-                    continue;
-                }
-            }
-            if ('add' == $mode) {
-                if (!$this->_allow_overlong && $test == 'range') {
-                    $test = 'none';
-                    if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) {
-                        throw new Exception('Bogus UTF-8 character detected (out of legal range) at byte '.$k);
-                        return false;
-                    }
-                }
-                if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx
-                    $v = ($v - 128) << ($next_byte * 6);
-                    $output[($out_len - 1)] += $v;
-                    --$next_byte;
-                } else {
-                    throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
-                    return false;
-                }
-                if ($next_byte < 0) {
-                    $mode = 'next';
-                }
-            }
-        } // for
-        return $output;
-    }
-
-    /**
-     * Convert UCS-4 array into UTF-8 string.
-     *
-     * @throws   Exception
-     * @access   private
-     */
-    private function _ucs4_to_utf8($input)
-    {
-        $output = '';
-
-        foreach ($input as $v) {
-            // $v = ord($v);
-
-            if ($v < 128) {
-                // 7bit are transferred literally
-                $output .= chr($v);
-            } else if ($v < 1 << 11) {
-                // 2 bytes
-                $output .= chr(192 + ($v >> 6))
-                    . chr(128 + ($v & 63));
-            } else if ($v < 1 << 16) {
-                // 3 bytes
-                $output .= chr(224 + ($v >> 12))
-                    . chr(128 + (($v >> 6) & 63))
-                    . chr(128 + ($v & 63));
-            } else if ($v < 1 << 21) {
-                // 4 bytes
-                $output .= chr(240 + ($v >> 18))
-                    . chr(128 + (($v >> 12) & 63))
-                    . chr(128 + (($v >>  6) & 63))
-                    . chr(128 + ($v & 63));
-            } else if ($v < 1 << 26) {
-                // 5 bytes
-                $output .= chr(248 + ($v >> 24))
-                    . chr(128 + (($v >> 18) & 63))
-                    . chr(128 + (($v >> 12) & 63))
-                    . chr(128 + (($v >>  6) & 63))
-                    . chr(128 + ($v & 63));
-            } else if ($v < 1 << 31) {
-                // 6 bytes
-                $output .= chr(252 + ($v >> 30))
-                    . chr(128 + (($v >> 24) & 63))
-                    . chr(128 + (($v >> 18) & 63))
-                    . chr(128 + (($v >> 12) & 63))
-                    . chr(128 + (($v >>  6) & 63))
-                    . chr(128 + ($v & 63));
-            } else {
-                throw new Exception('Conversion from UCS-4 to UTF-8 failed: malformed input at byte ' . $k);
-            }
-        }
-
-        return $output;
-    }
-
-    /**
-     * Convert UCS-4 array into UCS-4 string
-     *
-     * @throws   Exception
-     * @access   private
-     */
-    private function _ucs4_to_ucs4_string($input)
-    {
-        $output = '';
-        // Take array values and split output to 4 bytes per value
-        // The bit mask is 255, which reads &11111111
-        foreach ($input as $v) {
-            $output .= ($v & (255 << 24) >> 24) . ($v & (255 << 16) >> 16) . ($v & (255 << 8) >> 8) . ($v & 255);
-        }
-        return $output;
-    }
-
-    /**
-     * Convert UCS-4 strin into UCS-4 garray
-     *
-     * @throws   Exception
-     * @access   private
-     */
-    private function _ucs4_string_to_ucs4($input)
-    {
-        $output = array();
-
-        $inp_len = self::_byteLength($input);
-        // Input length must be dividable by 4
-        if ($inp_len % 4) {
-            throw new Exception('Input UCS4 string is broken');
-            return false;
-        }
-
-        // Empty input - return empty output
-        if (!$inp_len) return $output;
-
-        for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) {
-            // Increment output position every 4 input bytes
-            if (!$i % 4) {
-                $out_len++;
-                $output[$out_len] = 0;
-            }
-            $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
-        }
-        return $output;
-    }
-
-    /**
-     * Echo hex representation of UCS4 sequence.
-     *
-     * @param    array      $input       UCS4 sequence
-     * @param    boolean    $include_bit Include bitmask in output
-     * @return   void
-     * @static
-     * @access   private
-     */
-    private static function _showHex($input, $include_bit = false)
-    {
-        foreach ($input as $k => $v) {
-            echo '[', $k, '] => ', sprintf('%X', $v);
-
-            if ($include_bit) {
-                echo ' (', Net_IDNA::_showBitmask($v), ')';
-            }
-
-            echo "\n";
-        }
-    }
-
-    /**
-     * Gives you a bit representation of given Byte (8 bits), Word (16 bits) or DWord (32 bits)
-     * Output width is automagically determined
-     *
-     * @static
-     * @access   private
-     */
-    private static function _showBitmask($octet)
-    {
-        if ($octet >= (1 << 16)) {
-            $w = 31;
-        } else if ($octet >= (1 << 8)) {
-            $w = 15;
-        } else {
-            $w = 7;
-        }
-
-        $return = '';
-
-        for ($i = $w; $i > -1; $i--) {
-            $return .= ($octet & (1 << $i))? 1 : '0';
-        }
-
-        return $return;
-    }
-
-    /**
-     * Gets the length of a string in bytes even if mbstring function
-     * overloading is turned on
-     *
-     * @param string $string the string for which to get the length.
-     *
-     * @return integer the length of the string in bytes.
-     *
-     * @see Net_IDNA_php5::$_mb_string_overload
-     */
-    private static function _byteLength($string)
-    {
-        if (self::$_mb_string_overload) {
-            return mb_strlen($string, '8bit');
-        }
-        return strlen((binary)$string);
-    }
-
-    // }}}}
-}
-
-?>
diff --git a/extlib/Net/IDNA2.php b/extlib/Net/IDNA2.php
new file mode 100644 (file)
index 0000000..98d0b0a
--- /dev/null
@@ -0,0 +1,3411 @@
+<?php
+
+// {{{ license{{{{{{
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+//
+// +----------------------------------------------------------------------+
+// | This library is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU Lesser General Public License as       |
+// | published by the Free Software Foundation; either version 2.1 of the |
+// | License, or (at your option) any later version.                      |
+// |                                                                      |
+// | This library is distributed in the hope that it will be useful, but  |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of           |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
+// | Lesser General Public License for more details.                      |
+// |                                                                      |
+// | You should have received a copy of the GNU Lesser General Public     |
+// | License along with this library; if not, write to the Free Software  |
+// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 |
+// | USA.                                                                 |
+// +----------------------------------------------------------------------+
+//
+
+// }}}}}}}}}
+require_once 'Net/IDNA2/Exception.php';
+require_once 'Net/IDNA2/Exception/Nameprep.php';
+
+/**
+ * Encode/decode Internationalized Domain Names.
+ *
+ * The class allows one to convert internationalized domain names
+ * (see RFC 3490 for details) as they can be used with various registries worldwide
+ * to be translated between their original (localized) form and their encoded form
+ * as it will be used in the DNS (Domain Name System).
+ *
+ * The class provides two public methods, encode() and decode(), which do exactly
+ * what you would expect them to do. You are allowed to use complete domain names,
+ * simple strings and complete email addresses as well. That means, that you might
+ * use any of the following notations:
+ *
+ * - www.n�rgler.com
+ * - xn--nrgler-wxa
+ * - xn--brse-5qa.xn--knrz-1ra.info
+ *
+ * Unicode input might be given as either UTF-8 string, UCS-4 string or UCS-4
+ * array. Unicode output is available in the same formats.
+ * You can select your preferred format via {@link set_paramter()}.
+ *
+ * ACE input and output is always expected to be ASCII.
+ *
+ * @package Net
+ * @author  Markus Nix <mnix@docuverse.de>
+ * @author  Matthias Sommerfeld <mso@phlylabs.de>
+ * @author  Stefan Neufeind <pear.neufeind@speedpartner.de>
+ * @version $Id$
+ */
+class Net_IDNA2
+{
+    // {{{ npdata
+    /**
+     * These Unicode codepoints are
+     * mapped to nothing, See RFC3454 for details
+     *
+     * @static
+     * @var array
+     * @access private
+     */
+    private static $_np_map_nothing = [
+        0xAD,
+        0x34F,
+        0x1806,
+        0x180B,
+        0x180C,
+        0x180D,
+        0x200B,
+        0x200C,
+        0x200D,
+        0x2060,
+        0xFE00,
+        0xFE01,
+        0xFE02,
+        0xFE03,
+        0xFE04,
+        0xFE05,
+        0xFE06,
+        0xFE07,
+        0xFE08,
+        0xFE09,
+        0xFE0A,
+        0xFE0B,
+        0xFE0C,
+        0xFE0D,
+        0xFE0E,
+        0xFE0F,
+        0xFEFF
+    ];
+
+    /**
+     * Prohibited codepints
+     *
+     * @static
+     * @var array
+     * @access private
+     */
+    private static $_general_prohibited = [
+        0,
+        1,
+        2,
+        3,
+        4,
+        5,
+        6,
+        7,
+        8,
+        9,
+        0xA,
+        0xB,
+        0xC,
+        0xD,
+        0xE,
+        0xF,
+        0x10,
+        0x11,
+        0x12,
+        0x13,
+        0x14,
+        0x15,
+        0x16,
+        0x17,
+        0x18,
+        0x19,
+        0x1A,
+        0x1B,
+        0x1C,
+        0x1D,
+        0x1E,
+        0x1F,
+        0x20,
+        0x21,
+        0x22,
+        0x23,
+        0x24,
+        0x25,
+        0x26,
+        0x27,
+        0x28,
+        0x29,
+        0x2A,
+        0x2B,
+        0x2C,
+        0x2F,
+        0x3B,
+        0x3C,
+        0x3D,
+        0x3E,
+        0x3F,
+        0x40,
+        0x5B,
+        0x5C,
+        0x5D,
+        0x5E,
+        0x5F,
+        0x60,
+        0x7B,
+        0x7C,
+        0x7D,
+        0x7E,
+        0x7F,
+        0x3002
+    ];
+
+    /**
+     * Codepints prohibited by Nameprep
+     * @static
+     * @var array
+     * @access private
+     */
+    private static $_np_prohibit = [
+        0xA0,
+        0x1680,
+        0x2000,
+        0x2001,
+        0x2002,
+        0x2003,
+        0x2004,
+        0x2005,
+        0x2006,
+        0x2007,
+        0x2008,
+        0x2009,
+        0x200A,
+        0x200B,
+        0x202F,
+        0x205F,
+        0x3000,
+        0x6DD,
+        0x70F,
+        0x180E,
+        0x200C,
+        0x200D,
+        0x2028,
+        0x2029,
+        0xFEFF,
+        0xFFF9,
+        0xFFFA,
+        0xFFFB,
+        0xFFFC,
+        0xFFFE,
+        0xFFFF,
+        0x1FFFE,
+        0x1FFFF,
+        0x2FFFE,
+        0x2FFFF,
+        0x3FFFE,
+        0x3FFFF,
+        0x4FFFE,
+        0x4FFFF,
+        0x5FFFE,
+        0x5FFFF,
+        0x6FFFE,
+        0x6FFFF,
+        0x7FFFE,
+        0x7FFFF,
+        0x8FFFE,
+        0x8FFFF,
+        0x9FFFE,
+        0x9FFFF,
+        0xAFFFE,
+        0xAFFFF,
+        0xBFFFE,
+        0xBFFFF,
+        0xCFFFE,
+        0xCFFFF,
+        0xDFFFE,
+        0xDFFFF,
+        0xEFFFE,
+        0xEFFFF,
+        0xFFFFE,
+        0xFFFFF,
+        0x10FFFE,
+        0x10FFFF,
+        0xFFF9,
+        0xFFFA,
+        0xFFFB,
+        0xFFFC,
+        0xFFFD,
+        0x340,
+        0x341,
+        0x200E,
+        0x200F,
+        0x202A,
+        0x202B,
+        0x202C,
+        0x202D,
+        0x202E,
+        0x206A,
+        0x206B,
+        0x206C,
+        0x206D,
+        0x206E,
+        0x206F,
+        0xE0001
+    ];
+
+    /**
+     * Codepoint ranges prohibited by nameprep
+     *
+     * @static
+     * @var array
+     * @access private
+     */
+    private static $_np_prohibit_ranges = [
+        [0x80, 0x9F],
+        [0x2060, 0x206F],
+        [0x1D173, 0x1D17A],
+        [0xE000, 0xF8FF],
+        [0xF0000, 0xFFFFD],
+        [0x100000, 0x10FFFD],
+        [0xFDD0, 0xFDEF],
+        [0xD800, 0xDFFF],
+        [0x2FF0, 0x2FFB],
+        [0xE0020, 0xE007F]
+    ];
+
+    /**
+     * Replacement mappings (casemapping, replacement sequences, ...)
+     *
+     * @static
+     * @var array
+     * @access private
+     */
+    private static $_np_replacemaps = [
+        0x41 => [0x61],
+        0x42 => [0x62],
+        0x43 => [0x63],
+        0x44 => [0x64],
+        0x45 => [0x65],
+        0x46 => [0x66],
+        0x47 => [0x67],
+        0x48 => [0x68],
+        0x49 => [0x69],
+        0x4A => [0x6A],
+        0x4B => [0x6B],
+        0x4C => [0x6C],
+        0x4D => [0x6D],
+        0x4E => [0x6E],
+        0x4F => [0x6F],
+        0x50 => [0x70],
+        0x51 => [0x71],
+        0x52 => [0x72],
+        0x53 => [0x73],
+        0x54 => [0x74],
+        0x55 => [0x75],
+        0x56 => [0x76],
+        0x57 => [0x77],
+        0x58 => [0x78],
+        0x59 => [0x79],
+        0x5A => [0x7A],
+        0xB5 => [0x3BC],
+        0xC0 => [0xE0],
+        0xC1 => [0xE1],
+        0xC2 => [0xE2],
+        0xC3 => [0xE3],
+        0xC4 => [0xE4],
+        0xC5 => [0xE5],
+        0xC6 => [0xE6],
+        0xC7 => [0xE7],
+        0xC8 => [0xE8],
+        0xC9 => [0xE9],
+        0xCA => [0xEA],
+        0xCB => [0xEB],
+        0xCC => [0xEC],
+        0xCD => [0xED],
+        0xCE => [0xEE],
+        0xCF => [0xEF],
+        0xD0 => [0xF0],
+        0xD1 => [0xF1],
+        0xD2 => [0xF2],
+        0xD3 => [0xF3],
+        0xD4 => [0xF4],
+        0xD5 => [0xF5],
+        0xD6 => [0xF6],
+        0xD8 => [0xF8],
+        0xD9 => [0xF9],
+        0xDA => [0xFA],
+        0xDB => [0xFB],
+        0xDC => [0xFC],
+        0xDD => [0xFD],
+        0xDE => [0xFE],
+        0xDF => [0x73, 0x73],
+        0x100 => [0x101],
+        0x102 => [0x103],
+        0x104 => [0x105],
+        0x106 => [0x107],
+        0x108 => [0x109],
+        0x10A => [0x10B],
+        0x10C => [0x10D],
+        0x10E => [0x10F],
+        0x110 => [0x111],
+        0x112 => [0x113],
+        0x114 => [0x115],
+        0x116 => [0x117],
+        0x118 => [0x119],
+        0x11A => [0x11B],
+        0x11C => [0x11D],
+        0x11E => [0x11F],
+        0x120 => [0x121],
+        0x122 => [0x123],
+        0x124 => [0x125],
+        0x126 => [0x127],
+        0x128 => [0x129],
+        0x12A => [0x12B],
+        0x12C => [0x12D],
+        0x12E => [0x12F],
+        0x130 => [0x69, 0x307],
+        0x132 => [0x133],
+        0x134 => [0x135],
+        0x136 => [0x137],
+        0x139 => [0x13A],
+        0x13B => [0x13C],
+        0x13D => [0x13E],
+        0x13F => [0x140],
+        0x141 => [0x142],
+        0x143 => [0x144],
+        0x145 => [0x146],
+        0x147 => [0x148],
+        0x149 => [0x2BC, 0x6E],
+        0x14A => [0x14B],
+        0x14C => [0x14D],
+        0x14E => [0x14F],
+        0x150 => [0x151],
+        0x152 => [0x153],
+        0x154 => [0x155],
+        0x156 => [0x157],
+        0x158 => [0x159],
+        0x15A => [0x15B],
+        0x15C => [0x15D],
+        0x15E => [0x15F],
+        0x160 => [0x161],
+        0x162 => [0x163],
+        0x164 => [0x165],
+        0x166 => [0x167],
+        0x168 => [0x169],
+        0x16A => [0x16B],
+        0x16C => [0x16D],
+        0x16E => [0x16F],
+        0x170 => [0x171],
+        0x172 => [0x173],
+        0x174 => [0x175],
+        0x176 => [0x177],
+        0x178 => [0xFF],
+        0x179 => [0x17A],
+        0x17B => [0x17C],
+        0x17D => [0x17E],
+        0x17F => [0x73],
+        0x181 => [0x253],
+        0x182 => [0x183],
+        0x184 => [0x185],
+        0x186 => [0x254],
+        0x187 => [0x188],
+        0x189 => [0x256],
+        0x18A => [0x257],
+        0x18B => [0x18C],
+        0x18E => [0x1DD],
+        0x18F => [0x259],
+        0x190 => [0x25B],
+        0x191 => [0x192],
+        0x193 => [0x260],
+        0x194 => [0x263],
+        0x196 => [0x269],
+        0x197 => [0x268],
+        0x198 => [0x199],
+        0x19C => [0x26F],
+        0x19D => [0x272],
+        0x19F => [0x275],
+        0x1A0 => [0x1A1],
+        0x1A2 => [0x1A3],
+        0x1A4 => [0x1A5],
+        0x1A6 => [0x280],
+        0x1A7 => [0x1A8],
+        0x1A9 => [0x283],
+        0x1AC => [0x1AD],
+        0x1AE => [0x288],
+        0x1AF => [0x1B0],
+        0x1B1 => [0x28A],
+        0x1B2 => [0x28B],
+        0x1B3 => [0x1B4],
+        0x1B5 => [0x1B6],
+        0x1B7 => [0x292],
+        0x1B8 => [0x1B9],
+        0x1BC => [0x1BD],
+        0x1C4 => [0x1C6],
+        0x1C5 => [0x1C6],
+        0x1C7 => [0x1C9],
+        0x1C8 => [0x1C9],
+        0x1CA => [0x1CC],
+        0x1CB => [0x1CC],
+        0x1CD => [0x1CE],
+        0x1CF => [0x1D0],
+        0x1D1 => [0x1D2],
+        0x1D3 => [0x1D4],
+        0x1D5 => [0x1D6],
+        0x1D7 => [0x1D8],
+        0x1D9 => [0x1DA],
+        0x1DB => [0x1DC],
+        0x1DE => [0x1DF],
+        0x1E0 => [0x1E1],
+        0x1E2 => [0x1E3],
+        0x1E4 => [0x1E5],
+        0x1E6 => [0x1E7],
+        0x1E8 => [0x1E9],
+        0x1EA => [0x1EB],
+        0x1EC => [0x1ED],
+        0x1EE => [0x1EF],
+        0x1F0 => [0x6A, 0x30C],
+        0x1F1 => [0x1F3],
+        0x1F2 => [0x1F3],
+        0x1F4 => [0x1F5],
+        0x1F6 => [0x195],
+        0x1F7 => [0x1BF],
+        0x1F8 => [0x1F9],
+        0x1FA => [0x1FB],
+        0x1FC => [0x1FD],
+        0x1FE => [0x1FF],
+        0x200 => [0x201],
+        0x202 => [0x203],
+        0x204 => [0x205],
+        0x206 => [0x207],
+        0x208 => [0x209],
+        0x20A => [0x20B],
+        0x20C => [0x20D],
+        0x20E => [0x20F],
+        0x210 => [0x211],
+        0x212 => [0x213],
+        0x214 => [0x215],
+        0x216 => [0x217],
+        0x218 => [0x219],
+        0x21A => [0x21B],
+        0x21C => [0x21D],
+        0x21E => [0x21F],
+        0x220 => [0x19E],
+        0x222 => [0x223],
+        0x224 => [0x225],
+        0x226 => [0x227],
+        0x228 => [0x229],
+        0x22A => [0x22B],
+        0x22C => [0x22D],
+        0x22E => [0x22F],
+        0x230 => [0x231],
+        0x232 => [0x233],
+        0x345 => [0x3B9],
+        0x37A => [0x20, 0x3B9],
+        0x386 => [0x3AC],
+        0x388 => [0x3AD],
+        0x389 => [0x3AE],
+        0x38A => [0x3AF],
+        0x38C => [0x3CC],
+        0x38E => [0x3CD],
+        0x38F => [0x3CE],
+        0x390 => [0x3B9, 0x308, 0x301],
+        0x391 => [0x3B1],
+        0x392 => [0x3B2],
+        0x393 => [0x3B3],
+        0x394 => [0x3B4],
+        0x395 => [0x3B5],
+        0x396 => [0x3B6],
+        0x397 => [0x3B7],
+        0x398 => [0x3B8],
+        0x399 => [0x3B9],
+        0x39A => [0x3BA],
+        0x39B => [0x3BB],
+        0x39C => [0x3BC],
+        0x39D => [0x3BD],
+        0x39E => [0x3BE],
+        0x39F => [0x3BF],
+        0x3A0 => [0x3C0],
+        0x3A1 => [0x3C1],
+        0x3A3 => [0x3C3],
+        0x3A4 => [0x3C4],
+        0x3A5 => [0x3C5],
+        0x3A6 => [0x3C6],
+        0x3A7 => [0x3C7],
+        0x3A8 => [0x3C8],
+        0x3A9 => [0x3C9],
+        0x3AA => [0x3CA],
+        0x3AB => [0x3CB],
+        0x3B0 => [0x3C5, 0x308, 0x301],
+        0x3C2 => [0x3C3],
+        0x3D0 => [0x3B2],
+        0x3D1 => [0x3B8],
+        0x3D2 => [0x3C5],
+        0x3D3 => [0x3CD],
+        0x3D4 => [0x3CB],
+        0x3D5 => [0x3C6],
+        0x3D6 => [0x3C0],
+        0x3D8 => [0x3D9],
+        0x3DA => [0x3DB],
+        0x3DC => [0x3DD],
+        0x3DE => [0x3DF],
+        0x3E0 => [0x3E1],
+        0x3E2 => [0x3E3],
+        0x3E4 => [0x3E5],
+        0x3E6 => [0x3E7],
+        0x3E8 => [0x3E9],
+        0x3EA => [0x3EB],
+        0x3EC => [0x3ED],
+        0x3EE => [0x3EF],
+        0x3F0 => [0x3BA],
+        0x3F1 => [0x3C1],
+        0x3F2 => [0x3C3],
+        0x3F4 => [0x3B8],
+        0x3F5 => [0x3B5],
+        0x400 => [0x450],
+        0x401 => [0x451],
+        0x402 => [0x452],
+        0x403 => [0x453],
+        0x404 => [0x454],
+        0x405 => [0x455],
+        0x406 => [0x456],
+        0x407 => [0x457],
+        0x408 => [0x458],
+        0x409 => [0x459],
+        0x40A => [0x45A],
+        0x40B => [0x45B],
+        0x40C => [0x45C],
+        0x40D => [0x45D],
+        0x40E => [0x45E],
+        0x40F => [0x45F],
+        0x410 => [0x430],
+        0x411 => [0x431],
+        0x412 => [0x432],
+        0x413 => [0x433],
+        0x414 => [0x434],
+        0x415 => [0x435],
+        0x416 => [0x436],
+        0x417 => [0x437],
+        0x418 => [0x438],
+        0x419 => [0x439],
+        0x41A => [0x43A],
+        0x41B => [0x43B],
+        0x41C => [0x43C],
+        0x41D => [0x43D],
+        0x41E => [0x43E],
+        0x41F => [0x43F],
+        0x420 => [0x440],
+        0x421 => [0x441],
+        0x422 => [0x442],
+        0x423 => [0x443],
+        0x424 => [0x444],
+        0x425 => [0x445],
+        0x426 => [0x446],
+        0x427 => [0x447],
+        0x428 => [0x448],
+        0x429 => [0x449],
+        0x42A => [0x44A],
+        0x42B => [0x44B],
+        0x42C => [0x44C],
+        0x42D => [0x44D],
+        0x42E => [0x44E],
+        0x42F => [0x44F],
+        0x460 => [0x461],
+        0x462 => [0x463],
+        0x464 => [0x465],
+        0x466 => [0x467],
+        0x468 => [0x469],
+        0x46A => [0x46B],
+        0x46C => [0x46D],
+        0x46E => [0x46F],
+        0x470 => [0x471],
+        0x472 => [0x473],
+        0x474 => [0x475],
+        0x476 => [0x477],
+        0x478 => [0x479],
+        0x47A => [0x47B],
+        0x47C => [0x47D],
+        0x47E => [0x47F],
+        0x480 => [0x481],
+        0x48A => [0x48B],
+        0x48C => [0x48D],
+        0x48E => [0x48F],
+        0x490 => [0x491],
+        0x492 => [0x493],
+        0x494 => [0x495],
+        0x496 => [0x497],
+        0x498 => [0x499],
+        0x49A => [0x49B],
+        0x49C => [0x49D],
+        0x49E => [0x49F],
+        0x4A0 => [0x4A1],
+        0x4A2 => [0x4A3],
+        0x4A4 => [0x4A5],
+        0x4A6 => [0x4A7],
+        0x4A8 => [0x4A9],
+        0x4AA => [0x4AB],
+        0x4AC => [0x4AD],
+        0x4AE => [0x4AF],
+        0x4B0 => [0x4B1],
+        0x4B2 => [0x4B3],
+        0x4B4 => [0x4B5],
+        0x4B6 => [0x4B7],
+        0x4B8 => [0x4B9],
+        0x4BA => [0x4BB],
+        0x4BC => [0x4BD],
+        0x4BE => [0x4BF],
+        0x4C1 => [0x4C2],
+        0x4C3 => [0x4C4],
+        0x4C5 => [0x4C6],
+        0x4C7 => [0x4C8],
+        0x4C9 => [0x4CA],
+        0x4CB => [0x4CC],
+        0x4CD => [0x4CE],
+        0x4D0 => [0x4D1],
+        0x4D2 => [0x4D3],
+        0x4D4 => [0x4D5],
+        0x4D6 => [0x4D7],
+        0x4D8 => [0x4D9],
+        0x4DA => [0x4DB],
+        0x4DC => [0x4DD],
+        0x4DE => [0x4DF],
+        0x4E0 => [0x4E1],
+        0x4E2 => [0x4E3],
+        0x4E4 => [0x4E5],
+        0x4E6 => [0x4E7],
+        0x4E8 => [0x4E9],
+        0x4EA => [0x4EB],
+        0x4EC => [0x4ED],
+        0x4EE => [0x4EF],
+        0x4F0 => [0x4F1],
+        0x4F2 => [0x4F3],
+        0x4F4 => [0x4F5],
+        0x4F8 => [0x4F9],
+        0x500 => [0x501],
+        0x502 => [0x503],
+        0x504 => [0x505],
+        0x506 => [0x507],
+        0x508 => [0x509],
+        0x50A => [0x50B],
+        0x50C => [0x50D],
+        0x50E => [0x50F],
+        0x531 => [0x561],
+        0x532 => [0x562],
+        0x533 => [0x563],
+        0x534 => [0x564],
+        0x535 => [0x565],
+        0x536 => [0x566],
+        0x537 => [0x567],
+        0x538 => [0x568],
+        0x539 => [0x569],
+        0x53A => [0x56A],
+        0x53B => [0x56B],
+        0x53C => [0x56C],
+        0x53D => [0x56D],
+        0x53E => [0x56E],
+        0x53F => [0x56F],
+        0x540 => [0x570],
+        0x541 => [0x571],
+        0x542 => [0x572],
+        0x543 => [0x573],
+        0x544 => [0x574],
+        0x545 => [0x575],
+        0x546 => [0x576],
+        0x547 => [0x577],
+        0x548 => [0x578],
+        0x549 => [0x579],
+        0x54A => [0x57A],
+        0x54B => [0x57B],
+        0x54C => [0x57C],
+        0x54D => [0x57D],
+        0x54E => [0x57E],
+        0x54F => [0x57F],
+        0x550 => [0x580],
+        0x551 => [0x581],
+        0x552 => [0x582],
+        0x553 => [0x583],
+        0x554 => [0x584],
+        0x555 => [0x585],
+        0x556 => [0x586],
+        0x587 => [0x565, 0x582],
+        0x1E00 => [0x1E01],
+        0x1E02 => [0x1E03],
+        0x1E04 => [0x1E05],
+        0x1E06 => [0x1E07],
+        0x1E08 => [0x1E09],
+        0x1E0A => [0x1E0B],
+        0x1E0C => [0x1E0D],
+        0x1E0E => [0x1E0F],
+        0x1E10 => [0x1E11],
+        0x1E12 => [0x1E13],
+        0x1E14 => [0x1E15],
+        0x1E16 => [0x1E17],
+        0x1E18 => [0x1E19],
+        0x1E1A => [0x1E1B],
+        0x1E1C => [0x1E1D],
+        0x1E1E => [0x1E1F],
+        0x1E20 => [0x1E21],
+        0x1E22 => [0x1E23],
+        0x1E24 => [0x1E25],
+        0x1E26 => [0x1E27],
+        0x1E28 => [0x1E29],
+        0x1E2A => [0x1E2B],
+        0x1E2C => [0x1E2D],
+        0x1E2E => [0x1E2F],
+        0x1E30 => [0x1E31],
+        0x1E32 => [0x1E33],
+        0x1E34 => [0x1E35],
+        0x1E36 => [0x1E37],
+        0x1E38 => [0x1E39],
+        0x1E3A => [0x1E3B],
+        0x1E3C => [0x1E3D],
+        0x1E3E => [0x1E3F],
+        0x1E40 => [0x1E41],
+        0x1E42 => [0x1E43],
+        0x1E44 => [0x1E45],
+        0x1E46 => [0x1E47],
+        0x1E48 => [0x1E49],
+        0x1E4A => [0x1E4B],
+        0x1E4C => [0x1E4D],
+        0x1E4E => [0x1E4F],
+        0x1E50 => [0x1E51],
+        0x1E52 => [0x1E53],
+        0x1E54 => [0x1E55],
+        0x1E56 => [0x1E57],
+        0x1E58 => [0x1E59],
+        0x1E5A => [0x1E5B],
+        0x1E5C => [0x1E5D],
+        0x1E5E => [0x1E5F],
+        0x1E60 => [0x1E61],
+        0x1E62 => [0x1E63],
+        0x1E64 => [0x1E65],
+        0x1E66 => [0x1E67],
+        0x1E68 => [0x1E69],
+        0x1E6A => [0x1E6B],
+        0x1E6C => [0x1E6D],
+        0x1E6E => [0x1E6F],
+        0x1E70 => [0x1E71],
+        0x1E72 => [0x1E73],
+        0x1E74 => [0x1E75],
+        0x1E76 => [0x1E77],
+        0x1E78 => [0x1E79],
+        0x1E7A => [0x1E7B],
+        0x1E7C => [0x1E7D],
+        0x1E7E => [0x1E7F],
+        0x1E80 => [0x1E81],
+        0x1E82 => [0x1E83],
+        0x1E84 => [0x1E85],
+        0x1E86 => [0x1E87],
+        0x1E88 => [0x1E89],
+        0x1E8A => [0x1E8B],
+        0x1E8C => [0x1E8D],
+        0x1E8E => [0x1E8F],
+        0x1E90 => [0x1E91],
+        0x1E92 => [0x1E93],
+        0x1E94 => [0x1E95],
+        0x1E96 => [0x68, 0x331],
+        0x1E97 => [0x74, 0x308],
+        0x1E98 => [0x77, 0x30A],
+        0x1E99 => [0x79, 0x30A],
+        0x1E9A => [0x61, 0x2BE],
+        0x1E9B => [0x1E61],
+        0x1EA0 => [0x1EA1],
+        0x1EA2 => [0x1EA3],
+        0x1EA4 => [0x1EA5],
+        0x1EA6 => [0x1EA7],
+        0x1EA8 => [0x1EA9],
+        0x1EAA => [0x1EAB],
+        0x1EAC => [0x1EAD],
+        0x1EAE => [0x1EAF],
+        0x1EB0 => [0x1EB1],
+        0x1EB2 => [0x1EB3],
+        0x1EB4 => [0x1EB5],
+        0x1EB6 => [0x1EB7],
+        0x1EB8 => [0x1EB9],
+        0x1EBA => [0x1EBB],
+        0x1EBC => [0x1EBD],
+        0x1EBE => [0x1EBF],
+        0x1EC0 => [0x1EC1],
+        0x1EC2 => [0x1EC3],
+        0x1EC4 => [0x1EC5],
+        0x1EC6 => [0x1EC7],
+        0x1EC8 => [0x1EC9],
+        0x1ECA => [0x1ECB],
+        0x1ECC => [0x1ECD],
+        0x1ECE => [0x1ECF],
+        0x1ED0 => [0x1ED1],
+        0x1ED2 => [0x1ED3],
+        0x1ED4 => [0x1ED5],
+        0x1ED6 => [0x1ED7],
+        0x1ED8 => [0x1ED9],
+        0x1EDA => [0x1EDB],
+        0x1EDC => [0x1EDD],
+        0x1EDE => [0x1EDF],
+        0x1EE0 => [0x1EE1],
+        0x1EE2 => [0x1EE3],
+        0x1EE4 => [0x1EE5],
+        0x1EE6 => [0x1EE7],
+        0x1EE8 => [0x1EE9],
+        0x1EEA => [0x1EEB],
+        0x1EEC => [0x1EED],
+        0x1EEE => [0x1EEF],
+        0x1EF0 => [0x1EF1],
+        0x1EF2 => [0x1EF3],
+        0x1EF4 => [0x1EF5],
+        0x1EF6 => [0x1EF7],
+        0x1EF8 => [0x1EF9],
+        0x1F08 => [0x1F00],
+        0x1F09 => [0x1F01],
+        0x1F0A => [0x1F02],
+        0x1F0B => [0x1F03],
+        0x1F0C => [0x1F04],
+        0x1F0D => [0x1F05],
+        0x1F0E => [0x1F06],
+        0x1F0F => [0x1F07],
+        0x1F18 => [0x1F10],
+        0x1F19 => [0x1F11],
+        0x1F1A => [0x1F12],
+        0x1F1B => [0x1F13],
+        0x1F1C => [0x1F14],
+        0x1F1D => [0x1F15],
+        0x1F28 => [0x1F20],
+        0x1F29 => [0x1F21],
+        0x1F2A => [0x1F22],
+        0x1F2B => [0x1F23],
+        0x1F2C => [0x1F24],
+        0x1F2D => [0x1F25],
+        0x1F2E => [0x1F26],
+        0x1F2F => [0x1F27],
+        0x1F38 => [0x1F30],
+        0x1F39 => [0x1F31],
+        0x1F3A => [0x1F32],
+        0x1F3B => [0x1F33],
+        0x1F3C => [0x1F34],
+        0x1F3D => [0x1F35],
+        0x1F3E => [0x1F36],
+        0x1F3F => [0x1F37],
+        0x1F48 => [0x1F40],
+        0x1F49 => [0x1F41],
+        0x1F4A => [0x1F42],
+        0x1F4B => [0x1F43],
+        0x1F4C => [0x1F44],
+        0x1F4D => [0x1F45],
+        0x1F50 => [0x3C5, 0x313],
+        0x1F52 => [0x3C5, 0x313, 0x300],
+        0x1F54 => [0x3C5, 0x313, 0x301],
+        0x1F56 => [0x3C5, 0x313, 0x342],
+        0x1F59 => [0x1F51],
+        0x1F5B => [0x1F53],
+        0x1F5D => [0x1F55],
+        0x1F5F => [0x1F57],
+        0x1F68 => [0x1F60],
+        0x1F69 => [0x1F61],
+        0x1F6A => [0x1F62],
+        0x1F6B => [0x1F63],
+        0x1F6C => [0x1F64],
+        0x1F6D => [0x1F65],
+        0x1F6E => [0x1F66],
+        0x1F6F => [0x1F67],
+        0x1F80 => [0x1F00, 0x3B9],
+        0x1F81 => [0x1F01, 0x3B9],
+        0x1F82 => [0x1F02, 0x3B9],
+        0x1F83 => [0x1F03, 0x3B9],
+        0x1F84 => [0x1F04, 0x3B9],
+        0x1F85 => [0x1F05, 0x3B9],
+        0x1F86 => [0x1F06, 0x3B9],
+        0x1F87 => [0x1F07, 0x3B9],
+        0x1F88 => [0x1F00, 0x3B9],
+        0x1F89 => [0x1F01, 0x3B9],
+        0x1F8A => [0x1F02, 0x3B9],
+        0x1F8B => [0x1F03, 0x3B9],
+        0x1F8C => [0x1F04, 0x3B9],
+        0x1F8D => [0x1F05, 0x3B9],
+        0x1F8E => [0x1F06, 0x3B9],
+        0x1F8F => [0x1F07, 0x3B9],
+        0x1F90 => [0x1F20, 0x3B9],
+        0x1F91 => [0x1F21, 0x3B9],
+        0x1F92 => [0x1F22, 0x3B9],
+        0x1F93 => [0x1F23, 0x3B9],
+        0x1F94 => [0x1F24, 0x3B9],
+        0x1F95 => [0x1F25, 0x3B9],
+        0x1F96 => [0x1F26, 0x3B9],
+        0x1F97 => [0x1F27, 0x3B9],
+        0x1F98 => [0x1F20, 0x3B9],
+        0x1F99 => [0x1F21, 0x3B9],
+        0x1F9A => [0x1F22, 0x3B9],
+        0x1F9B => [0x1F23, 0x3B9],
+        0x1F9C => [0x1F24, 0x3B9],
+        0x1F9D => [0x1F25, 0x3B9],
+        0x1F9E => [0x1F26, 0x3B9],
+        0x1F9F => [0x1F27, 0x3B9],
+        0x1FA0 => [0x1F60, 0x3B9],
+        0x1FA1 => [0x1F61, 0x3B9],
+        0x1FA2 => [0x1F62, 0x3B9],
+        0x1FA3 => [0x1F63, 0x3B9],
+        0x1FA4 => [0x1F64, 0x3B9],
+        0x1FA5 => [0x1F65, 0x3B9],
+        0x1FA6 => [0x1F66, 0x3B9],
+        0x1FA7 => [0x1F67, 0x3B9],
+        0x1FA8 => [0x1F60, 0x3B9],
+        0x1FA9 => [0x1F61, 0x3B9],
+        0x1FAA => [0x1F62, 0x3B9],
+        0x1FAB => [0x1F63, 0x3B9],
+        0x1FAC => [0x1F64, 0x3B9],
+        0x1FAD => [0x1F65, 0x3B9],
+        0x1FAE => [0x1F66, 0x3B9],
+        0x1FAF => [0x1F67, 0x3B9],
+        0x1FB2 => [0x1F70, 0x3B9],
+        0x1FB3 => [0x3B1, 0x3B9],
+        0x1FB4 => [0x3AC, 0x3B9],
+        0x1FB6 => [0x3B1, 0x342],
+        0x1FB7 => [0x3B1, 0x342, 0x3B9],
+        0x1FB8 => [0x1FB0],
+        0x1FB9 => [0x1FB1],
+        0x1FBA => [0x1F70],
+        0x1FBB => [0x1F71],
+        0x1FBC => [0x3B1, 0x3B9],
+        0x1FBE => [0x3B9],
+        0x1FC2 => [0x1F74, 0x3B9],
+        0x1FC3 => [0x3B7, 0x3B9],
+        0x1FC4 => [0x3AE, 0x3B9],
+        0x1FC6 => [0x3B7, 0x342],
+        0x1FC7 => [0x3B7, 0x342, 0x3B9],
+        0x1FC8 => [0x1F72],
+        0x1FC9 => [0x1F73],
+        0x1FCA => [0x1F74],
+        0x1FCB => [0x1F75],
+        0x1FCC => [0x3B7, 0x3B9],
+        0x1FD2 => [0x3B9, 0x308, 0x300],
+        0x1FD3 => [0x3B9, 0x308, 0x301],
+        0x1FD6 => [0x3B9, 0x342],
+        0x1FD7 => [0x3B9, 0x308, 0x342],
+        0x1FD8 => [0x1FD0],
+        0x1FD9 => [0x1FD1],
+        0x1FDA => [0x1F76],
+        0x1FDB => [0x1F77],
+        0x1FE2 => [0x3C5, 0x308, 0x300],
+        0x1FE3 => [0x3C5, 0x308, 0x301],
+        0x1FE4 => [0x3C1, 0x313],
+        0x1FE6 => [0x3C5, 0x342],
+        0x1FE7 => [0x3C5, 0x308, 0x342],
+        0x1FE8 => [0x1FE0],
+        0x1FE9 => [0x1FE1],
+        0x1FEA => [0x1F7A],
+        0x1FEB => [0x1F7B],
+        0x1FEC => [0x1FE5],
+        0x1FF2 => [0x1F7C, 0x3B9],
+        0x1FF3 => [0x3C9, 0x3B9],
+        0x1FF4 => [0x3CE, 0x3B9],
+        0x1FF6 => [0x3C9, 0x342],
+        0x1FF7 => [0x3C9, 0x342, 0x3B9],
+        0x1FF8 => [0x1F78],
+        0x1FF9 => [0x1F79],
+        0x1FFA => [0x1F7C],
+        0x1FFB => [0x1F7D],
+        0x1FFC => [0x3C9, 0x3B9],
+        0x20A8 => [0x72, 0x73],
+        0x2102 => [0x63],
+        0x2103 => [0xB0, 0x63],
+        0x2107 => [0x25B],
+        0x2109 => [0xB0, 0x66],
+        0x210B => [0x68],
+        0x210C => [0x68],
+        0x210D => [0x68],
+        0x2110 => [0x69],
+        0x2111 => [0x69],
+        0x2112 => [0x6C],
+        0x2115 => [0x6E],
+        0x2116 => [0x6E, 0x6F],
+        0x2119 => [0x70],
+        0x211A => [0x71],
+        0x211B => [0x72],
+        0x211C => [0x72],
+        0x211D => [0x72],
+        0x2120 => [0x73, 0x6D],
+        0x2121 => [0x74, 0x65, 0x6C],
+        0x2122 => [0x74, 0x6D],
+        0x2124 => [0x7A],
+        0x2126 => [0x3C9],
+        0x2128 => [0x7A],
+        0x212A => [0x6B],
+        0x212B => [0xE5],
+        0x212C => [0x62],
+        0x212D => [0x63],
+        0x2130 => [0x65],
+        0x2131 => [0x66],
+        0x2133 => [0x6D],
+        0x213E => [0x3B3],
+        0x213F => [0x3C0],
+        0x2145 => [0x64],
+        0x2160 => [0x2170],
+        0x2161 => [0x2171],
+        0x2162 => [0x2172],
+        0x2163 => [0x2173],
+        0x2164 => [0x2174],
+        0x2165 => [0x2175],
+        0x2166 => [0x2176],
+        0x2167 => [0x2177],
+        0x2168 => [0x2178],
+        0x2169 => [0x2179],
+        0x216A => [0x217A],
+        0x216B => [0x217B],
+        0x216C => [0x217C],
+        0x216D => [0x217D],
+        0x216E => [0x217E],
+        0x216F => [0x217F],
+        0x24B6 => [0x24D0],
+        0x24B7 => [0x24D1],
+        0x24B8 => [0x24D2],
+        0x24B9 => [0x24D3],
+        0x24BA => [0x24D4],
+        0x24BB => [0x24D5],
+        0x24BC => [0x24D6],
+        0x24BD => [0x24D7],
+        0x24BE => [0x24D8],
+        0x24BF => [0x24D9],
+        0x24C0 => [0x24DA],
+        0x24C1 => [0x24DB],
+        0x24C2 => [0x24DC],
+        0x24C3 => [0x24DD],
+        0x24C4 => [0x24DE],
+        0x24C5 => [0x24DF],
+        0x24C6 => [0x24E0],
+        0x24C7 => [0x24E1],
+        0x24C8 => [0x24E2],
+        0x24C9 => [0x24E3],
+        0x24CA => [0x24E4],
+        0x24CB => [0x24E5],
+        0x24CC => [0x24E6],
+        0x24CD => [0x24E7],
+        0x24CE => [0x24E8],
+        0x24CF => [0x24E9],
+        0x3371 => [0x68, 0x70, 0x61],
+        0x3373 => [0x61, 0x75],
+        0x3375 => [0x6F, 0x76],
+        0x3380 => [0x70, 0x61],
+        0x3381 => [0x6E, 0x61],
+        0x3382 => [0x3BC, 0x61],
+        0x3383 => [0x6D, 0x61],
+        0x3384 => [0x6B, 0x61],
+        0x3385 => [0x6B, 0x62],
+        0x3386 => [0x6D, 0x62],
+        0x3387 => [0x67, 0x62],
+        0x338A => [0x70, 0x66],
+        0x338B => [0x6E, 0x66],
+        0x338C => [0x3BC, 0x66],
+        0x3390 => [0x68, 0x7A],
+        0x3391 => [0x6B, 0x68, 0x7A],
+        0x3392 => [0x6D, 0x68, 0x7A],
+        0x3393 => [0x67, 0x68, 0x7A],
+        0x3394 => [0x74, 0x68, 0x7A],
+        0x33A9 => [0x70, 0x61],
+        0x33AA => [0x6B, 0x70, 0x61],
+        0x33AB => [0x6D, 0x70, 0x61],
+        0x33AC => [0x67, 0x70, 0x61],
+        0x33B4 => [0x70, 0x76],
+        0x33B5 => [0x6E, 0x76],
+        0x33B6 => [0x3BC, 0x76],
+        0x33B7 => [0x6D, 0x76],
+        0x33B8 => [0x6B, 0x76],
+        0x33B9 => [0x6D, 0x76],
+        0x33BA => [0x70, 0x77],
+        0x33BB => [0x6E, 0x77],
+        0x33BC => [0x3BC, 0x77],
+        0x33BD => [0x6D, 0x77],
+        0x33BE => [0x6B, 0x77],
+        0x33BF => [0x6D, 0x77],
+        0x33C0 => [0x6B, 0x3C9],
+        0x33C1 => [0x6D, 0x3C9],
+        /* 0x33C2  => [0x61, 0x2E, 0x6D, 0x2E], */
+        0x33C3 => [0x62, 0x71],
+        0x33C6 => [0x63, 0x2215, 0x6B, 0x67],
+        0x33C7 => [0x63, 0x6F, 0x2E],
+        0x33C8 => [0x64, 0x62],
+        0x33C9 => [0x67, 0x79],
+        0x33CB => [0x68, 0x70],
+        0x33CD => [0x6B, 0x6B],
+        0x33CE => [0x6B, 0x6D],
+        0x33D7 => [0x70, 0x68],
+        0x33D9 => [0x70, 0x70, 0x6D],
+        0x33DA => [0x70, 0x72],
+        0x33DC => [0x73, 0x76],
+        0x33DD => [0x77, 0x62],
+        0xFB00 => [0x66, 0x66],
+        0xFB01 => [0x66, 0x69],
+        0xFB02 => [0x66, 0x6C],
+        0xFB03 => [0x66, 0x66, 0x69],
+        0xFB04 => [0x66, 0x66, 0x6C],
+        0xFB05 => [0x73, 0x74],
+        0xFB06 => [0x73, 0x74],
+        0xFB13 => [0x574, 0x576],
+        0xFB14 => [0x574, 0x565],
+        0xFB15 => [0x574, 0x56B],
+        0xFB16 => [0x57E, 0x576],
+        0xFB17 => [0x574, 0x56D],
+        0xFF21 => [0xFF41],
+        0xFF22 => [0xFF42],
+        0xFF23 => [0xFF43],
+        0xFF24 => [0xFF44],
+        0xFF25 => [0xFF45],
+        0xFF26 => [0xFF46],
+        0xFF27 => [0xFF47],
+        0xFF28 => [0xFF48],
+        0xFF29 => [0xFF49],
+        0xFF2A => [0xFF4A],
+        0xFF2B => [0xFF4B],
+        0xFF2C => [0xFF4C],
+        0xFF2D => [0xFF4D],
+        0xFF2E => [0xFF4E],
+        0xFF2F => [0xFF4F],
+        0xFF30 => [0xFF50],
+        0xFF31 => [0xFF51],
+        0xFF32 => [0xFF52],
+        0xFF33 => [0xFF53],
+        0xFF34 => [0xFF54],
+        0xFF35 => [0xFF55],
+        0xFF36 => [0xFF56],
+        0xFF37 => [0xFF57],
+        0xFF38 => [0xFF58],
+        0xFF39 => [0xFF59],
+        0xFF3A => [0xFF5A],
+        0x10400 => [0x10428],
+        0x10401 => [0x10429],
+        0x10402 => [0x1042A],
+        0x10403 => [0x1042B],
+        0x10404 => [0x1042C],
+        0x10405 => [0x1042D],
+        0x10406 => [0x1042E],
+        0x10407 => [0x1042F],
+        0x10408 => [0x10430],
+        0x10409 => [0x10431],
+        0x1040A => [0x10432],
+        0x1040B => [0x10433],
+        0x1040C => [0x10434],
+        0x1040D => [0x10435],
+        0x1040E => [0x10436],
+        0x1040F => [0x10437],
+        0x10410 => [0x10438],
+        0x10411 => [0x10439],
+        0x10412 => [0x1043A],
+        0x10413 => [0x1043B],
+        0x10414 => [0x1043C],
+        0x10415 => [0x1043D],
+        0x10416 => [0x1043E],
+        0x10417 => [0x1043F],
+        0x10418 => [0x10440],
+        0x10419 => [0x10441],
+        0x1041A => [0x10442],
+        0x1041B => [0x10443],
+        0x1041C => [0x10444],
+        0x1041D => [0x10445],
+        0x1041E => [0x10446],
+        0x1041F => [0x10447],
+        0x10420 => [0x10448],
+        0x10421 => [0x10449],
+        0x10422 => [0x1044A],
+        0x10423 => [0x1044B],
+        0x10424 => [0x1044C],
+        0x10425 => [0x1044D],
+        0x1D400 => [0x61],
+        0x1D401 => [0x62],
+        0x1D402 => [0x63],
+        0x1D403 => [0x64],
+        0x1D404 => [0x65],
+        0x1D405 => [0x66],
+        0x1D406 => [0x67],
+        0x1D407 => [0x68],
+        0x1D408 => [0x69],
+        0x1D409 => [0x6A],
+        0x1D40A => [0x6B],
+        0x1D40B => [0x6C],
+        0x1D40C => [0x6D],
+        0x1D40D => [0x6E],
+        0x1D40E => [0x6F],
+        0x1D40F => [0x70],
+        0x1D410 => [0x71],
+        0x1D411 => [0x72],
+        0x1D412 => [0x73],
+        0x1D413 => [0x74],
+        0x1D414 => [0x75],
+        0x1D415 => [0x76],
+        0x1D416 => [0x77],
+        0x1D417 => [0x78],
+        0x1D418 => [0x79],
+        0x1D419 => [0x7A],
+        0x1D434 => [0x61],
+        0x1D435 => [0x62],
+        0x1D436 => [0x63],
+        0x1D437 => [0x64],
+        0x1D438 => [0x65],
+        0x1D439 => [0x66],
+        0x1D43A => [0x67],
+        0x1D43B => [0x68],
+        0x1D43C => [0x69],
+        0x1D43D => [0x6A],
+        0x1D43E => [0x6B],
+        0x1D43F => [0x6C],
+        0x1D440 => [0x6D],
+        0x1D441 => [0x6E],
+        0x1D442 => [0x6F],
+        0x1D443 => [0x70],
+        0x1D444 => [0x71],
+        0x1D445 => [0x72],
+        0x1D446 => [0x73],
+        0x1D447 => [0x74],
+        0x1D448 => [0x75],
+        0x1D449 => [0x76],
+        0x1D44A => [0x77],
+        0x1D44B => [0x78],
+        0x1D44C => [0x79],
+        0x1D44D => [0x7A],
+        0x1D468 => [0x61],
+        0x1D469 => [0x62],
+        0x1D46A => [0x63],
+        0x1D46B => [0x64],
+        0x1D46C => [0x65],
+        0x1D46D => [0x66],
+        0x1D46E => [0x67],
+        0x1D46F => [0x68],
+        0x1D470 => [0x69],
+        0x1D471 => [0x6A],
+        0x1D472 => [0x6B],
+        0x1D473 => [0x6C],
+        0x1D474 => [0x6D],
+        0x1D475 => [0x6E],
+        0x1D476 => [0x6F],
+        0x1D477 => [0x70],
+        0x1D478 => [0x71],
+        0x1D479 => [0x72],
+        0x1D47A => [0x73],
+        0x1D47B => [0x74],
+        0x1D47C => [0x75],
+        0x1D47D => [0x76],
+        0x1D47E => [0x77],
+        0x1D47F => [0x78],
+        0x1D480 => [0x79],
+        0x1D481 => [0x7A],
+        0x1D49C => [0x61],
+        0x1D49E => [0x63],
+        0x1D49F => [0x64],
+        0x1D4A2 => [0x67],
+        0x1D4A5 => [0x6A],
+        0x1D4A6 => [0x6B],
+        0x1D4A9 => [0x6E],
+        0x1D4AA => [0x6F],
+        0x1D4AB => [0x70],
+        0x1D4AC => [0x71],
+        0x1D4AE => [0x73],
+        0x1D4AF => [0x74],
+        0x1D4B0 => [0x75],
+        0x1D4B1 => [0x76],
+        0x1D4B2 => [0x77],
+        0x1D4B3 => [0x78],
+        0x1D4B4 => [0x79],
+        0x1D4B5 => [0x7A],
+        0x1D4D0 => [0x61],
+        0x1D4D1 => [0x62],
+        0x1D4D2 => [0x63],
+        0x1D4D3 => [0x64],
+        0x1D4D4 => [0x65],
+        0x1D4D5 => [0x66],
+        0x1D4D6 => [0x67],
+        0x1D4D7 => [0x68],
+        0x1D4D8 => [0x69],
+        0x1D4D9 => [0x6A],
+        0x1D4DA => [0x6B],
+        0x1D4DB => [0x6C],
+        0x1D4DC => [0x6D],
+        0x1D4DD => [0x6E],
+        0x1D4DE => [0x6F],
+        0x1D4DF => [0x70],
+        0x1D4E0 => [0x71],
+        0x1D4E1 => [0x72],
+        0x1D4E2 => [0x73],
+        0x1D4E3 => [0x74],
+        0x1D4E4 => [0x75],
+        0x1D4E5 => [0x76],
+        0x1D4E6 => [0x77],
+        0x1D4E7 => [0x78],
+        0x1D4E8 => [0x79],
+        0x1D4E9 => [0x7A],
+        0x1D504 => [0x61],
+        0x1D505 => [0x62],
+        0x1D507 => [0x64],
+        0x1D508 => [0x65],
+        0x1D509 => [0x66],
+        0x1D50A => [0x67],
+        0x1D50D => [0x6A],
+        0x1D50E => [0x6B],
+        0x1D50F => [0x6C],
+        0x1D510 => [0x6D],
+        0x1D511 => [0x6E],
+        0x1D512 => [0x6F],
+        0x1D513 => [0x70],
+        0x1D514 => [0x71],
+        0x1D516 => [0x73],
+        0x1D517 => [0x74],
+        0x1D518 => [0x75],
+        0x1D519 => [0x76],
+        0x1D51A => [0x77],
+        0x1D51B => [0x78],
+        0x1D51C => [0x79],
+        0x1D538 => [0x61],
+        0x1D539 => [0x62],
+        0x1D53B => [0x64],
+        0x1D53C => [0x65],
+        0x1D53D => [0x66],
+        0x1D53E => [0x67],
+        0x1D540 => [0x69],
+        0x1D541 => [0x6A],
+        0x1D542 => [0x6B],
+        0x1D543 => [0x6C],
+        0x1D544 => [0x6D],
+        0x1D546 => [0x6F],
+        0x1D54A => [0x73],
+        0x1D54B => [0x74],
+        0x1D54C => [0x75],
+        0x1D54D => [0x76],
+        0x1D54E => [0x77],
+        0x1D54F => [0x78],
+        0x1D550 => [0x79],
+        0x1D56C => [0x61],
+        0x1D56D => [0x62],
+        0x1D56E => [0x63],
+        0x1D56F => [0x64],
+        0x1D570 => [0x65],
+        0x1D571 => [0x66],
+        0x1D572 => [0x67],
+        0x1D573 => [0x68],
+        0x1D574 => [0x69],
+        0x1D575 => [0x6A],
+        0x1D576 => [0x6B],
+        0x1D577 => [0x6C],
+        0x1D578 => [0x6D],
+        0x1D579 => [0x6E],
+        0x1D57A => [0x6F],
+        0x1D57B => [0x70],
+        0x1D57C => [0x71],
+        0x1D57D => [0x72],
+        0x1D57E => [0x73],
+        0x1D57F => [0x74],
+        0x1D580 => [0x75],
+        0x1D581 => [0x76],
+        0x1D582 => [0x77],
+        0x1D583 => [0x78],
+        0x1D584 => [0x79],
+        0x1D585 => [0x7A],
+        0x1D5A0 => [0x61],
+        0x1D5A1 => [0x62],
+        0x1D5A2 => [0x63],
+        0x1D5A3 => [0x64],
+        0x1D5A4 => [0x65],
+        0x1D5A5 => [0x66],
+        0x1D5A6 => [0x67],
+        0x1D5A7 => [0x68],
+        0x1D5A8 => [0x69],
+        0x1D5A9 => [0x6A],
+        0x1D5AA => [0x6B],
+        0x1D5AB => [0x6C],
+        0x1D5AC => [0x6D],
+        0x1D5AD => [0x6E],
+        0x1D5AE => [0x6F],
+        0x1D5AF => [0x70],
+        0x1D5B0 => [0x71],
+        0x1D5B1 => [0x72],
+        0x1D5B2 => [0x73],
+        0x1D5B3 => [0x74],
+        0x1D5B4 => [0x75],
+        0x1D5B5 => [0x76],
+        0x1D5B6 => [0x77],
+        0x1D5B7 => [0x78],
+        0x1D5B8 => [0x79],
+        0x1D5B9 => [0x7A],
+        0x1D5D4 => [0x61],
+        0x1D5D5 => [0x62],
+        0x1D5D6 => [0x63],
+        0x1D5D7 => [0x64],
+        0x1D5D8 => [0x65],
+        0x1D5D9 => [0x66],
+        0x1D5DA => [0x67],
+        0x1D5DB => [0x68],
+        0x1D5DC => [0x69],
+        0x1D5DD => [0x6A],
+        0x1D5DE => [0x6B],
+        0x1D5DF => [0x6C],
+        0x1D5E0 => [0x6D],
+        0x1D5E1 => [0x6E],
+        0x1D5E2 => [0x6F],
+        0x1D5E3 => [0x70],
+        0x1D5E4 => [0x71],
+        0x1D5E5 => [0x72],
+        0x1D5E6 => [0x73],
+        0x1D5E7 => [0x74],
+        0x1D5E8 => [0x75],
+        0x1D5E9 => [0x76],
+        0x1D5EA => [0x77],
+        0x1D5EB => [0x78],
+        0x1D5EC => [0x79],
+        0x1D5ED => [0x7A],
+        0x1D608 => [0x61],
+        0x1D609 => [0x62],
+        0x1D60A => [0x63],
+        0x1D60B => [0x64],
+        0x1D60C => [0x65],
+        0x1D60D => [0x66],
+        0x1D60E => [0x67],
+        0x1D60F => [0x68],
+        0x1D610 => [0x69],
+        0x1D611 => [0x6A],
+        0x1D612 => [0x6B],
+        0x1D613 => [0x6C],
+        0x1D614 => [0x6D],
+        0x1D615 => [0x6E],
+        0x1D616 => [0x6F],
+        0x1D617 => [0x70],
+        0x1D618 => [0x71],
+        0x1D619 => [0x72],
+        0x1D61A => [0x73],
+        0x1D61B => [0x74],
+        0x1D61C => [0x75],
+        0x1D61D => [0x76],
+        0x1D61E => [0x77],
+        0x1D61F => [0x78],
+        0x1D620 => [0x79],
+        0x1D621 => [0x7A],
+        0x1D63C => [0x61],
+        0x1D63D => [0x62],
+        0x1D63E => [0x63],
+        0x1D63F => [0x64],
+        0x1D640 => [0x65],
+        0x1D641 => [0x66],
+        0x1D642 => [0x67],
+        0x1D643 => [0x68],
+        0x1D644 => [0x69],
+        0x1D645 => [0x6A],
+        0x1D646 => [0x6B],
+        0x1D647 => [0x6C],
+        0x1D648 => [0x6D],
+        0x1D649 => [0x6E],
+        0x1D64A => [0x6F],
+        0x1D64B => [0x70],
+        0x1D64C => [0x71],
+        0x1D64D => [0x72],
+        0x1D64E => [0x73],
+        0x1D64F => [0x74],
+        0x1D650 => [0x75],
+        0x1D651 => [0x76],
+        0x1D652 => [0x77],
+        0x1D653 => [0x78],
+        0x1D654 => [0x79],
+        0x1D655 => [0x7A],
+        0x1D670 => [0x61],
+        0x1D671 => [0x62],
+        0x1D672 => [0x63],
+        0x1D673 => [0x64],
+        0x1D674 => [0x65],
+        0x1D675 => [0x66],
+        0x1D676 => [0x67],
+        0x1D677 => [0x68],
+        0x1D678 => [0x69],
+        0x1D679 => [0x6A],
+        0x1D67A => [0x6B],
+        0x1D67B => [0x6C],
+        0x1D67C => [0x6D],
+        0x1D67D => [0x6E],
+        0x1D67E => [0x6F],
+        0x1D67F => [0x70],
+        0x1D680 => [0x71],
+        0x1D681 => [0x72],
+        0x1D682 => [0x73],
+        0x1D683 => [0x74],
+        0x1D684 => [0x75],
+        0x1D685 => [0x76],
+        0x1D686 => [0x77],
+        0x1D687 => [0x78],
+        0x1D688 => [0x79],
+        0x1D689 => [0x7A],
+        0x1D6A8 => [0x3B1],
+        0x1D6A9 => [0x3B2],
+        0x1D6AA => [0x3B3],
+        0x1D6AB => [0x3B4],
+        0x1D6AC => [0x3B5],
+        0x1D6AD => [0x3B6],
+        0x1D6AE => [0x3B7],
+        0x1D6AF => [0x3B8],
+        0x1D6B0 => [0x3B9],
+        0x1D6B1 => [0x3BA],
+        0x1D6B2 => [0x3BB],
+        0x1D6B3 => [0x3BC],
+        0x1D6B4 => [0x3BD],
+        0x1D6B5 => [0x3BE],
+        0x1D6B6 => [0x3BF],
+        0x1D6B7 => [0x3C0],
+        0x1D6B8 => [0x3C1],
+        0x1D6B9 => [0x3B8],
+        0x1D6BA => [0x3C3],
+        0x1D6BB => [0x3C4],
+        0x1D6BC => [0x3C5],
+        0x1D6BD => [0x3C6],
+        0x1D6BE => [0x3C7],
+        0x1D6BF => [0x3C8],
+        0x1D6C0 => [0x3C9],
+        0x1D6D3 => [0x3C3],
+        0x1D6E2 => [0x3B1],
+        0x1D6E3 => [0x3B2],
+        0x1D6E4 => [0x3B3],
+        0x1D6E5 => [0x3B4],
+        0x1D6E6 => [0x3B5],
+        0x1D6E7 => [0x3B6],
+        0x1D6E8 => [0x3B7],
+        0x1D6E9 => [0x3B8],
+        0x1D6EA => [0x3B9],
+        0x1D6EB => [0x3BA],
+        0x1D6EC => [0x3BB],
+        0x1D6ED => [0x3BC],
+        0x1D6EE => [0x3BD],
+        0x1D6EF => [0x3BE],
+        0x1D6F0 => [0x3BF],
+        0x1D6F1 => [0x3C0],
+        0x1D6F2 => [0x3C1],
+        0x1D6F3 => [0x3B8],
+        0x1D6F4 => [0x3C3],
+        0x1D6F5 => [0x3C4],
+        0x1D6F6 => [0x3C5],
+        0x1D6F7 => [0x3C6],
+        0x1D6F8 => [0x3C7],
+        0x1D6F9 => [0x3C8],
+        0x1D6FA => [0x3C9],
+        0x1D70D => [0x3C3],
+        0x1D71C => [0x3B1],
+        0x1D71D => [0x3B2],
+        0x1D71E => [0x3B3],
+        0x1D71F => [0x3B4],
+        0x1D720 => [0x3B5],
+        0x1D721 => [0x3B6],
+        0x1D722 => [0x3B7],
+        0x1D723 => [0x3B8],
+        0x1D724 => [0x3B9],
+        0x1D725 => [0x3BA],
+        0x1D726 => [0x3BB],
+        0x1D727 => [0x3BC],
+        0x1D728 => [0x3BD],
+        0x1D729 => [0x3BE],
+        0x1D72A => [0x3BF],
+        0x1D72B => [0x3C0],
+        0x1D72C => [0x3C1],
+        0x1D72D => [0x3B8],
+        0x1D72E => [0x3C3],
+        0x1D72F => [0x3C4],
+        0x1D730 => [0x3C5],
+        0x1D731 => [0x3C6],
+        0x1D732 => [0x3C7],
+        0x1D733 => [0x3C8],
+        0x1D734 => [0x3C9],
+        0x1D747 => [0x3C3],
+        0x1D756 => [0x3B1],
+        0x1D757 => [0x3B2],
+        0x1D758 => [0x3B3],
+        0x1D759 => [0x3B4],
+        0x1D75A => [0x3B5],
+        0x1D75B => [0x3B6],
+        0x1D75C => [0x3B7],
+        0x1D75D => [0x3B8],
+        0x1D75E => [0x3B9],
+        0x1D75F => [0x3BA],
+        0x1D760 => [0x3BB],
+        0x1D761 => [0x3BC],
+        0x1D762 => [0x3BD],
+        0x1D763 => [0x3BE],
+        0x1D764 => [0x3BF],
+        0x1D765 => [0x3C0],
+        0x1D766 => [0x3C1],
+        0x1D767 => [0x3B8],
+        0x1D768 => [0x3C3],
+        0x1D769 => [0x3C4],
+        0x1D76A => [0x3C5],
+        0x1D76B => [0x3C6],
+        0x1D76C => [0x3C7],
+        0x1D76D => [0x3C8],
+        0x1D76E => [0x3C9],
+        0x1D781 => [0x3C3],
+        0x1D790 => [0x3B1],
+        0x1D791 => [0x3B2],
+        0x1D792 => [0x3B3],
+        0x1D793 => [0x3B4],
+        0x1D794 => [0x3B5],
+        0x1D795 => [0x3B6],
+        0x1D796 => [0x3B7],
+        0x1D797 => [0x3B8],
+        0x1D798 => [0x3B9],
+        0x1D799 => [0x3BA],
+        0x1D79A => [0x3BB],
+        0x1D79B => [0x3BC],
+        0x1D79C => [0x3BD],
+        0x1D79D => [0x3BE],
+        0x1D79E => [0x3BF],
+        0x1D79F => [0x3C0],
+        0x1D7A0 => [0x3C1],
+        0x1D7A1 => [0x3B8],
+        0x1D7A2 => [0x3C3],
+        0x1D7A3 => [0x3C4],
+        0x1D7A4 => [0x3C5],
+        0x1D7A5 => [0x3C6],
+        0x1D7A6 => [0x3C7],
+        0x1D7A7 => [0x3C8],
+        0x1D7A8 => [0x3C9],
+        0x1D7BB => [0x3C3],
+        0x3F9 => [0x3C3],
+        0x1D2C => [0x61],
+        0x1D2D => [0xE6],
+        0x1D2E => [0x62],
+        0x1D30 => [0x64],
+        0x1D31 => [0x65],
+        0x1D32 => [0x1DD],
+        0x1D33 => [0x67],
+        0x1D34 => [0x68],
+        0x1D35 => [0x69],
+        0x1D36 => [0x6A],
+        0x1D37 => [0x6B],
+        0x1D38 => [0x6C],
+        0x1D39 => [0x6D],
+        0x1D3A => [0x6E],
+        0x1D3C => [0x6F],
+        0x1D3D => [0x223],
+        0x1D3E => [0x70],
+        0x1D3F => [0x72],
+        0x1D40 => [0x74],
+        0x1D41 => [0x75],
+        0x1D42 => [0x77],
+        0x213B => [0x66, 0x61, 0x78],
+        0x3250 => [0x70, 0x74, 0x65],
+        0x32CC => [0x68, 0x67],
+        0x32CE => [0x65, 0x76],
+        0x32CF => [0x6C, 0x74, 0x64],
+        0x337A => [0x69, 0x75],
+        0x33DE => [0x76, 0x2215, 0x6D],
+        0x33DF => [0x61, 0x2215, 0x6D]
+    ];
+
+    /**
+     * Normalization Combining Classes; Code Points not listed
+     * got Combining Class 0.
+     *
+     * @static
+     * @var array
+     * @access private
+     */
+    private static $_np_norm_combcls = [
+        0x334 => 1,
+        0x335 => 1,
+        0x336 => 1,
+        0x337 => 1,
+        0x338 => 1,
+        0x93C => 7,
+        0x9BC => 7,
+        0xA3C => 7,
+        0xABC => 7,
+        0xB3C => 7,
+        0xCBC => 7,
+        0x1037 => 7,
+        0x3099 => 8,
+        0x309A => 8,
+        0x94D => 9,
+        0x9CD => 9,
+        0xA4D => 9,
+        0xACD => 9,
+        0xB4D => 9,
+        0xBCD => 9,
+        0xC4D => 9,
+        0xCCD => 9,
+        0xD4D => 9,
+        0xDCA => 9,
+        0xE3A => 9,
+        0xF84 => 9,
+        0x1039 => 9,
+        0x1714 => 9,
+        0x1734 => 9,
+        0x17D2 => 9,
+        0x5B0 => 10,
+        0x5B1 => 11,
+        0x5B2 => 12,
+        0x5B3 => 13,
+        0x5B4 => 14,
+        0x5B5 => 15,
+        0x5B6 => 16,
+        0x5B7 => 17,
+        0x5B8 => 18,
+        0x5B9 => 19,
+        0x5BB => 20,
+        0x5Bc => 21,
+        0x5BD => 22,
+        0x5BF => 23,
+        0x5C1 => 24,
+        0x5C2 => 25,
+        0xFB1E => 26,
+        0x64B => 27,
+        0x64C => 28,
+        0x64D => 29,
+        0x64E => 30,
+        0x64F => 31,
+        0x650 => 32,
+        0x651 => 33,
+        0x652 => 34,
+        0x670 => 35,
+        0x711 => 36,
+        0xC55 => 84,
+        0xC56 => 91,
+        0xE38 => 103,
+        0xE39 => 103,
+        0xE48 => 107,
+        0xE49 => 107,
+        0xE4A => 107,
+        0xE4B => 107,
+        0xEB8 => 118,
+        0xEB9 => 118,
+        0xEC8 => 122,
+        0xEC9 => 122,
+        0xECA => 122,
+        0xECB => 122,
+        0xF71 => 129,
+        0xF72 => 130,
+        0xF7A => 130,
+        0xF7B => 130,
+        0xF7C => 130,
+        0xF7D => 130,
+        0xF80 => 130,
+        0xF74 => 132,
+        0x321 => 202,
+        0x322 => 202,
+        0x327 => 202,
+        0x328 => 202,
+        0x31B => 216,
+        0xF39 => 216,
+        0x1D165 => 216,
+        0x1D166 => 216,
+        0x1D16E => 216,
+        0x1D16F => 216,
+        0x1D170 => 216,
+        0x1D171 => 216,
+        0x1D172 => 216,
+        0x302A => 218,
+        0x316 => 220,
+        0x317 => 220,
+        0x318 => 220,
+        0x319 => 220,
+        0x31C => 220,
+        0x31D => 220,
+        0x31E => 220,
+        0x31F => 220,
+        0x320 => 220,
+        0x323 => 220,
+        0x324 => 220,
+        0x325 => 220,
+        0x326 => 220,
+        0x329 => 220,
+        0x32A => 220,
+        0x32B => 220,
+        0x32C => 220,
+        0x32D => 220,
+        0x32E => 220,
+        0x32F => 220,
+        0x330 => 220,
+        0x331 => 220,
+        0x332 => 220,
+        0x333 => 220,
+        0x339 => 220,
+        0x33A => 220,
+        0x33B => 220,
+        0x33C => 220,
+        0x347 => 220,
+        0x348 => 220,
+        0x349 => 220,
+        0x34D => 220,
+        0x34E => 220,
+        0x353 => 220,
+        0x354 => 220,
+        0x355 => 220,
+        0x356 => 220,
+        0x591 => 220,
+        0x596 => 220,
+        0x59B => 220,
+        0x5A3 => 220,
+        0x5A4 => 220,
+        0x5A5 => 220,
+        0x5A6 => 220,
+        0x5A7 => 220,
+        0x5AA => 220,
+        0x655 => 220,
+        0x656 => 220,
+        0x6E3 => 220,
+        0x6EA => 220,
+        0x6ED => 220,
+        0x731 => 220,
+        0x734 => 220,
+        0x737 => 220,
+        0x738 => 220,
+        0x739 => 220,
+        0x73B => 220,
+        0x73C => 220,
+        0x73E => 220,
+        0x742 => 220,
+        0x744 => 220,
+        0x746 => 220,
+        0x748 => 220,
+        0x952 => 220,
+        0xF18 => 220,
+        0xF19 => 220,
+        0xF35 => 220,
+        0xF37 => 220,
+        0xFC6 => 220,
+        0x193B => 220,
+        0x20E8 => 220,
+        0x1D17B => 220,
+        0x1D17C => 220,
+        0x1D17D => 220,
+        0x1D17E => 220,
+        0x1D17F => 220,
+        0x1D180 => 220,
+        0x1D181 => 220,
+        0x1D182 => 220,
+        0x1D18A => 220,
+        0x1D18B => 220,
+        0x59A => 222,
+        0x5AD => 222,
+        0x1929 => 222,
+        0x302D => 222,
+        0x302E => 224,
+        0x302F => 224,
+        0x1D16D => 226,
+        0x5AE => 228,
+        0x18A9 => 228,
+        0x302B => 228,
+        0x300 => 230,
+        0x301 => 230,
+        0x302 => 230,
+        0x303 => 230,
+        0x304 => 230,
+        0x305 => 230,
+        0x306 => 230,
+        0x307 => 230,
+        0x308 => 230,
+        0x309 => 230,
+        0x30A => 230,
+        0x30B => 230,
+        0x30C => 230,
+        0x30D => 230,
+        0x30E => 230,
+        0x30F => 230,
+        0x310 => 230,
+        0x311 => 230,
+        0x312 => 230,
+        0x313 => 230,
+        0x314 => 230,
+        0x33D => 230,
+        0x33E => 230,
+        0x33F => 230,
+        0x340 => 230,
+        0x341 => 230,
+        0x342 => 230,
+        0x343 => 230,
+        0x344 => 230,
+        0x346 => 230,
+        0x34A => 230,
+        0x34B => 230,
+        0x34C => 230,
+        0x350 => 230,
+        0x351 => 230,
+        0x352 => 230,
+        0x357 => 230,
+        0x363 => 230,
+        0x364 => 230,
+        0x365 => 230,
+        0x366 => 230,
+        0x367 => 230,
+        0x368 => 230,
+        0x369 => 230,
+        0x36A => 230,
+        0x36B => 230,
+        0x36C => 230,
+        0x36D => 230,
+        0x36E => 230,
+        0x36F => 230,
+        0x483 => 230,
+        0x484 => 230,
+        0x485 => 230,
+        0x486 => 230,
+        0x592 => 230,
+        0x593 => 230,
+        0x594 => 230,
+        0x595 => 230,
+        0x597 => 230,
+        0x598 => 230,
+        0x599 => 230,
+        0x59C => 230,
+        0x59D => 230,
+        0x59E => 230,
+        0x59F => 230,
+        0x5A0 => 230,
+        0x5A1 => 230,
+        0x5A8 => 230,
+        0x5A9 => 230,
+        0x5AB => 230,
+        0x5AC => 230,
+        0x5AF => 230,
+        0x5C4 => 230,
+        0x610 => 230,
+        0x611 => 230,
+        0x612 => 230,
+        0x613 => 230,
+        0x614 => 230,
+        0x615 => 230,
+        0x653 => 230,
+        0x654 => 230,
+        0x657 => 230,
+        0x658 => 230,
+        0x6D6 => 230,
+        0x6D7 => 230,
+        0x6D8 => 230,
+        0x6D9 => 230,
+        0x6DA => 230,
+        0x6DB => 230,
+        0x6DC => 230,
+        0x6DF => 230,
+        0x6E0 => 230,
+        0x6E1 => 230,
+        0x6E2 => 230,
+        0x6E4 => 230,
+        0x6E7 => 230,
+        0x6E8 => 230,
+        0x6EB => 230,
+        0x6EC => 230,
+        0x730 => 230,
+        0x732 => 230,
+        0x733 => 230,
+        0x735 => 230,
+        0x736 => 230,
+        0x73A => 230,
+        0x73D => 230,
+        0x73F => 230,
+        0x740 => 230,
+        0x741 => 230,
+        0x743 => 230,
+        0x745 => 230,
+        0x747 => 230,
+        0x749 => 230,
+        0x74A => 230,
+        0x951 => 230,
+        0x953 => 230,
+        0x954 => 230,
+        0xF82 => 230,
+        0xF83 => 230,
+        0xF86 => 230,
+        0xF87 => 230,
+        0x170D => 230,
+        0x193A => 230,
+        0x20D0 => 230,
+        0x20D1 => 230,
+        0x20D4 => 230,
+        0x20D5 => 230,
+        0x20D6 => 230,
+        0x20D7 => 230,
+        0x20DB => 230,
+        0x20DC => 230,
+        0x20E1 => 230,
+        0x20E7 => 230,
+        0x20E9 => 230,
+        0xFE20 => 230,
+        0xFE21 => 230,
+        0xFE22 => 230,
+        0xFE23 => 230,
+        0x1D185 => 230,
+        0x1D186 => 230,
+        0x1D187 => 230,
+        0x1D189 => 230,
+        0x1D188 => 230,
+        0x1D1AA => 230,
+        0x1D1AB => 230,
+        0x1D1AC => 230,
+        0x1D1AD => 230,
+        0x315 => 232,
+        0x31A => 232,
+        0x302C => 232,
+        0x35F => 233,
+        0x362 => 233,
+        0x35D => 234,
+        0x35E => 234,
+        0x360 => 234,
+        0x361 => 234,
+        0x345 => 240
+    ];
+    // }}}
+
+    // {{{ properties
+    /**
+     * @var string
+     * @access private
+     */
+    private $_punycode_prefix = 'xn--';
+
+    /**
+     * @access private
+     */
+    private $_invalid_ucs = 0x80000000;
+
+    /**
+     * @access private
+     */
+    private $_max_ucs = 0x10FFFF;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_base = 36;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_tmin = 1;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_tmax = 26;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_skew = 38;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_damp = 700;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_initial_bias = 72;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_initial_n = 0x80;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_slast;
+
+    /**
+     * @access private
+     */
+    private $_sbase = 0xAC00;
+
+    /**
+     * @access private
+     */
+    private $_lbase = 0x1100;
+
+    /**
+     * @access private
+     */
+    private $_vbase = 0x1161;
+
+    /**
+     * @access private
+     */
+    private $_tbase = 0x11a7;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_lcount = 19;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_vcount = 21;
+
+    /**
+     * @var int
+     * @access private
+     */
+    private $_tcount = 28;
+
+    /**
+     * vcount * tcount
+     *
+     * @var int
+     * @access private
+     */
+    private $_ncount = 588;
+
+    /**
+     * lcount * tcount * vcount
+     *
+     * @var int
+     * @access private
+     */
+    private $_scount = 11172;
+
+    /**
+     * Default encoding for encode()'s input and decode()'s output is UTF-8;
+     * Other possible encodings are ucs4_string and ucs4_array
+     * See {@link setParams()} for how to select these
+     *
+     * @var bool
+     * @access private
+     */
+    private $_api_encoding = 'utf8';
+
+    /**
+     * Overlong UTF-8 encodings are forbidden
+     *
+     * @var bool
+     * @access private
+     */
+    private $_allow_overlong = false;
+
+    /**
+     * Behave strict or not
+     *
+     * @var bool
+     * @access private
+     */
+    private $_strict_mode = false;
+
+    /**
+     * IDNA-version to use
+     *
+     * Values are "2003" and "2008".
+     * Defaults to "2003", since that was the original version and for
+     * compatibility with previous versions of this library.
+     * If you need to encode "new" characters like the German "Eszett",
+     * please switch to 2008 first before encoding.
+     *
+     * @var bool
+     * @access private
+     */
+    private $_version = '2003';
+
+    /**
+     * Cached value indicating whether or not mbstring function overloading is
+     * on for strlen
+     *
+     * This is cached for optimal performance.
+     *
+     * @var boolean
+     * @see Net_IDNA2::_byteLength()
+     */
+    private static $_mb_string_overload = null;
+    // }}}
+
+
+    // {{{ constructor
+    /**
+     * Constructor
+     *
+     * @param array|null $options Options to initialise the object with
+     *
+     * @access public
+     * @see    setParams()
+     */
+    public function __construct($options = null)
+    {
+        $this->_slast = $this->_sbase + $this->_lcount * $this->_vcount * $this->_tcount;
+
+        if (is_array($options)) {
+            $this->setParams($options);
+        }
+
+        // populate mbstring overloading cache if not set
+        if (self::$_mb_string_overload === null) {
+            self::$_mb_string_overload = (extension_loaded('mbstring')
+                && (ini_get('mbstring.func_overload') & 0x02) === 0x02);
+        }
+    }
+    // }}}
+
+
+    /**
+     * Sets a new option value. Available options and values:
+     *
+     * [utf8 -     Use either UTF-8 or ISO-8859-1 as input (true for UTF-8, false
+     *             otherwise); The output is always UTF-8]
+     * [overlong - Unicode does not allow unnecessarily long encodings of chars,
+     *             to allow this, set this parameter to true, else to false;
+     *             default is false.]
+     * [strict -   true: strict mode, good for registration purposes - Causes errors
+     *             on failures; false: loose mode, ideal for "wildlife" applications
+     *             by silently ignoring errors and returning the original input instead]
+     *
+     * @param mixed $option Parameter to set (string: single parameter; array of Parameter => Value pairs)
+     * @param string|false $value Value to use (if parameter 1 is a string)
+     *
+     * @return bool       true on success, false otherwise
+     * @access public
+     */
+    public function setParams($option, $value = false): bool
+    {
+        if (!is_array($option)) {
+            $option = [$option => $value];
+        }
+
+        foreach ($option as $k => $v) {
+            switch ($k) {
+                case 'encoding':
+                    switch ($v) {
+                        case 'utf8':
+                        case 'ucs4_string':
+                        case 'ucs4_array':
+                            $this->_api_encoding = $v;
+                            break;
+
+                        default:
+                            throw new InvalidArgumentException('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k);
+                    }
+
+                    break;
+
+                case 'overlong':
+                    $this->_allow_overlong = ($v) ? true : false;
+                    break;
+
+                case 'strict':
+                    $this->_strict_mode = ($v) ? true : false;
+                    break;
+
+                case 'version':
+                    if (in_array($v, ['2003', '2008'])) {
+                        $this->_version = $v;
+                    } else {
+                        throw new InvalidArgumentException('Set Parameter: Invalid parameter ' . $v . ' for option ' . $k);
+                    }
+                    break;
+
+                default:
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Encode a given UTF-8 domain name.
+     *
+     * @param string $decoded Domain name (UTF-8 or UCS-4)
+     * @param string|false $one_time_encoding Desired input encoding, see {@link set_parameter}
+     *                                  If not given will use default-encoding
+     *
+     * @return mixed Encoded Domain name (ACE string) / processed string
+     * @throws Exception
+     * @access public
+     */
+    public function encode(string $decoded, $one_time_encoding = false)
+    {
+        // Forcing conversion of input to UCS4 array
+        // If one time encoding is given, use this, else the objects property
+        switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
+            case 'utf8':
+                $decoded = $this->_utf8_to_ucs4($decoded);
+                break;
+            case 'ucs4_string':
+                $decoded = $this->_ucs4_string_to_ucs4($decoded);
+            // no break
+            case 'ucs4_array':
+                break;
+            default:
+                throw new InvalidArgumentException('Unsupported input format');
+        }
+
+        // No input, no output, what else did you expect?
+        if (empty($decoded)) {
+            return '';
+        }
+
+        // Anchors for iteration
+        $last_begin = 0;
+        // Output string
+        $output = '';
+
+        foreach ($decoded as $k => $v) {
+            // Make sure to use just the plain dot
+            switch ($v) {
+                case 0x3002:
+                case 0xFF0E:
+                case 0xFF61:
+                    $decoded[$k] = 0x2E;
+                // It's right, no break here
+                // The codepoints above have to be converted to dots anyway
+
+                // Stumbling across an anchoring character
+                // no break
+                case 0x2E:
+                case 0x2F:
+                case 0x3A:
+                case 0x3F:
+                case 0x40:
+                    // Neither email addresses nor URLs allowed in strict mode
+                    if ($this->_strict_mode) {
+                        throw new InvalidArgumentException('Neither email addresses nor URLs are allowed in strict mode.');
+                    }
+                    // Skip first char
+                    if ($k) {
+                        $encoded = '';
+                        $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k) - $last_begin)));
+                        if ($encoded) {
+                            $output .= $encoded;
+                        } else {
+                            $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k) - $last_begin)));
+                        }
+                        $output .= chr($decoded[$k]);
+                    }
+                    $last_begin = $k + 1;
+            }
+        }
+        // Catch the rest of the string
+        if ($last_begin) {
+            $inp_len = sizeof($decoded);
+            $encoded = '';
+            $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len) - $last_begin)));
+            if ($encoded) {
+                $output .= $encoded;
+            } else {
+                $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len) - $last_begin)));
+            }
+            return $output;
+        }
+
+        if ($output = $this->_encode($decoded)) {
+            return $output;
+        }
+
+        return $this->_ucs4_to_utf8($decoded);
+    }
+
+    /**
+     * Decode a given ACE domain name.
+     *
+     * @param string $input Domain name (ACE string)
+     * @param string|false $one_time_encoding Desired output encoding, see {@link set_parameter}
+     *
+     * @return mixed                   Decoded Domain name (UTF-8 or UCS-4) / processed string
+     * @throws Exception
+     * @access public
+     */
+    public function decode(string $input, $one_time_encoding = false)
+    {
+        // Optionally set
+        if ($one_time_encoding) {
+            switch ($one_time_encoding) {
+                case 'utf8':
+                case 'ucs4_string':
+                case 'ucs4_array':
+                    break;
+                default:
+                    throw new InvalidArgumentException('Unknown encoding ' . $one_time_encoding);
+            }
+        }
+        // Make sure to drop any newline characters around
+        $input = trim($input);
+
+        // Negotiate input and try to determine, whether it is a plain string,
+        // an email address or something like a complete URL
+        if (strpos($input, '@')) { // Maybe it is an email address
+            // No no in strict mode
+            if ($this->_strict_mode) {
+                throw new InvalidArgumentException('Only simple domain name parts can be handled in strict mode');
+            }
+            list($email_pref, $input) = explode('@', $input, 2);
+            $arr = explode('.', $input);
+            foreach ($arr as $k => $v) {
+                $conv = $this->_decode($v);
+                if ($conv) {
+                    $arr[$k] = $conv;
+                }
+            }
+            $return = $email_pref . '@' . join('.', $arr);
+        } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters)
+            // No no in strict mode
+            if ($this->_strict_mode) {
+                throw new InvalidArgumentException('Only simple domain name parts can be handled in strict mode');
+            }
+
+            $parsed = parse_url($input);
+            if (isset($parsed['host'])) {
+                $arr = explode('.', $parsed['host']);
+                foreach ($arr as $k => $v) {
+                    $conv = $this->_decode($v);
+                    if ($conv) {
+                        $arr[$k] = $conv;
+                    }
+                }
+                $parsed['host'] = join('.', $arr);
+                if (isset($parsed['scheme'])) {
+                    $parsed['scheme'] .= (strtolower($parsed['scheme']) == 'mailto') ? ':' : '://';
+                }
+                $return = $this->_unparse_url($parsed);
+            } else { // parse_url seems to have failed, try without it
+                $arr = explode('.', $input);
+                foreach ($arr as $k => $v) {
+                    $conv = $this->_decode($v);
+                    if ($conv) {
+                        $arr[$k] = $conv;
+                    }
+                }
+                $return = join('.', $arr);
+            }
+        } else { // Otherwise we consider it being a pure domain name string
+            $return = $this->_decode($input);
+        }
+        // The output is UTF-8 by default, other output formats need conversion here
+        // If one time encoding is given, use this, else the objects property
+        switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
+            case 'utf8':
+                return $return;
+                break;
+            case 'ucs4_string':
+                return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));
+                break;
+            case 'ucs4_array':
+                return $this->_utf8_to_ucs4($return);
+                break;
+            default:
+                throw new InvalidArgumentException('Unsupported output format');
+        }
+    }
+
+
+    // {{{ private
+
+    /**
+     * Opposite function to parse_url()
+     *
+     * Inspired by code from comments of php.net-documentation for parse_url()
+     *
+     * @param array $parts_arr parts (strings) as returned by parse_url()
+     *
+     * @return string
+     * @access private
+     */
+    private function _unparse_url(array $parts_arr): string
+    {
+        if (!empty($parts_arr['scheme'])) {
+            $ret_url = $parts_arr['scheme'];
+        }
+        if (!empty($parts_arr['user'])) {
+            $ret_url .= $parts_arr['user'];
+            if (!empty($parts_arr['pass'])) {
+                $ret_url .= ':' . $parts_arr['pass'];
+            }
+            $ret_url .= '@';
+        }
+        $ret_url .= $parts_arr['host'];
+        if (!empty($parts_arr['port'])) {
+            $ret_url .= ':' . $parts_arr['port'];
+        }
+        $ret_url .= $parts_arr['path'];
+        if (!empty($parts_arr['query'])) {
+            $ret_url .= '?' . $parts_arr['query'];
+        }
+        if (!empty($parts_arr['fragment'])) {
+            $ret_url .= '#' . $parts_arr['fragment'];
+        }
+        return $ret_url;
+    }
+
+    /**
+     * The actual encoding algorithm.
+     *
+     * @param array of strings $decoded Decoded string which should be encoded
+     *
+     * @return string         Encoded string
+     * @throws Exception
+     * @access private
+     */
+    private function _encode($decoded): string
+    {
+        // We cannot encode a domain name containing the Punycode prefix
+        $extract = self::_byteLength($this->_punycode_prefix);
+        $check_pref = $this->_utf8_to_ucs4($this->_punycode_prefix);
+        $check_deco = array_slice($decoded, 0, $extract);
+
+        if ($check_pref == $check_deco) {
+            throw new InvalidArgumentException('This is already a punycode string');
+        }
+
+        // We will not try to encode strings consisting of basic code points only
+        $encodable = false;
+        foreach ($decoded as $k => $v) {
+            if ($v > 0x7a) {
+                $encodable = true;
+                break;
+            }
+        }
+        if (!$encodable) {
+            if ($this->_strict_mode) {
+                throw new InvalidArgumentException('The given string does not contain encodable chars');
+            }
+
+            return false;
+        }
+
+        // Do NAMEPREP
+        $decoded = $this->_nameprep($decoded);
+
+        $deco_len = count($decoded);
+
+        // Empty array
+        if (!$deco_len) {
+            return false;
+        }
+
+        // How many chars have been consumed
+        $codecount = 0;
+
+        // Start with the prefix; copy it to output
+        $encoded = $this->_punycode_prefix;
+
+        $encoded = '';
+        // Copy all basic code points to output
+        for ($i = 0; $i < $deco_len; ++$i) {
+            $test = $decoded[$i];
+            // Will match [0-9a-zA-Z-]
+            if ((0x2F < $test && $test < 0x40)
+                || (0x40 < $test && $test < 0x5B)
+                || (0x60 < $test && $test <= 0x7B)
+                || (0x2D == $test)
+            ) {
+                $encoded .= chr($decoded[$i]);
+                $codecount++;
+            }
+        }
+
+        // All codepoints were basic ones
+        if ($codecount == $deco_len) {
+            return $encoded;
+        }
+
+        // Start with the prefix; copy it to output
+        $encoded = $this->_punycode_prefix . $encoded;
+
+        // If we have basic code points in output, add an hyphen to the end
+        if ($codecount) {
+            $encoded .= '-';
+        }
+
+        // Now find and encode all non-basic code points
+        $is_first = true;
+        $cur_code = $this->_initial_n;
+        $bias = $this->_initial_bias;
+        $delta = 0;
+
+        while ($codecount < $deco_len) {
+            // Find the smallest code point >= the current code point and
+            // remember the last ouccrence of it in the input
+            for ($i = 0, $next_code = $this->_max_ucs; $i < $deco_len; $i++) {
+                if ($decoded[$i] >= $cur_code && $decoded[$i] <= $next_code) {
+                    $next_code = $decoded[$i];
+                }
+            }
+
+            $delta += ($next_code - $cur_code) * ($codecount + 1);
+            $cur_code = $next_code;
+
+            // Scan input again and encode all characters whose code point is $cur_code
+            for ($i = 0; $i < $deco_len; $i++) {
+                if ($decoded[$i] < $cur_code) {
+                    $delta++;
+                } elseif ($decoded[$i] == $cur_code) {
+                    for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) {
+                        $t = ($k <= $bias) ?
+                            $this->_tmin :
+                            (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias);
+
+                        if ($q < $t) {
+                            break;
+                        }
+
+                        $encoded .= $this->_encodeDigit(ceil($t + (($q - $t) % ($this->_base - $t))));
+                        $q = ($q - $t) / ($this->_base - $t);
+                    }
+
+                    $encoded .= $this->_encodeDigit($q);
+                    $bias = $this->_adapt($delta, $codecount + 1, $is_first);
+                    $codecount++;
+                    $delta = 0;
+                    $is_first = false;
+                }
+            }
+
+            $delta++;
+            $cur_code++;
+        }
+
+        return $encoded;
+    }
+
+    /**
+     * The actual decoding algorithm.
+     *
+     * @param string $encoded Encoded string which should be decoded
+     *
+     * @return string         Decoded string
+     * @throws Exception
+     * @access private
+     */
+    private function _decode($encoded): string
+    {
+        // We do need to find the Punycode prefix
+        if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) {
+            return false;
+        }
+
+        $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded);
+
+        // If nothing left after removing the prefix, it is hopeless
+        if (!$encode_test) {
+            return false;
+        }
+
+        // Find last occurrence of the delimiter
+        $delim_pos = strrpos($encoded, '-');
+
+        if ($delim_pos > self::_byteLength($this->_punycode_prefix)) {
+            for ($k = self::_byteLength($this->_punycode_prefix); $k < $delim_pos; ++$k) {
+                $decoded[] = ord($encoded{$k});
+            }
+        } else {
+            $decoded = [];
+        }
+
+        $deco_len = count($decoded);
+        $enco_len = self::_byteLength($encoded);
+
+        // Wandering through the strings; init
+        $is_first = true;
+        $bias = $this->_initial_bias;
+        $idx = 0;
+        $char = $this->_initial_n;
+
+        for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
+            for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) {
+                $digit = $this->_decodeDigit($encoded{$enco_idx++});
+                $idx += $digit * $w;
+
+                $t = ($k <= $bias) ?
+                    $this->_tmin :
+                    (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
+
+                if ($digit < $t) {
+                    break;
+                }
+
+                $w = (int)($w * ($this->_base - $t));
+            }
+
+            $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first);
+            $is_first = false;
+            $char += (int)($idx / ($deco_len + 1));
+            $idx %= ($deco_len + 1);
+
+            if ($deco_len > 0) {
+                // Make room for the decoded char
+                for ($i = $deco_len; $i > $idx; $i--) {
+                    $decoded[$i] = $decoded[($i - 1)];
+                }
+            }
+
+            $decoded[$idx++] = $char;
+        }
+
+        return $this->_ucs4_to_utf8($decoded);
+    }
+
+    /**
+     * Adapt the bias according to the current code point and position.
+     *
+     * @param int $delta ...
+     * @param int $npoints ...
+     * @param bool $is_first ...
+     *
+     * @return int
+     * @access private
+     */
+    private function _adapt(int $delta, int $npoints, bool $is_first): int
+    {
+        $delta = (int)($is_first ? ($delta / $this->_damp) : ($delta / 2));
+        $delta += (int)($delta / $npoints);
+
+        for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) {
+            $delta = (int)($delta / ($this->_base - $this->_tmin));
+        }
+
+        return (int)($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew));
+    }
+
+    /**
+     * Encoding a certain digit.
+     *
+     * @param int $d One digit to encode
+     *
+     * @return string (char)  Encoded digit
+     * @access private
+     */
+    private function _encodeDigit(int $d): string
+    {
+        return chr($d + 22 + 75 * ($d < 26));
+    }
+
+    /**
+     * Decode a certain digit.
+     *
+     * @param string (char) $cp One digit (character) to decode
+     *
+     * @return int     Decoded digit
+     * @access private
+     */
+    private function _decodeDigit(string $cp): int
+    {
+        $cp = ord($cp);
+        return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base));
+    }
+
+    /**
+     * Do Nameprep according to RFC3491 and RFC3454.
+     *
+     * @param array $input Unicode Characters
+     *
+     * @return array of strings      Unicode Characters, Nameprep'd
+     * @throws Exception
+     * @access private
+     */
+    private function _nameprep(array $input): array
+    {
+        $output = [];
+
+        // Walking through the input array, performing the required steps on each of
+        // the input chars and putting the result into the output array
+        // While mapping required chars we apply the canonical ordering
+
+        foreach ($input as $v) {
+            // Map to nothing == skip that code point
+            if (in_array($v, self::$_np_map_nothing)) {
+                continue;
+            }
+
+            // Try to find prohibited input
+            if (in_array($v, self::$_np_prohibit) || in_array($v, self::$_general_prohibited)) {
+                throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+' . sprintf('%08X', $v));
+            }
+
+            foreach (self::$_np_prohibit_ranges as $range) {
+                if ($range[0] <= $v && $v <= $range[1]) {
+                    throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+' . sprintf('%08X', $v));
+                }
+            }
+
+            // Hangul syllable decomposition
+            if (0xAC00 <= $v && $v <= 0xD7AF) {
+                foreach ($this->_hangulDecompose($v) as $out) {
+                    $output[] = $out;
+                }
+            } elseif (($this->_version == '2003') && isset(self::$_np_replacemaps[$v])) {
+                // There's a decomposition mapping for that code point
+                // Decompositions only in version 2003 (original) of IDNA
+                foreach ($this->_applyCannonicalOrdering(self::$_np_replacemaps[$v]) as $out) {
+                    $output[] = $out;
+                }
+            } else {
+                $output[] = $v;
+            }
+        }
+
+        // Combine code points
+
+        $last_class = 0;
+        $last_starter = 0;
+        $out_len = count($output);
+
+        for ($i = 0; $i < $out_len; ++$i) {
+            $class = $this->_getCombiningClass($output[$i]);
+
+            if ((!$last_class || $last_class != $class) && $class) {
+                // Try to match
+                $seq_len = $i - $last_starter;
+                $out = $this->_combine(array_slice($output, $last_starter, $seq_len));
+
+                // On match: Replace the last starter with the composed character and remove
+                // the now redundant non-starter(s)
+                if ($out) {
+                    $output[$last_starter] = $out;
+
+                    if (count($out) != $seq_len) {
+                        for ($j = $i + 1; $j < $out_len; ++$j) {
+                            $output[$j - 1] = $output[$j];
+                        }
+
+                        unset($output[$out_len]);
+                    }
+
+                    // Rewind the for loop by one, since there can be more possible compositions
+                    $i--;
+                    $out_len--;
+                    $last_class = ($i == $last_starter) ? 0 : $this->_getCombiningClass($output[$i - 1]);
+
+                    continue;
+                }
+            }
+
+            // The current class is 0
+            if (!$class) {
+                $last_starter = $i;
+            }
+
+            $last_class = $class;
+        }
+
+        return $output;
+    }
+
+    /**
+     * Decomposes a Hangul syllable
+     * (see http://www.unicode.org/unicode/reports/tr15/#Hangul).
+     *
+     * @param int $char 32bit UCS4 code point
+     *
+     * @return array        Either Hangul Syllable decomposed or original 32bit
+     *                      value as one value array
+     * @access private
+     */
+    private function _hangulDecompose(int $char): array
+    {
+        $sindex = $char - $this->_sbase;
+
+        if ($sindex < 0 || $sindex >= $this->_scount) {
+            return [$char];
+        }
+
+        $result = [];
+        $T = $this->_tbase + $sindex % $this->_tcount;
+        $result[] = (int)($this->_lbase + $sindex / $this->_ncount);
+        $result[] = (int)($this->_vbase + ($sindex % $this->_ncount) / $this->_tcount);
+
+        if ($T != $this->_tbase) {
+            $result[] = $T;
+        }
+
+        return $result;
+    }
+
+    /**
+     * Ccomposes a Hangul syllable
+     * (see http://www.unicode.org/unicode/reports/tr15/#Hangul).
+     *
+     * @param array $input Decomposed UCS4 sequence
+     *
+     * @return array       UCS4 sequence with syllables composed
+     * @access private
+     */
+    private function _hangulCompose(array $input): array
+    {
+        $inp_len = count($input);
+
+        if (!$inp_len) {
+            return [];
+        }
+
+        $result = [];
+        $last = $input[0];
+        $result[] = $last; // copy first char from input to output
+
+        for ($i = 1; $i < $inp_len; ++$i) {
+            $char = $input[$i];
+
+            // Find out, wether two current characters from L and V
+            $lindex = $last - $this->_lbase;
+
+            if (0 <= $lindex && $lindex < $this->_lcount) {
+                $vindex = $char - $this->_vbase;
+
+                if (0 <= $vindex && $vindex < $this->_vcount) {
+                    // create syllable of form LV
+                    $last = ($this->_sbase + ($lindex * $this->_vcount + $vindex) * $this->_tcount);
+                    $out_off = count($result) - 1;
+                    $result[$out_off] = $last; // reset last
+
+                    // discard char
+                    continue;
+                }
+            }
+
+            // Find out, wether two current characters are LV and T
+            $sindex = $last - $this->_sbase;
+
+            if (0 <= $sindex && $sindex < $this->_scount && ($sindex % $this->_tcount) == 0) {
+                $tindex = $char - $this->_tbase;
+
+                if (0 <= $tindex && $tindex <= $this->_tcount) {
+                    // create syllable of form LVT
+                    $last += $tindex;
+                    $out_off = count($result) - 1;
+                    $result[$out_off] = $last; // reset last
+
+                    // discard char
+                    continue;
+                }
+            }
+
+            // if neither case was true, just add the character
+            $last = $char;
+            $result[] = $char;
+        }
+
+        return $result;
+    }
+
+    /**
+     * Returns the combining class of a certain wide char.
+     *
+     * @param integer $char Wide char to check (32bit integer)
+     *
+     * @return int      Combining class if found, else 0
+     * @access private
+     */
+    private function _getCombiningClass(int $char): int
+    {
+        return isset(self::$_np_norm_combcls[$char]) ? self::$_np_norm_combcls[$char] : 0;
+    }
+
+    /**
+     * Apllies the canonical ordering of a decomposed UCS4 sequence.
+     *
+     * @param array $input Decomposed UCS4 sequence
+     *
+     * @return array       Ordered USC4 sequence
+     * @access private
+     */
+    private function _applyCannonicalOrdering(array $input): array
+    {
+        $swap = true;
+        $size = count($input);
+
+        while ($swap) {
+            $swap = false;
+            $last = $this->_getCombiningClass($input[0]);
+
+            for ($i = 0; $i < $size - 1; ++$i) {
+                $next = $this->_getCombiningClass($input[$i + 1]);
+
+                if ($next != 0 && $last > $next) {
+                    // Move item leftward until it fits
+                    for ($j = $i + 1; $j > 0; --$j) {
+                        if ($this->_getCombiningClass($input[$j - 1]) <= $next) {
+                            break;
+                        }
+
+                        $t = $input[$j];
+                        $input[$j] = $input[$j - 1];
+                        $input[$j - 1] = $t;
+                        $swap = 1;
+                    }
+
+                    // Reentering the loop looking at the old character again
+                    $next = $last;
+                }
+
+                $last = $next;
+            }
+        }
+
+        return $input;
+    }
+
+    /**
+     * Do composition of a sequence of starter and non-starter.
+     *
+     * @param array $input UCS4 Decomposed sequence
+     *
+     * @return array|false       Ordered USC4 sequence
+     * @access private
+     */
+    private function _combine($input)
+    {
+        $inp_len = count($input);
+
+        // Is it a Hangul syllable?
+        if (1 != $inp_len) {
+            $hangul = $this->_hangulCompose($input);
+
+            // This place is probably wrong
+            if (count($hangul) != $inp_len) {
+                return $hangul;
+            }
+        }
+
+        foreach (self::$_np_replacemaps as $np_src => $np_target) {
+            if ($np_target[0] != $input[0]) {
+                continue;
+            }
+
+            if (count($np_target) != $inp_len) {
+                continue;
+            }
+
+            $hit = false;
+
+            foreach ($input as $k2 => $v2) {
+                if ($v2 == $np_target[$k2]) {
+                    $hit = true;
+                } else {
+                    $hit = false;
+                    break;
+                }
+            }
+
+            if ($hit) {
+                return $np_src;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * This converts an UTF-8 encoded string to its UCS-4 (array) representation
+     * By talking about UCS-4 we mean arrays of 32bit integers representing
+     * each of the "chars". This is due to PHP not being able to handle strings with
+     * bit depth different from 8. This applies to the reverse method _ucs4_to_utf8(), too.
+     * The following UTF-8 encodings are supported:
+     *
+     * bytes bits  representation
+     * 1        7  0xxxxxxx
+     * 2       11  110xxxxx 10xxxxxx
+     * 3       16  1110xxxx 10xxxxxx 10xxxxxx
+     * 4       21  11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+     * 5       26  111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+     * 6       31  1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+     *
+     * Each x represents a bit that can be used to store character data.
+     *
+     * @param string $input utf8-encoded string
+     *
+     * @return array        ucs4-encoded array
+     * @throws Exception
+     * @access private
+     */
+    private function _utf8_to_ucs4(string $input): array
+    {
+        $output = [];
+        $out_len = 0;
+        $inp_len = self::_byteLength($input, '8bit');
+        $mode = 'next';
+        $test = 'none';
+        for ($k = 0; $k < $inp_len; ++$k) {
+            $v = ord($input{$k}); // Extract byte from input string
+
+            if ($v < 128) { // We found an ASCII char - put into string as is
+                $output[$out_len] = $v;
+                ++$out_len;
+                if ('add' == $mode) {
+                    throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k);
+                }
+                continue;
+            }
+            if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char
+                $start_byte = $v;
+                $mode = 'add';
+                $test = 'range';
+                if ($v >> 5 == 6) { // &110xxxxx 10xxxxx
+                    $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left
+                    $v = ($v - 192) << 6;
+                } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx
+                    $next_byte = 1;
+                    $v = ($v - 224) << 12;
+                } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+                    $next_byte = 2;
+                    $v = ($v - 240) << 18;
+                } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+                    $next_byte = 3;
+                    $v = ($v - 248) << 24;
+                } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+                    $next_byte = 4;
+                    $v = ($v - 252) << 30;
+                } else {
+                    throw new UnexpectedValueException('This might be UTF-8, but I don\'t understand it at byte ' . $k);
+                }
+                if ('add' == $mode) {
+                    $output[$out_len] = (int)$v;
+                    ++$out_len;
+                    continue;
+                }
+            }
+            if ('add' == $mode) {
+                if (!$this->_allow_overlong && $test == 'range') {
+                    $test = 'none';
+                    if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) {
+                        throw new OutOfRangeException('Bogus UTF-8 character detected (out of legal range) at byte ' . $k);
+                    }
+                }
+                if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx
+                    $v = ($v - 128) << ($next_byte * 6);
+                    $output[($out_len - 1)] += $v;
+                    --$next_byte;
+                } else {
+                    throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k);
+                }
+                if ($next_byte < 0) {
+                    $mode = 'next';
+                }
+            }
+        } // for
+        return $output;
+    }
+
+    /**
+     * Convert UCS-4 array into UTF-8 string
+     *
+     * @param array $input ucs4-encoded array
+     *
+     * @return string      utf8-encoded string
+     * @throws Exception
+     * @access private
+     */
+    private function _ucs4_to_utf8(array $input): string
+    {
+        $output = '';
+
+        foreach ($input as $v) {
+            // $v = ord($v);
+
+            if ($v < 128) {
+                // 7bit are transferred literally
+                $output .= chr($v);
+            } elseif ($v < 1 << 11) {
+                // 2 bytes
+                $output .= chr(192 + ($v >> 6))
+                    . chr(128 + ($v & 63));
+            } elseif ($v < 1 << 16) {
+                // 3 bytes
+                $output .= chr(224 + ($v >> 12))
+                    . chr(128 + (($v >> 6) & 63))
+                    . chr(128 + ($v & 63));
+            } elseif ($v < 1 << 21) {
+                // 4 bytes
+                $output .= chr(240 + ($v >> 18))
+                    . chr(128 + (($v >> 12) & 63))
+                    . chr(128 + (($v >> 6) & 63))
+                    . chr(128 + ($v & 63));
+            } elseif ($v < 1 << 26) {
+                // 5 bytes
+                $output .= chr(248 + ($v >> 24))
+                    . chr(128 + (($v >> 18) & 63))
+                    . chr(128 + (($v >> 12) & 63))
+                    . chr(128 + (($v >> 6) & 63))
+                    . chr(128 + ($v & 63));
+            } elseif ($v < 1 << 31) {
+                // 6 bytes
+                $output .= chr(252 + ($v >> 30))
+                    . chr(128 + (($v >> 24) & 63))
+                    . chr(128 + (($v >> 18) & 63))
+                    . chr(128 + (($v >> 12) & 63))
+                    . chr(128 + (($v >> 6) & 63))
+                    . chr(128 + ($v & 63));
+            } else {
+                throw new UnexpectedValueException('Conversion from UCS-4 to UTF-8 failed: malformed input');
+            }
+        }
+
+        return $output;
+    }
+
+    /**
+     * Convert UCS-4 array into UCS-4 string
+     *
+     * @param array $input ucs4-encoded array
+     *
+     * @return string      ucs4-encoded string
+     * @throws Exception
+     * @access private
+     */
+    private function _ucs4_to_ucs4_string(array $input): string
+    {
+        $output = '';
+        // Take array values and split output to 4 bytes per value
+        // The bit mask is 255, which reads &11111111
+        foreach ($input as $v) {
+            $output .= ($v & (255 << 24) >> 24) . ($v & (255 << 16) >> 16) . ($v & (255 << 8) >> 8) . ($v & 255);
+        }
+        return $output;
+    }
+
+    /**
+     * Convert UCS-4 string into UCS-4 array
+     *
+     * @param string $input ucs4-encoded string
+     *
+     * @return array        ucs4-encoded array
+     * @throws InvalidArgumentException
+     * @access private
+     */
+    private function _ucs4_string_to_ucs4(string $input): array
+    {
+        $output = [];
+
+        $inp_len = self::_byteLength($input);
+        // Input length must be dividable by 4
+        if ($inp_len % 4) {
+            throw new InvalidArgumentException('Input UCS4 string is broken');
+        }
+
+        // Empty input - return empty output
+        if (!$inp_len) {
+            return $output;
+        }
+
+        for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) {
+            // Increment output position every 4 input bytes
+            if (!$i % 4) {
+                $out_len++;
+                $output[$out_len] = 0;
+            }
+            $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4)));
+        }
+        return $output;
+    }
+
+    /**
+     * Echo hex representation of UCS4 sequence.
+     *
+     * @param array $input UCS4 sequence
+     * @param bool $include_bit Include bitmask in output
+     *
+     * @return void
+     * @static
+     * @access private
+     */
+    private static function _showHex(array $input, bool $include_bit = false) //: void  XXX PHP: Upgrade to PHP 7.1
+    {
+        foreach ($input as $k => $v) {
+            echo '[', $k, '] => ', sprintf('%X', $v);
+
+            if ($include_bit) {
+                echo ' (', Net_IDNA2::_showBitmask($v), ')';
+            }
+
+            echo "\n";
+        }
+    }
+
+    /**
+     * Gives you a bit representation of given Byte (8 bits), Word (16 bits) or DWord (32 bits)
+     * Output width is automagically determined
+     *
+     * @param int $octet ...
+     *
+     * @return string    Bitmask-representation
+     * @static
+     * @access private
+     */
+    private static function _showBitmask(int $octet): string
+    {
+        if ($octet >= (1 << 16)) {
+            $w = 31;
+        } elseif ($octet >= (1 << 8)) {
+            $w = 15;
+        } else {
+            $w = 7;
+        }
+
+        $return = '';
+
+        for ($i = $w; $i > -1; $i--) {
+            $return .= ($octet & (1 << $i)) ? '1' : '0';
+        }
+
+        return $return;
+    }
+
+    /**
+     * Gets the length of a string in bytes even if mbstring function
+     * overloading is turned on
+     *
+     * @param string $string the string for which to get the length.
+     * @param string $encoding [optional] &mbstring.encoding.parameter;
+     *
+     * @return int the length of the string in bytes.
+     *
+     * @see Net_IDNA2::$_mb_string_overload
+     */
+    private static function _byteLength(string $string, string $encoding = '8bit'): int
+    {
+        if (self::$_mb_string_overload) {
+            return mb_strlen($string, $encoding);
+        }
+        return strlen((binary)$string);
+    }
+
+    // }}}}
+
+    // {{{ factory
+    /**
+     * Attempts to return a concrete IDNA instance for either php4 or php5.
+     *
+     * @param array $params Set of paramaters
+     *
+     * @return Net_IDNA2
+     * @access public
+     */
+    public static function getInstance(array $params = []): Net_IDNA2
+    {
+        return new Net_IDNA2($params);
+    }
+    // }}}
+
+    // {{{ singleton
+    /**
+     * Attempts to return a concrete IDNA instance for either php4 or php5,
+     * only creating a new instance if no IDNA instance with the same
+     * parameters currently exists.
+     *
+     * @param array $params Set of parameters
+     *
+     * @return Net_IDNA2
+     * @access public
+     */
+    public static function singleton(array $params = []): Net_IDNA2
+    {
+        static $instances;
+        if (!isset($instances)) {
+            $instances = [];
+        }
+
+        $signature = serialize($params);
+        if (!isset($instances[$signature])) {
+            $instances[$signature] = Net_IDNA2::getInstance($params);
+        }
+
+        return $instances[$signature];
+    }
+    // }}}
+}
diff --git a/extlib/Net/IDNA2/Exception.php b/extlib/Net/IDNA2/Exception.php
new file mode 100644 (file)
index 0000000..49f2751
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+class Net_IDNA2_Exception extends Exception
+{
+}
diff --git a/extlib/Net/IDNA2/Exception/Nameprep.php b/extlib/Net/IDNA2/Exception/Nameprep.php
new file mode 100644 (file)
index 0000000..44cbd6b
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+require_once 'Net/IDNA2/Exception.php';
+
+class Net_IDNA2_Exception_Nameprep extends Net_IDNA2_Exception
+{
+}
diff --git a/extlib/Net/IDNA2_tests/Net_IDNA2Test.php b/extlib/Net/IDNA2_tests/Net_IDNA2Test.php
new file mode 100644 (file)
index 0000000..76347d1
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+require_once 'Net/IDNA2.php';
+
+class Net_IDNA2Test extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Initialise tests
+     *
+     * @return void
+     */
+    public function setUp()
+    {
+        $this->idn = new Net_IDNA2();
+    }
+
+    /**
+     * Test if a complete URL consisting also of port-number etc. will be decoded just fine, test 1
+     *
+     * @return void
+     */
+    public function testShouldDecodePortNumbersFragmentsAndUrisCorrectly1()
+    {
+        $result = $this->idn->decode('http://www.xn--ml-6kctd8d6a.org:8080/test.php?arg1=1&arg2=2#fragment');
+        $this->assertSame("http://www.\xD0\xB5\xD1\x85\xD0\xB0m\xD1\x80l\xD0\xB5.org:8080/test.php?arg1=1&arg2=2#fragment", $result);
+    }
+
+    /**
+     * Test if a complete URL consisting also of port-number etc. will be decoded just fine, test 2
+     *
+     * @return void
+     */
+    public function testShouldDecodePortNumbersFragmentsAndUrisCorrectly2()
+    {
+        $result = $this->idn->decode('http://xn--tst-qla.example.com:8080/test.php?arg1=1&arg2=2#fragment');
+        $this->assertSame("http://täst.example.com:8080/test.php?arg1=1&arg2=2#fragment", $result);
+    }
+
+    /**
+     * Test encoding of German letter Eszett according to the original standard (IDNA2003)
+     *
+     * @return void
+     */
+    public function testEncodingForGermanEszettUsingIDNA2003()
+    {
+        // make sure to use 2003-encoding
+        $this->idn->setParams('version', '2003');
+        $result = $this->idn->encode('http://www.straße.example.com/');
+
+        $this->assertSame("http://www.strasse.example.com/", $result);
+    }
+
+    /**
+     * Test encoding of German letter Eszett according to the "new" standard (IDNA2005/IDNAbis)
+     *
+     * @return void
+     */
+    public function testEncodingForGermanEszettUsingIDNA2008()
+    {
+        // make sure to use 2008-encoding
+        $this->idn->setParams('version', '2008');
+        $result = $this->idn->encode('http://www.straße.example.com/');
+        // switch back for other testcases
+        $this->idn->setParams('version', '2003');
+
+        $this->assertSame("http://www.xn--strae-oqa.example.com/", $result);
+    }
+}
diff --git a/extlib/Net/IDNA2_tests/draft-josefsson-idn-test-vectors.php b/extlib/Net/IDNA2_tests/draft-josefsson-idn-test-vectors.php
new file mode 100644 (file)
index 0000000..9749128
--- /dev/null
@@ -0,0 +1,486 @@
+<?php
+require_once 'Net/IDNA2.php';
+
+// Test cases from https://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
+
+define('IDNA_ACE_PREFIX', 'xn--');
+
+class IDNATest extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        $this->idn = new Net_IDNA2();
+    }
+
+    public static function unichr($chr)
+    {
+        return mb_convert_encoding('&#' . intval($chr) . ';', 'UTF-8', 'HTML-ENTITIES');
+    }
+
+    private function hexarray2string($arr)
+    {
+        return implode('', array_map(array('self', 'unichr'), $arr));
+    }
+
+    public function testDecode1()
+    {
+        // Arabic (Egyptian)
+        $expected = $this->hexarray2string(array(
+            0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A, 0x0643,
+            0x0644, 0x0645, 0x0648, 0x0634, 0x0639, 0x0631, 0x0628, 0x064A,
+            0x061F
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "egbpdaj6bu4bxfgehfvwxn");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode2()
+    {
+        // Chinese (simplified)
+        $expected = $this->hexarray2string(array(
+            0x4ED6, 0x4EEC, 0x4E3A, 0x4EC0, 0x4E48, 0x4E0D, 0x8BF4, 0x4E2D, 0x6587
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "ihqwcrb4cv8a8dqg056pqjye");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode3()
+    {
+        // Chinese (traditional)
+        $expected = $this->hexarray2string(array(
+            0x4ED6, 0x5011, 0x7232, 0x4EC0, 0x9EBD, 0x4E0D, 0x8AAA, 0x4E2D, 0x6587
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "ihqwctvzc91f659drss3x8bo0yb");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode4()
+    {
+        // Czech
+        $expected = $this->hexarray2string(array(
+            0x0050, 0x0072, 0x006F, 0x010D, 0x0070, 0x0072, 0x006F, 0x0073,
+            0x0074, 0x011B, 0x006E, 0x0065, 0x006D, 0x006C, 0x0075, 0x0076,
+            0x00ED, 0x010D, 0x0065, 0x0073, 0x006B, 0x0079
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "Proprostnemluvesky-uyb24dma41a");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode5()
+    {
+        // Hebrew
+        $expected = $this->hexarray2string(array(
+            0x05DC, 0x05DE, 0x05D4, 0x05D4, 0x05DD, 0x05E4, 0x05E9, 0x05D5,
+            0x05D8, 0x05DC, 0x05D0, 0x05DE, 0x05D3, 0x05D1, 0x05E8, 0x05D9,
+            0x05DD, 0x05E2, 0x05D1, 0x05E8, 0x05D9, 0x05EA
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "4dbcagdahymbxekheh6e0a7fei0b");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode6()
+    {
+        // Hindi (Devanagari)
+        $expected = $this->hexarray2string(array(
+            0x092F, 0x0939, 0x0932, 0x094B, 0x0917, 0x0939, 0x093F, 0x0928,
+            0x094D, 0x0926, 0x0940, 0x0915, 0x094D, 0x092F, 0x094B, 0x0902,
+            0x0928, 0x0939, 0x0940, 0x0902, 0x092C, 0x094B, 0x0932, 0x0938,
+            0x0915, 0x0924, 0x0947, 0x0939, 0x0948, 0x0902
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode7()
+    {
+        // Japanese (kanji and hiragana)
+        $expected = $this->hexarray2string(array(
+            0x306A, 0x305C, 0x307F, 0x3093, 0x306A, 0x65E5, 0x672C, 0x8A9E,
+            0x3092, 0x8A71, 0x3057, 0x3066, 0x304F, 0x308C, 0x306A, 0x3044,
+            0x306E, 0x304B
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode8()
+    {
+        // Russian (Cyrillic)
+        $expected = $this->hexarray2string(array(
+            0x043F, 0x043E, 0x0447, 0x0435, 0x043C, 0x0443, 0x0436, 0x0435,
+            0x043E, 0x043D, 0x0438, 0x043D, 0x0435, 0x0433, 0x043E, 0x0432,
+            0x043E, 0x0440, 0x044F, 0x0442, 0x043F, 0x043E, 0x0440, 0x0443,
+            0x0441, 0x0441, 0x043A, 0x0438
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "b1abfaaepdrnnbgefbadotcwatmq2g4l");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode9()
+    {
+        // Spanish
+        $expected = $this->hexarray2string(array(
+            0x0050, 0x006F, 0x0072, 0x0071, 0x0075, 0x00E9, 0x006E, 0x006F,
+            0x0070, 0x0075, 0x0065, 0x0064, 0x0065, 0x006E, 0x0073, 0x0069,
+            0x006D, 0x0070, 0x006C, 0x0065, 0x006D, 0x0065, 0x006E, 0x0074,
+            0x0065, 0x0068, 0x0061, 0x0062, 0x006C, 0x0061, 0x0072, 0x0065,
+            0x006E, 0x0045, 0x0073, 0x0070, 0x0061, 0x00F1, 0x006F, 0x006C
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "PorqunopuedensimplementehablarenEspaol-fmd56a");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode10()
+    {
+        // Vietnamese
+        $expected = $this->hexarray2string(array(
+            0x0054, 0x1EA1, 0x0069, 0x0073, 0x0061, 0x006F, 0x0068, 0x1ECD,
+            0x006B, 0x0068, 0x00F4, 0x006E, 0x0067, 0x0074, 0x0068, 0x1EC3,
+            0x0063, 0x0068, 0x1EC9, 0x006E, 0x00F3, 0x0069, 0x0074, 0x0069,
+            0x1EBF, 0x006E, 0x0067, 0x0056, 0x0069, 0x1EC7, 0x0074
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode11()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148, 0x751F
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "3B-ww4c5e180e575a65lsy2b");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode12()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x5B89, 0x5BA4, 0x5948, 0x7F8E, 0x6075, 0x002D, 0x0077, 0x0069,
+            0x0074, 0x0068, 0x002D, 0x0053, 0x0055, 0x0050, 0x0045, 0x0052,
+            0x002D, 0x004D, 0x004F, 0x004E, 0x004B, 0x0045, 0x0059, 0x0053
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode13()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x002D, 0x0041, 0x006E,
+            0x006F, 0x0074, 0x0068, 0x0065, 0x0072, 0x002D, 0x0057, 0x0061,
+            0x0079, 0x002D, 0x305D, 0x308C, 0x305E, 0x308C, 0x306E, 0x5834,
+            0x6240
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "Hello-Another-Way--fc4qua05auwb3674vfr0b");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode14()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x3072, 0x3068, 0x3064, 0x5C4B, 0x6839, 0x306E, 0x4E0B, 0x0032
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "2-u9tlzr9756bt3uc0v");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode15()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x004D, 0x0061, 0x006A, 0x0069, 0x3067, 0x004B, 0x006F, 0x0069,
+            0x3059, 0x308B, 0x0035, 0x79D2, 0x524D
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "MajiKoi5-783gue6qz075azm5e");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode16()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x30D1, 0x30D5, 0x30A3, 0x30FC, 0x0064, 0x0065, 0x30EB, 0x30F3, 0x30D0
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "de-jg4avhby1noc0d");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode17()
+    {
+        // Japanese
+        $expected = $this->hexarray2string(array(
+            0x305D, 0x306E, 0x30B9, 0x30D4, 0x30FC, 0x30C9, 0x3067
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "d9juau41awczczp");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode18()
+    {
+        // Greek
+        $expected = $this->hexarray2string(array(
+            0x03b5, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba, 0x03ac
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "hxargifdar");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode19()
+    {
+        // Maltese (Malti)
+        $expected = $this->hexarray2string(array(
+            0x0062, 0x006f, 0x006e, 0x0121, 0x0075, 0x0073, 0x0061, 0x0127,
+            0x0127, 0x0061
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "bonusaa-5bb1da");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testDecode20()
+    {
+        // Russian (Cyrillic)
+        $expected = $this->hexarray2string(array(
+            0x043f, 0x043e, 0x0447, 0x0435, 0x043c, 0x0443, 0x0436, 0x0435,
+            0x043e, 0x043d, 0x0438, 0x043d, 0x0435, 0x0433, 0x043e, 0x0432,
+            0x043e, 0x0440, 0x044f, 0x0442, 0x043f, 0x043e, 0x0440, 0x0443,
+            0x0441, 0x0441, 0x043a, 0x0438
+        ));
+        $result = $this->idn->decode(IDNA_ACE_PREFIX . "b1abfaaepdrnnbgefbadotcwatmq2g4l");
+        $this->assertSame($expected, $result);
+    }
+
+    public function testEncode1()
+    {
+        // Arabic (Egyptian)
+        $idna = $this->hexarray2string(array(
+            0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A, 0x0643,
+            0x0644, 0x0645, 0x0648, 0x0634, 0x0639, 0x0631, 0x0628, 0x064A,
+            0x061F
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "egbpdaj6bu4bxfgehfvwxn", $result);
+    }
+
+    public function testEncode2()
+    {
+        // Chinese (simplified)
+        $idna = $this->hexarray2string(array(
+            0x4ED6, 0x4EEC, 0x4E3A, 0x4EC0, 0x4E48, 0x4E0D, 0x8BF4, 0x4E2D, 0x6587
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "ihqwcrb4cv8a8dqg056pqjye", $result);
+    }
+
+    public function testEncode3()
+    {
+        // Chinese (traditional)
+        $idna = $this->hexarray2string(array(
+            0x4ED6, 0x5011, 0x7232, 0x4EC0, 0x9EBD, 0x4E0D, 0x8AAA, 0x4E2D, 0x6587
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "ihqwctvzc91f659drss3x8bo0yb", $result);
+    }
+
+    public function testEncode4()
+    {
+        // Czech
+        $idna = $this->hexarray2string(array(
+            0x0050, 0x0072, 0x006F, 0x010D, 0x0070, 0x0072, 0x006F, 0x0073,
+            0x0074, 0x011B, 0x006E, 0x0065, 0x006D, 0x006C, 0x0075, 0x0076,
+            0x00ED, 0x010D, 0x0065, 0x0073, 0x006B, 0x0079
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "proprostnemluvesky-uyb24dma41a", $result);
+    }
+
+    public function testEncode5()
+    {
+        // Hebrew
+        $idna = $this->hexarray2string(array(
+            0x05DC, 0x05DE, 0x05D4, 0x05D4, 0x05DD, 0x05E4, 0x05E9, 0x05D5,
+            0x05D8, 0x05DC, 0x05D0, 0x05DE, 0x05D3, 0x05D1, 0x05E8, 0x05D9,
+            0x05DD, 0x05E2, 0x05D1, 0x05E8, 0x05D9, 0x05EA
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "4dbcagdahymbxekheh6e0a7fei0b", $result);
+    }
+
+    public function testEncode6()
+    {
+        // Hindi (Devanagari)
+        $idna = $this->hexarray2string(array(
+            0x092F, 0x0939, 0x0932, 0x094B, 0x0917, 0x0939, 0x093F, 0x0928,
+            0x094D, 0x0926, 0x0940, 0x0915, 0x094D, 0x092F, 0x094B, 0x0902,
+            0x0928, 0x0939, 0x0940, 0x0902, 0x092C, 0x094B, 0x0932, 0x0938,
+            0x0915, 0x0924, 0x0947, 0x0939, 0x0948, 0x0902
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd", $result);
+    }
+
+    public function testEncode7()
+    {
+        // Japanese (kanji and hiragana)
+        $idna = $this->hexarray2string(array(
+            0x306A, 0x305C, 0x307F, 0x3093, 0x306A, 0x65E5, 0x672C, 0x8A9E,
+            0x3092, 0x8A71, 0x3057, 0x3066, 0x304F, 0x308C, 0x306A, 0x3044,
+            0x306E, 0x304B
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa", $result);
+    }
+
+    public function testEncode8()
+    {
+        // Russian (Cyrillic)
+        $idna = $this->hexarray2string(array(
+            0x043F, 0x043E, 0x0447, 0x0435, 0x043C, 0x0443, 0x0436, 0x0435,
+            0x043E, 0x043D, 0x0438, 0x043D, 0x0435, 0x0433, 0x043E, 0x0432,
+            0x043E, 0x0440, 0x044F, 0x0442, 0x043F, 0x043E, 0x0440, 0x0443,
+            0x0441, 0x0441, 0x043A, 0x0438
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "b1abfaaepdrnnbgefbadotcwatmq2g4l", $result);
+    }
+
+    public function testEncode9()
+    {
+        // Spanish
+        $idna = $this->hexarray2string(array(
+            0x0050, 0x006F, 0x0072, 0x0071, 0x0075, 0x00E9, 0x006E, 0x006F,
+            0x0070, 0x0075, 0x0065, 0x0064, 0x0065, 0x006E, 0x0073, 0x0069,
+            0x006D, 0x0070, 0x006C, 0x0065, 0x006D, 0x0065, 0x006E, 0x0074,
+            0x0065, 0x0068, 0x0061, 0x0062, 0x006C, 0x0061, 0x0072, 0x0065,
+            0x006E, 0x0045, 0x0073, 0x0070, 0x0061, 0x00F1, 0x006F, 0x006C
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "porqunopuedensimplementehablarenespaol-fmd56a", $result);
+    }
+
+    public function testEncode10()
+    {
+        // Vietnamese
+        $idna = $this->hexarray2string(array(
+            0x0054, 0x1EA1, 0x0069, 0x0073, 0x0061, 0x006F, 0x0068, 0x1ECD,
+            0x006B, 0x0068, 0x00F4, 0x006E, 0x0067, 0x0074, 0x0068, 0x1EC3,
+            0x0063, 0x0068, 0x1EC9, 0x006E, 0x00F3, 0x0069, 0x0074, 0x0069,
+            0x1EBF, 0x006E, 0x0067, 0x0056, 0x0069, 0x1EC7, 0x0074
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "tisaohkhngthchnitingvit-kjcr8268qyxafd2f1b9g", $result);
+    }
+
+    public function testEncode11()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148, 0x751F
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "3b-ww4c5e180e575a65lsy2b", $result);
+    }
+
+    public function testEncode12()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x5B89, 0x5BA4, 0x5948, 0x7F8E, 0x6075, 0x002D, 0x0077, 0x0069,
+            0x0074, 0x0068, 0x002D, 0x0053, 0x0055, 0x0050, 0x0045, 0x0052,
+            0x002D, 0x004D, 0x004F, 0x004E, 0x004B, 0x0045, 0x0059, 0x0053
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "-with-super-monkeys-pc58ag80a8qai00g7n9n", $result);
+    }
+
+    public function testEncode13()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x002D, 0x0041, 0x006E,
+            0x006F, 0x0074, 0x0068, 0x0065, 0x0072, 0x002D, 0x0057, 0x0061,
+            0x0079, 0x002D, 0x305D, 0x308C, 0x305E, 0x308C, 0x306E, 0x5834,
+            0x6240
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "hello-another-way--fc4qua05auwb3674vfr0b", $result);
+    }
+
+    public function testEncode14()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x3072, 0x3068, 0x3064, 0x5C4B, 0x6839, 0x306E, 0x4E0B, 0x0032
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "2-u9tlzr9756bt3uc0v", $result);
+    }
+
+    public function testEncode15()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x004D, 0x0061, 0x006A, 0x0069, 0x3067, 0x004B, 0x006F, 0x0069,
+            0x3059, 0x308B, 0x0035, 0x79D2, 0x524D
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "majikoi5-783gue6qz075azm5e", $result);
+    }
+
+    public function testEncode16()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x30D1, 0x30D5, 0x30A3, 0x30FC, 0x0064, 0x0065, 0x30EB, 0x30F3, 0x30D0
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "de-jg4avhby1noc0d", $result);
+    }
+
+    public function testEncode17()
+    {
+        // Japanese
+        $idna = $this->hexarray2string(array(
+            0x305D, 0x306E, 0x30B9, 0x30D4, 0x30FC, 0x30C9, 0x3067
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "d9juau41awczczp", $result);
+    }
+
+    public function testEncode18()
+    {
+        // Greek
+        $idna = $this->hexarray2string(array(
+            0x03b5, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba, 0x03ac
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "hxargifdar", $result);
+    }
+
+    public function testEncode19()
+    {
+        // Maltese (Malti)
+        $idna = $this->hexarray2string(array(
+            0x0062, 0x006f, 0x006e, 0x0121, 0x0075, 0x0073, 0x0061, 0x0127,
+            0x0127, 0x0061
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "bonusaa-5bb1da", $result);
+    }
+
+    public function testEncode20()
+    {
+        // Russian (Cyrillic)
+        $idna = $this->hexarray2string(array(
+            0x043f, 0x043e, 0x0447, 0x0435, 0x043c, 0x0443, 0x0436, 0x0435,
+            0x043e, 0x043d, 0x0438, 0x043d, 0x0435, 0x0433, 0x043e, 0x0432,
+            0x043e, 0x0440, 0x044f, 0x0442, 0x043f, 0x043e, 0x0440, 0x0443,
+            0x0441, 0x0441, 0x043a, 0x0438
+        ));
+        $result = $this->idn->encode($idna);
+        $this->assertSame(IDNA_ACE_PREFIX . "b1abfaaepdrnnbgefbadotcwatmq2g4l", $result);
+    }
+}
index a8f621cdf521076b69bb259c7e194d9a2398c55a..e00989d1fe71efffa1377750c1f5df79405a5032 100644 (file)
 /**
  * Methods for common data validations
  */
-define('VALIDATE_NUM',          '0-9');
-define('VALIDATE_SPACE',        '\s');
-define('VALIDATE_ALPHA_LOWER',  'a-z');
-define('VALIDATE_ALPHA_UPPER',  'A-Z');
-define('VALIDATE_ALPHA',        VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);
+define('VALIDATE_NUM', '0-9');
+define('VALIDATE_SPACE', '\s');
+define('VALIDATE_ALPHA_LOWER', 'a-z');
+define('VALIDATE_ALPHA_UPPER', 'A-Z');
+define('VALIDATE_ALPHA', VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);
 define('VALIDATE_EALPHA_LOWER', VALIDATE_ALPHA_LOWER . 'áéíóúýàèìòùäëïöüÿâêîôûãñõ¨åæç½ðøþß');
 define('VALIDATE_EALPHA_UPPER', VALIDATE_ALPHA_UPPER . 'ÁÉÍÓÚÝÀÈÌÒÙÄËÏÖܾÂÊÎÔÛÃÑÕ¦ÅÆǼÐØÞ');
-define('VALIDATE_EALPHA',       VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);
-define('VALIDATE_PUNCTUATION',  VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');
-define('VALIDATE_NAME',         VALIDATE_EALPHA . VALIDATE_SPACE . "'" . '\-');
-define('VALIDATE_STREET',       VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");
+define('VALIDATE_EALPHA', VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);
+define('VALIDATE_PUNCTUATION', VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');
+define('VALIDATE_NAME', VALIDATE_EALPHA . VALIDATE_SPACE . "'" . '\-');
+define('VALIDATE_STREET', VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");
 
-define('VALIDATE_ITLD_EMAILS',  1);
-define('VALIDATE_GTLD_EMAILS',  2);
+define('VALIDATE_ITLD_EMAILS', 1);
+define('VALIDATE_GTLD_EMAILS', 2);
 define('VALIDATE_CCTLD_EMAILS', 4);
-define('VALIDATE_ALL_EMAILS',   8);
+define('VALIDATE_ALL_EMAILS', 8);
 // }}}
 
 /**
@@ -74,6 +74,7 @@ define('VALIDATE_ALL_EMAILS',   8);
  * @author    Tomas V.V.Cox <cox@idecnet.com>
  * @author    Pierre-Alain Joye <pajoye@php.net>
  * @author    Amir Mohammad Saied <amir@php.net>
+ * @author    Diogo Cordeiro <diogo@fc.up.pt>
  * @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  * @version   Release: @package_version@
@@ -89,12 +90,12 @@ class Validate
      * top-level domain names.
      *
      * @access protected
-     * @var    array     $_iTld (International top-level domains)
+     * @var    array $_iTld (International top-level domains)
      */
-    var $_itld = array(
+    public $_itld = [
         'arpa',
         'root',
-    );
+    ];
 
     /**
      * Generic top-level domain
@@ -103,9 +104,9 @@ class Validate
      * generic top-level domains.
      *
      * @access protected
-     * @var    array     $_gTld (Generic top-level domains)
+     * @var    array $_gTld (Generic top-level domains)
      */
-    var $_gtld = array(
+    public $_gtld = [
         'aero',
         'biz',
         'cat',
@@ -128,7 +129,7 @@ class Validate
         'post',
         'tel',
         'geo',
-    );
+    ];
 
     /**
      * Country code top-level domains
@@ -137,74 +138,74 @@ class Validate
      * codes top-level domains
      *
      * @access protected
-     * @var    array     $_ccTld (Country Code Top-Level Domain)
+     * @var    array $_ccTld (Country Code Top-Level Domain)
      */
-    var $_cctld = array(
+    public $_cctld = [
         'ac',
-        'ad','ae','af','ag',
-        'ai','al','am','an',
-        'ao','aq','ar','as',
-        'at','au','aw','ax',
-        'az','ba','bb','bd',
-        'be','bf','bg','bh',
-        'bi','bj','bm','bn',
-        'bo','br','bs','bt',
-        'bu','bv','bw','by',
-        'bz','ca','cc','cd',
-        'cf','cg','ch','ci',
-        'ck','cl','cm','cn',
-        'co','cr','cs','cu',
-        'cv','cx','cy','cz',
-        'de','dj','dk','dm',
-        'do','dz','ec','ee',
-        'eg','eh','er','es',
-        'et','eu','fi','fj',
-        'fk','fm','fo','fr',
-        'ga','gb','gd','ge',
-        'gf','gg','gh','gi',
-        'gl','gm','gn','gp',
-        'gq','gr','gs','gt',
-        'gu','gw','gy','hk',
-        'hm','hn','hr','ht',
-        'hu','id','ie','il',
-        'im','in','io','iq',
-        'ir','is','it','je',
-        'jm','jo','jp','ke',
-        'kg','kh','ki','km',
-        'kn','kp','kr','kw',
-        'ky','kz','la','lb',
-        'lc','li','lk','lr',
-        'ls','lt','lu','lv',
-        'ly','ma','mc','md',
-        'me','mg','mh','mk',
-        'ml','mm','mn','mo',
-        'mp','mq','mr','ms',
-        'mt','mu','mv','mw',
-        'mx','my','mz','na',
-        'nc','ne','nf','ng',
-        'ni','nl','no','np',
-        'nr','nu','nz','om',
-        'pa','pe','pf','pg',
-        'ph','pk','pl','pm',
-        'pn','pr','ps','pt',
-        'pw','py','qa','re',
-        'ro','rs','ru','rw',
-        'sa','sb','sc','sd',
-        'se','sg','sh','si',
-        'sj','sk','sl','sm',
-        'sn','so','sr','st',
-        'su','sv','sy','sz',
-        'tc','td','tf','tg',
-        'th','tj','tk','tl',
-        'tm','tn','to','tp',
-        'tr','tt','tv','tw',
-        'tz','ua','ug','uk',
-        'us','uy','uz','va',
-        'vc','ve','vg','vi',
-        'vn','vu','wf','ws',
-        'ye','yt','yu','za',
-        'zm','zw',
-    );
+        'ad', 'ae', 'af', 'ag',
+        'ai', 'al', 'am', 'an',
+        'ao', 'aq', 'ar', 'as',
+        'at', 'au', 'aw', 'ax',
+        'az', 'ba', 'bb', 'bd',
+        'be', 'bf', 'bg', 'bh',
+        'bi', 'bj', 'bm', 'bn',
+        'bo', 'br', 'bs', 'bt',
+        'bu', 'bv', 'bw', 'by',
+        'bz', 'ca', 'cc', 'cd',
+        'cf', 'cg', 'ch', 'ci',
+        'ck', 'cl', 'cm', 'cn',
+        'co', 'cr', 'cs', 'cu',
+        'cv', 'cx', 'cy', 'cz',
+        'de', 'dj', 'dk', 'dm',
+        'do', 'dz', 'ec', 'ee',
+        'eg', 'eh', 'er', 'es',
+        'et', 'eu', 'fi', 'fj',
+        'fk', 'fm', 'fo', 'fr',
+        'ga', 'gb', 'gd', 'ge',
+        'gf', 'gg', 'gh', 'gi',
+        'gl', 'gm', 'gn', 'gp',
+        'gq', 'gr', 'gs', 'gt',
+        'gu', 'gw', 'gy', 'hk',
+        'hm', 'hn', 'hr', 'ht',
+        'hu', 'id', 'ie', 'il',
+        'im', 'in', 'io', 'iq',
+        'ir', 'is', 'it', 'je',
+        'jm', 'jo', 'jp', 'ke',
+        'kg', 'kh', 'ki', 'km',
+        'kn', 'kp', 'kr', 'kw',
+        'ky', 'kz', 'la', 'lb',
+        'lc', 'li', 'lk', 'lr',
+        'ls', 'lt', 'lu', 'lv',
+        'ly', 'ma', 'mc', 'md',
+        'me', 'mg', 'mh', 'mk',
+        'ml', 'mm', 'mn', 'mo',
+        'mp', 'mq', 'mr', 'ms',
+        'mt', 'mu', 'mv', 'mw',
+        'mx', 'my', 'mz', 'na',
+        'nc', 'ne', 'nf', 'ng',
+        'ni', 'nl', 'no', 'np',
+        'nr', 'nu', 'nz', 'om',
+        'pa', 'pe', 'pf', 'pg',
+        'ph', 'pk', 'pl', 'pm',
+        'pn', 'pr', 'ps', 'pt',
+        'pw', 'py', 'qa', 're',
+        'ro', 'rs', 'ru', 'rw',
+        'sa', 'sb', 'sc', 'sd',
+        'se', 'sg', 'sh', 'si',
+        'sj', 'sk', 'sl', 'sm',
+        'sn', 'so', 'sr', 'st',
+        'su', 'sv', 'sy', 'sz',
+        'tc', 'td', 'tf', 'tg',
+        'th', 'tj', 'tk', 'tl',
+        'tm', 'tn', 'to', 'tp',
+        'tr', 'tt', 'tv', 'tw',
+        'tz', 'ua', 'ug', 'uk',
+        'us', 'uy', 'uz', 'va',
+        'vc', 've', 'vg', 'vi',
+        'vn', 'vu', 'wf', 'ws',
+        'ye', 'yt', 'yu', 'za',
+        'zm', 'zw',
+    ];
     // }}}
 
     /**
@@ -212,16 +213,20 @@ class Validate
      *
      * @param string $uri tag URI to validate
      *
-     * @return boolean true if valid tag URI, false if not
+     * @return bool true if valid tag URI, false if not
      *
      * @access private
+     * @throws Exception
      */
-    function __uriRFC4151($uri)
+    private function __uriRFC4151(string $uri): bool
     {
         $datevalid = false;
         if (preg_match(
-            '/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $uri, $matches)) {
-            $date  = $matches['date'];
+            '/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/',
+            $uri,
+            $matches
+        )) {
+            $date = $matches['date'];
             $date6 = strtotime($date);
             if ((strlen($date) == 4) && $date <= date('Y')) {
                 $datevalid = true;
@@ -244,8 +249,8 @@ class Validate
     /**
      * Validate a number
      *
-     * @param string $number  Number to validate
-     * @param array  $options array where:
+     * @param string $number Number to validate
+     * @param array $options array where:
      *                          'decimal'  is the decimal char or false when decimal
      *                                     not allowed.
      *                                     i.e. ',.' to allow both ',' and '.'
@@ -253,19 +258,19 @@ class Validate
      *                          'min'      minimum value
      *                          'max'      maximum value
      *
-     * @return boolean true if valid number, false if not
+     * @return bool true if valid number, false if not
      *
      * @access public
      */
-    function number($number, $options = array())
+    public function number($number, array $options = []): bool
     {
         $decimal = $dec_prec = $min = $max = null;
         if (is_array($options)) {
             extract($options);
         }
 
-        $dec_prec  = $dec_prec ? "{1,$dec_prec}" : '+';
-        $dec_regex = $decimal  ? "[$decimal][0-9]$dec_prec" : '';
+        $dec_prec = $dec_prec ? "{1,$dec_prec}" : '+';
+        $dec_regex = $decimal ? "[$decimal][0-9]$dec_prec" : '';
 
         if (!preg_match("|^[-+]?\s*[0-9]+($dec_regex)?\$|", $number)) {
             return false;
@@ -295,17 +300,17 @@ class Validate
      *
      * @access  private
      */
-    function __stringToUtf7($string)
+    public function __stringToUtf7(string $string): string
     {
         $return = '';
-        $utf7   = array(
-                        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
-                        'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
-                        'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
-                        'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
-                        's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
-                        '3', '4', '5', '6', '7', '8', '9', '+', ','
-                    );
+        $utf7 = [
+            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
+            'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
+            'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+            'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
+            's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
+            '3', '4', '5', '6', '7', '8', '9', '+', ','
+        ];
 
 
         $state = 0;
@@ -326,7 +331,7 @@ class Validate
                         $return .= $char;
                     }
                 } elseif (($i == strlen($string) ||
-                            !((ord($char) >= 0x7F)) || (ord($char) <= 0x1F))) {
+                    !((ord($char) >= 0x7F)) || (ord($char) <= 0x1F))) {
                     if ($state != 1) {
                         if (ord($char) > 64) {
                             $return .= '';
@@ -335,24 +340,24 @@ class Validate
                         }
                     }
                     $return .= '-';
-                    $state   = 0;
+                    $state = 0;
                 } else {
-                    switch($state) {
-                    case 1:
-                        $return .= $utf7[ord($char) >> 2];
-                        $residue = (ord($char) & 0x03) << 4;
-                        $state   = 2;
-                        break;
-                    case 2:
-                        $return .= $utf7[$residue | (ord($char) >> 4)];
-                        $residue = (ord($char) & 0x0F) << 2;
-                        $state   = 3;
-                        break;
-                    case 3:
-                        $return .= $utf7[$residue | (ord($char) >> 6)];
-                        $return .= $utf7[ord($char) & 0x3F];
-                        $state   = 1;
-                        break;
+                    switch ($state) {
+                        case 1:
+                            $return .= $utf7[ord($char) >> 2];
+                            $residue = (ord($char) & 0x03) << 4;
+                            $state = 2;
+                            break;
+                        case 2:
+                            $return .= $utf7[$residue | (ord($char) >> 4)];
+                            $residue = (ord($char) & 0x0F) << 2;
+                            $state = 3;
+                            break;
+                        case 3:
+                            $return .= $utf7[$residue | (ord($char) >> 6)];
+                            $return .= $utf7[ord($char) & 0x3F];
+                            $state = 1;
+                            break;
                     }
                 }
                 $i++;
@@ -365,17 +370,17 @@ class Validate
     /**
      * Validate an email according to full RFC822 (inclusive human readable part)
      *
-     * @param string $email   email to validate,
+     * @param string $email email to validate,
      *                        will return the address for optional dns validation
-     * @param array  $options email() options
+     * @param array $options email() options
      *
-     * @return boolean true if valid email, false if not
+     * @return bool true if valid email, false if not
      *
      * @access private
      */
-    function __emailRFC822(&$email, &$options)
+    private function __emailRFC822(string &$email, array &$options): bool
     {
-        static $address   = null;
+        static $address = null;
         static $uncomment = null;
         if (!$address) {
             // atom        =  1*<any CHAR except specials, SPACE and CTLs>
@@ -410,7 +415,7 @@ class Validate
             // route-addr  =  "<" [route] addr-spec ">"
             $route_addr = '<\s*(?:' . $route . ')?' . $addr_spec . '>\s*';
             // phrase      =  1*word                       ; Sequence of words
-            $phrase = $word  . '+';
+            $phrase = $word . '+';
             // mailbox     =  addr-spec                    ; simple address
             //             /  phrase route-addr            ; name & addr-spec
             $mailbox = '(?:' . $addr_spec . '|' . $phrase . $route_addr . ')';
@@ -421,8 +426,8 @@ class Validate
             $address = '/^\s*(?:' . $mailbox . '|' . $group . ')$/';
 
             $uncomment =
-            '/((?:(?:\\\\"|[^("])*(?:' . $quoted_string .
-                                             ')?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/';
+                '/((?:(?:\\\\"|[^("])*(?:' . $quoted_string .
+                ')?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/';
         }
         // strip comments
         $email = preg_replace($uncomment, '$1 ', $email);
@@ -435,19 +440,25 @@ class Validate
      * This function is used to make a much more proficient validation
      * against all types of official domain names.
      *
-     * @param string $email   The email address to check.
-     * @param array  $options The options for validation
+     * @param string $email The email address to check.
+     * @param array $options The options for validation
      *
      * @access protected
      *
      * @return bool True if validating succeeds
      */
-    function _fullTLDValidation($email, $options)
+    public function _fullTLDValidation(string $email, array $options): bool
     {
-        $validate = array();
-        if(!empty($options["VALIDATE_ITLD_EMAILS"])) array_push($validate, 'itld');
-        if(!empty($options["VALIDATE_GTLD_EMAILS"])) array_push($validate, 'gtld');
-        if(!empty($options["VALIDATE_CCTLD_EMAILS"])) array_push($validate, 'cctld');
+        $validate = [];
+        if (!empty($options["VALIDATE_ITLD_EMAILS"])) {
+            array_push($validate, 'itld');
+        }
+        if (!empty($options["VALIDATE_GTLD_EMAILS"])) {
+            array_push($validate, 'gtld');
+        }
+        if (!empty($options["VALIDATE_CCTLD_EMAILS"])) {
+            array_push($validate, 'cctld');
+        }
 
         if (count($validate) === 0) {
             array_push($validate, 'itld', 'gtld', 'cctld');
@@ -455,7 +466,7 @@ class Validate
 
         $self = new Validate;
 
-        $toValidate = array();
+        $toValidate = [];
 
         foreach ($validate as $valid) {
             $tmpVar = '_' . (string)$valid;
@@ -474,17 +485,17 @@ class Validate
      * This function will execute the full email vs tld
      * validation using an array of tlds passed to it.
      *
-     * @param string $email       The email to validate.
-     * @param array  $arrayOfTLDs The array of the TLDs to validate
+     * @param string $email The email to validate.
+     * @param array $arrayOfTLDs The array of the TLDs to validate
      *
      * @access public
      *
-     * @return true or false (Depending on if it validates or if it does not)
+     * @return bool true or false (Depending on if it validates or if it does not)
      */
-    function executeFullEmailValidation($email, $arrayOfTLDs)
+    public function executeFullEmailValidation(string $email, array $arrayOfTLDs): bool
     {
         $emailEnding = explode('.', $email);
-        $emailEnding = $emailEnding[count($emailEnding)-1];
+        $emailEnding = $emailEnding[count($emailEnding) - 1];
         foreach ($arrayOfTLDs as $validator => $keys) {
             if (in_array($emailEnding, $keys)) {
                 return true;
@@ -496,30 +507,31 @@ class Validate
     /**
      * Validate an email
      *
-     * @param string $email  email to validate
+     * @param string $email email to validate
      * @param mixed  boolean (BC) $check_domain Check or not if the domain exists
      *              array $options associative array of options
      *              'check_domain' boolean Check or not if the domain exists
      *              'use_rfc822' boolean Apply the full RFC822 grammar
      *
      * Ex.
-     *  $options = array(
+     *  $options = [
      *      'check_domain' => 'true',
      *      'fullTLDValidation' => 'true',
      *      'use_rfc822' => 'true',
      *      'VALIDATE_GTLD_EMAILS' => 'true',
      *      'VALIDATE_CCTLD_EMAILS' => 'true',
      *      'VALIDATE_ITLD_EMAILS' => 'true',
-     *      );
+     *      ];
      *
-     * @return boolean true if valid email, false if not
+     * @return bool true if valid email, false if not
      *
      * @access public
+     * @throws Exception
      */
-    function email($email, $options = null)
+    public function email(string $email, array $options = null): bool
     {
         $check_domain = false;
-        $use_rfc822   = false;
+        $use_rfc822 = false;
         if (is_bool($options)) {
             $check_domain = $options;
         } elseif (is_array($options)) {
@@ -532,8 +544,8 @@ class Validate
          */
         $hasIDNA = false;
 
-        if (Validate::_includePathFileExists('Net/IDNA.php')) {
-            include_once('Net/IDNA.php');
+        if (Validate::_includePathFileExists('Net/IDNA2.php')) {
+            include_once('Net/IDNA2.php');
             $hasIDNA = true;
         }
 
@@ -546,7 +558,7 @@ class Validate
                 // it's an idn domain name.
                 $chars = count_chars($domain, 1);
                 if (!empty($chars) && max(array_keys($chars)) > 127) {
-                    $idna   =& Net_IDNA::singleton();
+                    $idna =& Net_IDNA2::singleton();
                     $domain = $idna->encode($domain);
                 }
 
@@ -580,8 +592,8 @@ class Validate
          $&xi';
 
         //checks if exists the domain (MX or A)
-        if ($use_rfc822? Validate::__emailRFC822($email, $options) :
-                preg_match($regex, $email)) {
+        if ($use_rfc822 ? Validate::__emailRFC822($email, $options) :
+            preg_match($regex, $email)) {
             if ($check_domain && function_exists('checkdnsrr')) {
                 $domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email)));
                 if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
@@ -597,20 +609,20 @@ class Validate
     /**
      * Validate a string using the given format 'format'
      *
-     * @param string $string  String to validate
-     * @param array  $options Options array where:
+     * @param string $string String to validate
+     * @param array|string $options Options array where:
      *                          'format' is the format of the string
      *                              Ex:VALIDATE_NUM . VALIDATE_ALPHA (see constants)
      *                          'min_length' minimum length
      *                          'max_length' maximum length
      *
-     * @return boolean true if valid string, false if not
+     * @return bool true if valid string, false if not
      *
      * @access public
      */
-    function string($string, $options)
+    public function string(string $string, $options): bool
     {
-        $format     = null;
+        $format = null;
         $min_length = 0;
         $max_length = 0;
 
@@ -639,7 +651,7 @@ class Validate
      * only http, https, ftp and such you have to pass it in the allowed_schemes
      * option, like this:
      * <code>
-     * $options = array('allowed_schemes' => array('http', 'https', 'ftp'))
+     * $options = ['allowed_schemes' => ['http', 'https', 'ftp']]
      * var_dump(Validate::uri('http://www.example.org', $options));
      * </code>
      *
@@ -653,8 +665,8 @@ class Validate
      *         the characters ';/?:@$,' will not be accepted in the query part
      *         if not urlencoded, refer to the option "strict'"
      *
-     * @param string $url     URI to validate
-     * @param array  $options Options used by the validation method.
+     * @param string $url URI to validate
+     * @param array|null $options Options used by the validation method.
      *                          key => type
      *                          'domain_check' => boolean
      *                              Whether to check the DNS entry or not
@@ -666,11 +678,12 @@ class Validate
      *                              default: ';/?:@$,'
      *                              empty: accept all rfc2396 foreseen chars
      *
-     * @return boolean true if valid uri, false if not
+     * @return bool true if valid uri, false if not
      *
      * @access public
+     * @throws Exception
      */
-    function uri($url, $options = null)
+    public function uri(string $url, $options = null): bool
     {
         $strict = ';/?:@$,';
         $domain_check = false;
@@ -687,7 +700,7 @@ class Validate
         }
 
         if (preg_match(
-             '&^(?:([a-z][-+.a-z0-9]*):)?                             # 1. scheme
+            '&^(?:([a-z][-+.a-z0-9]*):)?                             # 1. scheme
               (?://                                                   # authority start
               (?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:\&=+$,])*)@)?    # 2. authority-userinfo
               (?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?)  # 3. authority-hostname OR
@@ -696,9 +709,12 @@ class Validate
               ((?:/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*/?)? # 6. path
               (?:\?([^#]*))?                                          # 7. query
               (?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();/?:@\&=+$,])*))? # 8. fragment
-              $&xi', $url, $matches)) {
+              $&xi',
+            $url,
+            $matches
+        )) {
             $scheme = isset($matches[1]) ? $matches[1] : '';
-            $authority = isset($matches[3]) ? $matches[3] : '' ;
+            $authority = isset($matches[3]) ? $matches[3] : '';
             if (is_array($allowed_schemes) &&
                 !in_array($scheme, $allowed_schemes)
             ) {
@@ -719,7 +735,7 @@ class Validate
             if ($strict) {
                 $strict = '#[' . preg_quote($strict, '#') . ']#';
                 if ((!empty($matches[7]) && preg_match($strict, $matches[7]))
-                 || (!empty($matches[8]) && preg_match($strict, $matches[8]))) {
+                    || (!empty($matches[8]) && preg_match($strict, $matches[8]))) {
                     return false;
                 }
             }
@@ -731,30 +747,28 @@ class Validate
     /**
      * Validate date and times. Note that this method need the Date_Calc class
      *
-     * @param string $date    Date to validate
-     * @param array  $options array options where :
+     * @param string $date Date to validate
+     * @param array $options array options where :
      *                          'format' The format of the date (%d-%m-%Y)
      *                                   or rfc822_compliant
      *                          'min'    The date has to be greater
-     *                                   than this array($day, $month, $year)
+     *                                   than this [$day, $month, $year]
      *                                   or PEAR::Date object
      *                          'max'    The date has to be smaller than
-     *                                   this array($day, $month, $year)
+     *                                   this [$day, $month, $year]
      *                                   or PEAR::Date object
      *
-     * @return boolean true if valid date/time, false if not
+     * @return bool true if valid date/time, false if not
      *
      * @access public
      */
-    function date($date, $options)
+    public function date(string $date, array $options): bool
     {
-        $max    = false;
-        $min    = false;
+        $max = false;
+        $min = false;
         $format = '';
 
-        if (is_array($options)) {
-            extract($options);
-        }
+        extract($options);
 
         if (strtolower($format) == 'rfc822_compliant') {
             $preg = '&^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),) \s+
@@ -768,23 +782,23 @@ class Validate
                 return false;
             }
 
-            $year    = (int)$matches[4];
-            $months  = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-                             'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
-            $month   = array_keys($months, $matches[3]);
-            $month   = (int)$month[0]+1;
-            $day     = (int)$matches[2];
+            $year = (int)$matches[4];
+            $months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+            $month = array_keys($months, $matches[3]);
+            $month = (int)$month[0] + 1;
+            $day = (int)$matches[2];
             $weekday = $matches[1];
-            $hour    = (int)$matches[6];
-            $minute  = (int)$matches[7];
+            $hour = (int)$matches[6];
+            $minute = (int)$matches[7];
             isset($matches[9]) ? $second = (int)$matches[9] : $second = 0;
 
-            if ((strlen($year) != 4)        ||
-                ($day    > 31   || $day < 1)||
-                ($hour   > 23)  ||
-                ($minute > 59)  ||
+            if ((strlen($year) != 4) ||
+                ($day > 31 || $day < 1) ||
+                ($hour > 23) ||
+                ($minute > 59) ||
                 ($second > 59)) {
-                    return false;
+                return false;
             }
         } else {
             $date_len = strlen($format);
@@ -793,72 +807,72 @@ class Validate
                 if ($c == '%') {
                     $next = $format{$i + 1};
                     switch ($next) {
-                    case 'j':
-                    case 'd':
-                        if ($next == 'j') {
-                            $day = (int)Validate::_substr($date, 1, 2);
-                        } else {
-                            $day = (int)Validate::_substr($date, 0, 2);
-                        }
-                        if ($day < 1 || $day > 31) {
-                            return false;
-                        }
-                        break;
-                    case 'm':
-                    case 'n':
-                        if ($next == 'm') {
-                            $month = (int)Validate::_substr($date, 0, 2);
-                        } else {
-                            $month = (int)Validate::_substr($date, 1, 2);
-                        }
-                        if ($month < 1 || $month > 12) {
-                            return false;
-                        }
-                        break;
-                    case 'Y':
-                    case 'y':
-                        if ($next == 'Y') {
-                            $year = Validate::_substr($date, 4);
-                            $year = (int)$year?$year:'';
-                        } else {
-                            $year = (int)(substr(date('Y'), 0, 2) .
-                                              Validate::_substr($date, 2));
-                        }
-                        if (strlen($year) != 4 || $year < 0 || $year > 9999) {
-                            return false;
-                        }
-                        break;
-                    case 'g':
-                    case 'h':
-                        if ($next == 'g') {
-                            $hour = Validate::_substr($date, 1, 2);
-                        } else {
-                            $hour = Validate::_substr($date, 2);
-                        }
-                        if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 12) {
-                            return false;
-                        }
-                        break;
-                    case 'G':
-                    case 'H':
-                        if ($next == 'G') {
-                            $hour = Validate::_substr($date, 1, 2);
-                        } else {
-                            $hour = Validate::_substr($date, 2);
-                        }
-                        if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 24) {
-                            return false;
-                        }
-                        break;
-                    case 's':
-                    case 'i':
-                        $t = Validate::_substr($date, 2);
-                        if (!preg_match('/^\d+$/', $t) || $t < 0 || $t > 59) {
-                            return false;
-                        }
-                        break;
-                    default:
-                        trigger_error("Not supported char `$next' after % in offset " . ($i+2), E_USER_WARNING);
+                        case 'j':
+                        case 'd':
+                            if ($next == 'j') {
+                                $day = (int)Validate::_substr($date, 1, 2);
+                            } else {
+                                $day = (int)Validate::_substr($date, 0, 2);
+                            }
+                            if ($day < 1 || $day > 31) {
+                                return false;
+                            }
+                            break;
+                        case 'm':
+                        case 'n':
+                            if ($next == 'm') {
+                                $month = (int)Validate::_substr($date, 0, 2);
+                            } else {
+                                $month = (int)Validate::_substr($date, 1, 2);
+                            }
+                            if ($month < 1 || $month > 12) {
+                                return false;
+                            }
+                            break;
+                        case 'Y':
+                        case 'y':
+                            if ($next == 'Y') {
+                                $year = Validate::_substr($date, 4);
+                                $year = (int)$year ? $year : '';
+                            } else {
+                                $year = (int)(substr(date('Y'), 0, 2) .
+                                    Validate::_substr($date, 2));
+                            }
+                            if (strlen($year) != 4 || $year < 0 || $year > 9999) {
+                                return false;
+                            }
+                            break;
+                        case 'g':
+                        case 'h':
+                            if ($next == 'g') {
+                                $hour = Validate::_substr($date, 1, 2);
+                            } else {
+                                $hour = Validate::_substr($date, 2);
+                            }
+                            if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 12) {
+                                return false;
+                            }
+                            break;
+                        case 'G':
+                        case 'H':
+                            if ($next == 'G') {
+                                $hour = Validate::_substr($date, 1, 2);
+                            } else {
+                                $hour = Validate::_substr($date, 2);
+                            }
+                            if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 24) {
+                                return false;
+                            }
+                            break;
+                        case 's':
+                        case 'i':
+                            $t = Validate::_substr($date, 2);
+                            if (!preg_match('/^\d+$/', $t) || $t < 0 || $t > 59) {
+                                return false;
+                            }
+                            break;
+                        default:
+                            trigger_error("Not supported char `$next' after % in offset " . ($i + 2), E_USER_WARNING);
                     }
                     $i++;
                 } else {
@@ -874,7 +888,7 @@ class Validate
             return false;
         }
 
-        if (isset($day) && isset($month) && isset($year)) {
+        if (isset($day) && isset($month) && isset($year) && isset($weekday)) {
             if (!checkdate($month, $day, $year)) {
                 return false;
             }
@@ -888,13 +902,25 @@ class Validate
             if ($min) {
                 include_once 'Date/Calc.php';
                 if (is_a($min, 'Date') &&
-                    (Date_Calc::compareDates($day, $month, $year,
-                        $min->getDay(), $min->getMonth(), $min->getYear()) < 0)
+                    (Date_Calc::compareDates(
+                        $day,
+                        $month,
+                        $year,
+                        $min->getDay(),
+                        $min->getMonth(),
+                        $min->getYear()
+                    ) < 0)
                 ) {
                     return false;
                 } elseif (is_array($min) &&
-                        (Date_Calc::compareDates($day, $month, $year,
-                            $min[0], $min[1], $min[2]) < 0)
+                    (Date_Calc::compareDates(
+                        $day,
+                        $month,
+                        $year,
+                        $min[0],
+                        $min[1],
+                        $min[2]
+                    ) < 0)
                 ) {
                     return false;
                 }
@@ -903,13 +929,25 @@ class Validate
             if ($max) {
                 include_once 'Date/Calc.php';
                 if (is_a($max, 'Date') &&
-                    (Date_Calc::compareDates($day, $month, $year,
-                        $max->getDay(), $max->getMonth(), $max->getYear()) > 0)
+                    (Date_Calc::compareDates(
+                        $day,
+                        $month,
+                        $year,
+                        $max->getDay(),
+                        $max->getMonth(),
+                        $max->getYear()
+                    ) > 0)
                 ) {
                     return false;
                 } elseif (is_array($max) &&
-                        (Date_Calc::compareDates($day, $month, $year,
-                            $max[0], $max[1], $max[2]) > 0)
+                    (Date_Calc::compareDates(
+                        $day,
+                        $month,
+                        $year,
+                        $max[0],
+                        $max[1],
+                        $max[2]
+                    ) > 0)
                 ) {
                     return false;
                 }
@@ -923,15 +961,15 @@ class Validate
      * Substr
      *
      * @param string &$date Date
-     * @param string $num   Length
-     * @param string $opt   Unknown
+     * @param string $num Length
+     * @param string|false $opt Unknown
      *
      * @access private
      * @return string
      */
-    function _substr(&$date, $num, $opt = false)
+    private function _substr(string &$date, string $num, $opt = false): string
     {
-        if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{'.$opt.'}/', $date, $m)) {
+        if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{' . $opt . '}/', $date, $m)) {
             $ret = $m[0];
         } else {
             $ret = substr($date, 0, $num);
@@ -940,7 +978,7 @@ class Validate
         return $ret;
     }
 
-    function _modf($val, $div)
+    public function _modf($val, $div)
     {
         if (function_exists('bcmod')) {
             return bcmod($val, $div);
@@ -955,14 +993,14 @@ class Validate
     /**
      * Calculates sum of product of number digits with weights
      *
-     * @param string $number  number string
-     * @param array  $weights reference to array of weights
+     * @param string $number number string
+     * @param array $weights reference to array of weights
      *
      * @access protected
      *
      * @return int returns product of number digits with weights
      */
-    function _multWeights($number, &$weights)
+    public function _multWeights(string $number, array &$weights): int
     {
         if (!is_array($weights)) {
             return -1;
@@ -983,17 +1021,17 @@ class Validate
     /**
      * Calculates control digit for a given number
      *
-     * @param string $number     number string
-     * @param array  $weights    reference to array of weights
-     * @param int    $modulo     (optionsl) number
-     * @param int    $subtract   (optional) number
-     * @param bool   $allow_high (optional) true if function can return number higher than 10
+     * @param string $number number string
+     * @param array $weights reference to array of weights
+     * @param int $modulo (optionsl) number
+     * @param int $subtract (optional) number
+     * @param bool $allow_high (optional) true if function can return number higher than 10
      *
      * @access protected
      *
      * @return  int -1 calculated control number is returned
      */
-    function _getControlNumber($number, &$weights, $modulo = 10, $subtract = 0, $allow_high = false)
+    public function _getControlNumber(string $number, array &$weights, int $modulo = 10, int $subtract = 0, bool $allow_high = false): int
     {
         // calc sum
         $sum = Validate::_multWeights($number, $weights);
@@ -1014,21 +1052,21 @@ class Validate
     /**
      * Validates a number
      *
-     * @param string $number   number to validate
-     * @param array  $weights  reference to array of weights
-     * @param int    $modulo   (optional) number
-     * @param int    $subtract (optional) number
+     * @param string $number number to validate
+     * @param array $weights reference to array of weights
+     * @param int $modulo (optional) number
+     * @param int $subtract (optional) number
      *
      * @access protected
      *
      * @return  bool true if valid, false if not
      */
-    function _checkControlNumber($number, &$weights, $modulo = 10, $subtract = 0)
+    public function _checkControlNumber(string $number, array &$weights, int $modulo = 10, int $subtract = 0): bool
     {
         if (strlen($number) < count($weights)) {
             return false;
         }
-        $target_digit  = substr($number, count($weights), 1);
+        $target_digit = substr($number, count($weights), 1);
         $control_digit = Validate::_getControlNumber($number, $weights, $modulo, $subtract, $modulo > 10);
 
         if ($control_digit == -1) {
@@ -1048,22 +1086,22 @@ class Validate
      * assoc array in the form $var_name => $value.
      * Can be used on any of Validate subpackages
      *
-     * @param array   $data     Ex: array('name' => 'toto', 'email' => 'toto@thing.info');
-     * @param array   $val_type Contains the validation type and all parameters used in.
+     * @param array $data Ex: ['name' => 'toto', 'email' => 'toto@thing.info'];
+     * @param array $val_type Contains the validation type and all parameters used in.
      *                          'val_type' is not optional
      *                          others validations properties must have the same name as the function
      *                          parameters.
-     *                          Ex: array('toto'=>array('type'=>'string','format'='toto@thing.info','min_length'=>5));
-     * @param boolean $remove   if set, the elements not listed in data will be removed
+     *                          Ex: ['toto' => ['type'=>'string','format'='toto@thing.info','min_length'=>5]];
+     * @param bool  $remove if set, the elements not listed in data will be removed
      *
      * @return array   value name => true|false    the value name comes from the data key
      *
      * @access public
      */
-    function multiple(&$data, &$val_type, $remove = false)
+    public function multiple(array &$data, array &$val_type, bool $remove = false): array
     {
-        $keys  = array_keys($data);
-        $valid = array();
+        $keys = array_keys($data);
+        $valid = [];
 
         foreach ($keys as $var_name) {
             if (!isset($val_type[$var_name])) {
@@ -1072,8 +1110,8 @@ class Validate
                 }
                 continue;
             }
-            $opt       = $val_type[$var_name];
-            $methods   = get_class_methods('Validate');
+            $opt = $val_type[$var_name];
+            $methods = get_class_methods('Validate');
             $val2check = $data[$var_name];
             // core validation method
             if (in_array(strtolower($opt['type']), $methods)) {
@@ -1084,19 +1122,19 @@ class Validate
                 if (sizeof($opt) == 1 && is_array(reset($opt))) {
                     $opt = array_pop($opt);
                 }
-                $valid[$var_name] = call_user_func(array('Validate', $method), $val2check, $opt);
+                $valid[$var_name] = call_user_func(['Validate', $method], $val2check, $opt);
 
-                /**
-                 * external validation method in the form:
-                 * "<class name><underscore><method name>"
-                 * Ex: us_ssn will include class Validate/US.php and call method ssn()
-                 */
+            /**
+             * external validation method in the form:
+             * "<class name><underscore><method name>"
+             * Ex: us_ssn will include class Validate/US.php and call method ssn()
+             */
             } elseif (strpos($opt['type'], '_') !== false) {
                 $validateType = explode('_', $opt['type']);
-                $method       = array_pop($validateType);
-                $class        = implode('_', $validateType);
-                $classPath    = str_replace('_', DIRECTORY_SEPARATOR, $class);
-                $class        = 'Validate_' . $class;
+                $method = array_pop($validateType);
+                $class = implode('_', $validateType);
+                $classPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
+                $class = 'Validate_' . $class;
                 if (Validate::_includePathFileExists("Validate/$classPath.php")) {
                     include_once "Validate/$classPath.php";
                 } else {
@@ -1108,19 +1146,26 @@ class Validate
                 if (!$ce ||
                     !in_array($method, get_class_methods($class))
                 ) {
-                    trigger_error("Invalid validation type $class::$method",
-                        E_USER_WARNING);
+                    trigger_error(
+                        "Invalid validation type $class::$method",
+                        E_USER_WARNING
+                    );
                     continue;
                 }
                 unset($opt['type']);
                 if (sizeof($opt) == 1) {
                     $opt = array_pop($opt);
                 }
-                $valid[$var_name] = call_user_func(array($class, $method),
-                    $data[$var_name], $opt);
+                $valid[$var_name] = call_user_func(
+                    array($class, $method),
+                    $data[$var_name],
+                    $opt
+                );
             } else {
-                trigger_error("Invalid validation type {$opt['type']}",
-                    E_USER_WARNING);
+                trigger_error(
+                    "Invalid validation type {$opt['type']}",
+                    E_USER_WARNING
+                );
             }
         }
         return $valid;
@@ -1135,15 +1180,18 @@ class Validate
      *
      * @return bool true if file exists
      */
-    function _includePathFileExists($filename)
+    private function _includePathFileExists(string $filename): bool
     {
         $paths = explode(":", ini_get("include_path"));
         $result = false;
 
-        while ((!($result)) && (list($key,$val) = each($paths))) {
+        foreach ($paths as $val) {
             $result = file_exists($val . "/" . $filename);
+            if ($result) {
+                break;
+            }
         }
+
         return $result;
     }
 }
-
diff --git a/extlib/buildPackageXML.php b/extlib/buildPackageXML.php
new file mode 100644 (file)
index 0000000..fa242e8
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
+// $Id$
+
+require_once 'PEAR/PackageFileManager2.php';
+require_once 'PEAR/PackageFileManager/Git.php';
+
+$pkg = new PEAR_PackageFileManager2;
+
+$options = array(
+    'simpleoutput' => true,
+    'baseinstalldir' => '/',
+    'packagefile' => 'package.xml',
+    'packagedirectory' => dirname(__FILE__),
+    'filelistgenerator' => 'Git',
+    'dir_roles' => array(
+        'tests' => 'test',
+        'docs' => 'doc',
+        'data' => 'data'
+    ),
+    'ignore' => array(
+        'package.xml',
+        'package2.xml',
+        '*.tgz',
+        basename(__FILE__)
+    )
+);
+
+$pkg->setOptions($options);
+
+$desc = <<<EOT
+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.
+
+EOT;
+
+$notes = <<<EOT
+QA release.
+Users are strongly encouraged to adopt to inbuilt DateTime functionality.
+
+Bug #17730 Patch: Avoid ereg, using preg_match
+Doc Bug #15029 large Date_Span's cannot be created
+Bug #14929 Timezone summertime
+Bug #14856 America/Moncton longname and dstlongname missing
+Bug #14084 TZ variable being set wrecks global config
+Bug #13615 America/Toronto time-zone is missing longname and dstlongname
+Bug #13545 Date_Span::set() doesn't work when passed an int and format
+Req #13488 Please rename Methods format2 and format3
+EOT;
+
+$summary = <<<EOT
+Generic date/time handling class for PEAR
+EOT;
+
+// Some hard-coded stuffs.
+$pkg->setPackage('Date');
+$pkg->setSummary($summary);
+$pkg->setDescription($desc);
+$pkg->setChannel('pear.php.net');
+$pkg->setAPIVersion('1.5.0');
+$pkg->setReleaseVersion('1.5.0a2');
+$pkg->setReleaseStability('alpha');
+$pkg->setAPIStability('alpha');
+$pkg->setNotes($notes);
+$pkg->setPackageType('php');
+$pkg->setLicense('BSD License',
+    'http://www.opensource.org/licenses/bsd-license.php');
+
+// Add maintainers.
+$pkg->addMaintainer('lead', 'baba', 'Baba Buehler', 'baba@babaz.com', 'no');
+$pkg->addMaintainer('lead', 'pajoye', 'Pierre-Alain Joye', 'pajoye@php.net', 'no');
+$pkg->addMaintainer('lead', 'mohrt', 'Monte Ohrt', 'mohrt@php.net', 'no');
+$pkg->addMaintainer('lead', 'firman', 'Firman Wandayandi', 'firman@php.net');
+$pkg->addMaintainer('lead', 'c01234', 'C.A. Woodcock', 'c01234@netcomuk.co.uk');
+$pkg->addMaintainer('developer', 'alan_k', 'Alan Knowles', 'alan@akbkhome.com');
+$pkg->addMaintainer('helper', 'scar', 'Leonardo Dutra', 'scar@php.net');
+
+// Core dependencies.
+$pkg->setPhpDep('4.3');
+$pkg->setPearinstallerDep('1.4.0');
+
+//$pkg->addDependency("Numbers_Words", "0.15.0", "eq", "pkg", true);
+//$pkg->detectDependencies();
+
+// Add some replacements.
+$pkg->addGlobalReplacement('package-info', '@package_version@', 'version');
+
+// Generate file contents.
+$pkg->generateContents();
+
+// Writes a package.xml.
+if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
+    $e = $pkg->writePackageFile();
+
+    // Some errors occurs.
+    if (PEAR::isError($e)) {
+        throw new Exception('Unable to write package file. Got message: ' .
+            $e->getMessage());
+    }
+} else {
+    $pkg->debugPackageFile();
+}
+
+
+/*
+ * Local variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
index f7d93ee9236f103f514ff3a4c8c6b0dfd5e22d72..4cc80adc51aede43bf071ce367afbbb271c1721b 100644 (file)
@@ -32,7 +32,7 @@ defined('GNUSOCIAL') || die();
 define('GNUSOCIAL_ENGINE', 'GNU social');
 define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
 
-define('GNUSOCIAL_BASE_VERSION', '1.26.0');
+define('GNUSOCIAL_BASE_VERSION', '1.26.1');
 define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
 
 define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
index e02d73ea705dc005a4ad20b24ff2c2c17b2b7038..87ad7f4df57706629d2c385a69afdcdc05308920 100644 (file)
@@ -1978,8 +1978,8 @@ function common_valid_domain($domain)
     }
 
     try {
-        require_once "Net/IDNA.php";
-        $idn = Net_IDNA::getInstance();
+        require_once "Net/IDNA2.php";
+        $idn = Net_IDNA2::getInstance();
         $domain = $idn->encode($domain);
     } catch (Exception $e) {
         return false;