I created a column (created_at
) to store a timestamp, but I am confused whether I should use int, bigint or timestamp data type to store the timestamp.
Please clarify it in detail.
I created a column (created_at
) to store a timestamp, but I am confused whether I should use int, bigint or timestamp data type to store the timestamp.
Please clarify it in detail.
You must use TIMESTAMP
because:
In Timestamp values are converted from the current time zone to UTC while storing, and converted back from UTC to the current time zone when retrieved.
And for more detail refer this: http://www.w3resource.com/mysql/mysql-data-types.php