File: Date.php
Source Location: /Date-1.5.0a4/Date.php
Classes:
Date
Generic date handling class for PEAR
Page Details:
Generic date handling class for PEAR
Handles time zones and changes from local standard to local Summer time (daylight-saving time) through the Date_TimeZone class. Supports several operations from 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.
Includes:
DATE_CAPTURE_MICROTIME_BY_DEFAULT [line 93]
DATE_CORRECTINVALIDTIME_DEFAULT [line 154]
DATE_CORRECTINVALIDTIME_DEFAULT = true
|
|
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: $date_object->formatLikeSQL('HH.MI.SS');
or: $date_object->addSeconds(30);
an error will be returned if the time is invalid. However, if the user calls: $date_object->addDays(1);
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: - the user uses a time zone that does not observe Summer time, e.g. UTC
- the user never accesses the time, that is, he never makes a call to
Date::getHour() or Date::formatLikeStrftime() using
format code '%H', for example, even if he sets the time to
something invalid
- the user sets DATE_CORRECTINVALIDTIME_DEFAULT to true
DATE_COUNT_LEAP_SECONDS [line 202]
DATE_ERROR_INVALIDDATE [line 54]
DATE_ERROR_INVALIDDATEFORMAT [line 57]
DATE_ERROR_INVALIDFORMATSTRING [line 58]
DATE_ERROR_INVALIDTIME [line 55]
DATE_ERROR_INVALIDTIMEZONE [line 56]
DATE_FORMAT_ISO [line 218]
DATE_FORMAT_ISO_BASIC [line 223]
DATE_FORMAT_ISO_EXTENDED [line 228]
DATE_FORMAT_ISO_EXTENDED_MICROTIME [line 233]
DATE_FORMAT_METHOD [line 209]
DATE_FORMAT_TIMESTAMP [line 238]
DATE_FORMAT_UNIXTIME [line 243]
DATE_VALIDATE_DATE_BY_DEFAULT [line 181]
Documentation generated on Mon, 11 Mar 2019 15:55:00 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|