Languages

MySQL - what is the difference between DATETIME and TIMESTAMP?

6 points
Asked by:
Mohammad-Oneal
327

Both DATETIME and TIMESTAMP contain the date and time parts, so can you tell me what's the difference between them?

1 answer
6 points
Answered by:
Mohammad-Oneal
327

There are several differences between DATETIME and TIMESTAMP types.

1. Range:

  • DATETIME supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59',
  • TIMESTAMP supported range is from '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

2. Usage:

  • TIMESTAMP is generally used to track changes to records, and is often updated every time the record is changed,
  • DATETIME is generally used to store a specific value.

Note:

Go to the docummentation to read more about DATETIME and TIMESTAMP types. - Link.

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join