Marc
Marc

Reputation: 16512

Questions about timestamp (MYSQL)

I'm wondering what is faster.

I need to compare the number of seconds between now and a datetime in my table. The type of my column is Timestamp, is it the best way? Cause im wondering what's the difference between timestamp and an int? Or should I use datetime?

cause all I want is something like that: 1314288065 so I would do the time now - 1314288065 and it would give me the number of seconds.

Thank you

Have a nice day

Upvotes: 0

Views: 64

Answers (2)

Marc
Marc

Reputation: 16512

Months after, finaly I use int cause it's more easy to work with this for time zones and it's already in the format I want.But all the other dates in this project are in datetime.

Thank you all.

Upvotes: 1

Konerak
Konerak

Reputation: 39763

If you're storing time, store it as a datetime.

Right now you'll only need the difference in seconds, but later you'll want to format the difference nicely in weeks/days/hours/... and you'll start reinventing the wheel. You're not storing strings/ints as BLOBs either, are you?

Upvotes: 2

Related Questions