[TYPO3-50-general] Dates outside Unix Timestamp
Alban Cousinié
ace at mind2machine.com
Mon Dec 31 15:40:13 CET 2007
While looking for a solution to the 1970-2038 limitation, the adodb time
library is said to do the trick nicely.
http://www.xaraya.com/documentation/phpxref/xaradodb/adodb-time.inc.php.sour
ce.txt
PHP native date functions use integer timestamps for computations.
Because of this, dates are restricted to the years 1901-2038 on Unix
and 1970-2038 on Windows due to integer overflow for dates beyond
those years. This library overcomes these limitations by replacing the
native function's signed integers (normally 32-bits) with PHP floating
point numbers (normally 64-bits).
Dates from 100 A.D. to 3000 A.D. and later
have been tested. The minimum is 100 A.D. as <100 will invoke the
2 => 4 digit year conversion. The maximum is billions of years in the
future, but this is a theoretical limit as the computation of that year
would take too long with the current implementation of adodb_mktime().
This library replaces native functions as follows:
<pre>
getdate() with adodb_getdate()
date() with adodb_date()
gmdate() with adodb_gmdate()
mktime() with adodb_mktime()
gmmktime() with adodb_gmmktime()
strftime() with adodb_strftime()
strftime() with adodb_gmstrftime()
</pre>
The parameters are identical, except that adodb_date() accepts a subset
of date()'s field formats. Mktime() will convert from local time to GMT,
and date() will convert from GMT to local time, but daylight savings is
not handled currently.
This library is independant of the rest of ADOdb, and can be used
as standalone code.
PERFORMANCE
For high speed, this library uses the native date functions where
possible, and only switches to PHP code when the dates fall outside
the 32-bit signed integer range.
GREGORIAN CORRECTION
Pope Gregory shortened October of A.D. 1582 by ten days. Thursday,
October 4, 1582 (Julian) was followed immediately by Friday, October 15,
1582 (Gregorian).
Download the inc file:
http://phplens.com/lens/dl/adodb-time.zip
Regards,
Alban Cousinié
--
MIND2MACHINE SARL
http://www.mind2machine.com
54, rue du Coq
13001 Marseille
tel : +33 9 52 26 24 28
fax : +33 4 91 64 75 79
mob : +33 6 21 22 73 14
> -----Message d'origine-----
> De : typo3-project-5_0-general-bounces at lists.netfielders.de
> [mailto:typo3-project-5_0-general-bounces at lists.netfielders.de] De la
> part de Martin Kutschker
> Envoyé : vendredi 14 décembre 2007 09:57
> À : typo3-project-5_0-general at lists.netfielders.de
> Objet : Re: [TYPO3-50-general] Dates outside Unix Timestamp
>
> Helmut Hummel schrieb:
> > Hi Karsten,
> >
> > Karsten Dambekalns schrieb:
> >> Aside from dates outside that range that format is missing timezone
> >> information. So someone adds such a date in New York, and then it is
> to
> >> be displayed to someone in Paris. What happens?
> >
> > If I rember the discussion in core list right, the way to go is:
> saving
> > the date in timezone of the server and always show (calculate) it in
> > timezone of the client(s).
>
> Not quite. Storing the date in the TZ of the server is what legacy
> TYPO3
> implicitly does. But TYPO3 should store all dates in UTC.
>
> What was discussed for 4.2 was to have a configration switch that
> either
> enforces the server TZ or UTC for storage. The latter being the default
> for new installations.
>
> Masi
> _______________________________________________
> TYPO3-project-5_0-general mailing list
> TYPO3-project-5_0-general at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-5_0-
> general
>
> __________ Information NOD32 2722 (20071214) __________
>
> Ce message a ete verifie par NOD32 Antivirus System.
> http://www.nod32.com
More information about the TYPO3-project-5_0-general
mailing list