[FLOW3-general] DateTime limited to Unix timestamp?
Michael Sauter
mail at michaelsauter.net
Thu Oct 7 21:12:05 CEST 2010
Hi,
just remembered this thread and thought I could do something about it.
Here's what I would suggest:
As current MySQL and SQLLite databases use only 4 byte for the INTEGER
type, we can't use that to store all the information that a PHP DateTime
object can carry (which uses a 64bit integer).
Because of that, one solution would be to store the values as a string
(as proposed by Martin earlier). The format could be something like
YYYYMMDDTHHMMSS. That way, ordering/comparison would still work the same
as it does now with integers.
If timezone handling is needed, that would have to be stored in an extra
property. It cannot be added to the string if you want to be able to do
comparisons ... (the comparisons would be incorrect because of daylight
saving etc.)
The backend should make sure that the date&time string always represents
the date&time in UTC (to ensure comparisons work and that the stored
information is independent of the current php configuration).
The only downside I see so far is that current client implementations
could fail (if you've computed integers in your queries to compare with
the backend). Maybe there more things that need to be taken into account?
Otherwise, and if the proposed solution sounds good to you, I'm happy to
provide a patch & push it to gerrit.
~michael
More information about the FLOW3-general
mailing list