[FLOW3-general] DateTime limited to Unix timestamp?

Michael Sauter mail at michaelsauter.net
Sun Oct 10 12:16:34 CEST 2010


Hi,

first, thanks a lot for the research! That's amazing!

On 10.10.10 10:02, Michael Feher wrote:
> MySQL: Does not support timezone in DATETIME objects. Therefore the
> timezone would have to be stored in a separate field. Further more is
> the supported range '1000-01-01 00:00:00' to '9999-12-31 23:59:59' which
> is less than the PHP DateTime Object. However I think this is still
> better than timestamp.

Ah okay ... one way to solve this problem would be to use a simple 
VARCHAR  instead of a DATETIME field. But then you would loose the 
optimization from MySQL (converting the string into an integer in some 
cases to do faster comparisons). But it would allow any date to be 
stored ... Don't know what's better, I guess it also depends on how big 
the performance gain really is.

> Other Database backends may even go further and overwrite the functions
> from the abstract SQL backend to support TIMESTAMPS WITH TIMEZONE but I
> don't see a reason to do this now.

I agree. I would even go so far to say that storing the timezone in an 
extra field is the better way of doing it, this way ensuring that all 
stored dates are in UTC. On the other hand, I also don't see how you 
could support a backend with timezone included and one without with the 
same model. You would have to tell the framework what your timezone 
attribute is and so on. Don't think this is worth it ... also because 
you can define arbitary getters/setters in your model to make working 
with date/time really easy.

~michael



More information about the FLOW3-general mailing list