views:

64

answers:

1

I'm wondering what will happen after 2038-01-19 03:14:07 with table fields using TIMESTAMP as data type?

I always preferred DATETIME but you apparently can't assign CURRENT_TIMESTAMP as default value to that type. I mean, 28 years is not so long when you think about it (in my opinion anyway)... So what will happen to all those TIMESTAMP fields then?

A: 

You may not be able to assign CURRENT_TIMESTAMP to a DATETIME column, but you can assign NOW() to it.

As for the y2k+38 issue, I'm willing to bet there will be newer versions of MySQL that will address this long before it is a real concern.

Fosco
unfortunatly, to set NOW() I need to create a TRIGGER. While this is an acceptable solution, triggers don't show in PhpMyAdmin exports (but does with mysqldump) :/
Yanick Rochon
You don't need to set a trigger to add `NOW()`.. it can be added in your insert/update query... Maybe I'm misunderstanding something.
Fosco
I understand the default values and how to set NOW(). I was more curious about general opinion about TIMESTAMP vs DATETIME (my personal fav is DATETIME). But I'll just close this question and say, in conclusion, that I agree with the y2k+38 being resolved by that time with a newer version (hopefully!)
Yanick Rochon