if Daylight Savings Time, "0" otherwise.
W - ISO-8601 week number of year, weeks starting on Monday
</pre>
FUNCTION adodb_gmdate($fmt, $timestamp = false)
Convert a timestamp to a formatted GMT date. If $timestamp is not defined, the
current timestamp is used. Unlike the function date(), it supports dates
outside the 1901 to 2038 range.
FUNCTION adodb_mktime($hr, $min, $sec, $month, $day, $year)
Converts a local date to a unix timestamp. Unlike the function mktime(), it supports
dates outside the 1901 to 2038 range. Differs from mktime() in that all parameters
are currently compulsory.
FUNCTION adodb_gmmktime($hr, $min, $sec, $month, $day, $year)
Converts a gmt date to a unix timestamp. Unlike the function gmmktime(), it supports
dates outside the 1901 to 2038 range. Differs from gmmktime() in that all parameters
are currently compulsory.
=============================================================================
NOTES
Useful url for generating test timestamps:
http://www.4
webhelp.net/us/timestamp.php
Possible future optimizations include
a. Using an algorithm similar to Plauger's in "The Standard C Library"
(page 428, xttotm.c _Ttotm() function). Plauger's algorithm will not
work outside 32-bit signed range, so i decided not to implement it.
b. Iterate over a block of years (say 12) when searching for the
correct year.
c. Implement daylight savings, which looks awfully complicated, see
http://webexhibits.org/daylightsaving/
CHANGELOG
- 3 March 2003 0.08
Added support for 'S' adodb_date() format char. Added constant ADODB_ALLOW_NEGATIVE_TS
if you want PHP to handle negative timestamps between 1901 to 1969.
- 27 Feb 2003 0.07
All negative numbers handled by adodb now because of RH 7.3+ problems.
See http://bugs.php.net/bug.php?id=20048&edit=2
- 4 Feb 2003 0.06
Fixed a typo, 1852 changed to 1582! This means that pre-1852 dates
are now correctly handled.
- 29 Jan 2003 0.05
Leap year checking differs under Julian calendar (pre 1582). Also
leap year code optimized by checking for most common case first.
We also handle month overflow correctly in mktime (eg month set to 13).
Day overflow for less than one month's days is supported.
- 28 Jan 2003 0.04
Gregorian correction handled. In PHP5, we might throw an error if
mktime uses invalid dates around 5-14 Oct 1582. Released with ADOdb 3.10.
Added limbo 5-14 Oct 1582 check, when we set to 15 Oct 1582.
- 27 Jan 2003 0.03
Fixed some more month problems due to gmt issues. Added constant ADODB_DATE_VERSION.
Fixed calculation of days since start of year for <1970.
- 27 Jan 2003 0.02
Changed _adodb_getdate() to inline leap year checking for better performance.
Fixed problem with time-zones west of GMT +0000.
- 24 Jan 2003 0.01
First implementation.
*/
/* Initialization */
/*
Version Number
*/
define('ADODB_DATE_VERSION',0.08);
/*
We check for Windows as only +ve ints are accepted as dates on Windows.
Apparently this problem happens also with Linux, RH 7.3 and later!
glibc-2.2.5-34 and greater has been changed to return -1 for dates <
1970. This used to work. The problem exists with RedHat 7.3 and 8.0
echo (mktime(0, 0, 0, 1, 1, 1960)); // prints -1
References:
http://bugs.php.net/bug.php?id=20048&edit=2
http://lists.debian.org/debian-glibc/2002/debian-glibc-200205/msg00010.html
*/
if (!defined('ADODB_ALLOW_NEGATIVE_TS')) define('ADODB_NO_NEGATIVE_TS',1);
function adodb_date_test_date($y1,$m)
{
//print " $y1/$m ";
$t = adodb_mktime(0,0,0,$m,13,$y1);
if ("$y1-$m-13 00:00:00" != adodb_date('Y-n-d H:i:s',$t)) {
print "<b