Yemto
Yemto

Reputation: 613

Saving timestamps in a MySQL server

I'm going to save a lot of dates in a MySQL server, and want to be able to get a range of them out quickly. So my idea is to save them as integers, and then just use < and > to get then back out.

My concern is can I always rely on php to always be able to make them readable again, like 2007-04-24 15:23:42 without making changing the date

Upvotes: 0

Views: 37

Answers (1)

David Garrison
David Garrison

Reputation: 2880

MySQL essentially stores Datetimes as 8 byte integers anyways, I don't see a need to convert them back and forth.

If you do need to convert them, as long as you cast them back and forth consistently you should be fine.

Upvotes: 1

Related Questions