[FLOW3-general] DateTime limited to Unix timestamp?
Jigal van Hemert
jigal at xs4all.nl
Fri Jul 2 10:42:41 CEST 2010
Michael Sauter wrote:
> On 01.07.10 21:12, Jigal van Hemert wrote:
>> Thinking that a system will be replaced in x years is something that was
>> proven wrong a little over a decade ago.
> True :) But the case is a bit different here I think. The problem with
> Y2K was that the stored values were not sufficient. Here, not the value
> is the problem, but the possible range ...
I see no difference:
- then: year stored in two decimal digits, now: seconds since "0" stored
in 32 binary digits
- then: range limited to 00-99, now: range limited to –2147483648 -
2147483647
The storage format is a bit different, but the problem is the same.
Timestamps beyond 2038-01-19 would be stored in large, negative numbers
and that would represent dates in 1901. Just like years after '99 would
wrap around to '00, representing 1900...
> Yep. Definitely weird ;) But are there better solutions worth the
> trade-off?
What is the trade-off? Internally FLOW3 uses a DateTime object which
already supports a pretty large range (not the billions of years PHP
states, but 10,000 BC to 10,000 AD is a lot better than 1901 - 2038).
The way these dates are stored in the database should match that.
Storing it in a 4 or 8 byte field can hardly be the problem. Disk space
is cheap and the database will not be ridiculously large because of this.
> like overkill to me there). I do understand there might be situations
> where you actually want to have more control/options, but I'd say these
> (rare?) cases might justify building a custom way to store the
> information (e.g. splitting up information into different DB fields and
> combining them upon reconstitution) ...
It would be far better if the system would just support realistic date
fields out of the box. All the standard validators, view helpers, etc.
would work and dates would be stored correctly.
Building a new framework is *the* opportunity to leave old 'mistakes' --
like using a Unix timestamp for all kinds of date/time fields -- behind.
--
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh
More information about the FLOW3-general
mailing list