Skip to main content

Difference between DATETIME and TIMESTAMP?

Mid MySQL
Quick Answer DATETIME: stores date and time without timezone, range 1000-9999. Unchanged on retrieval. TIMESTAMP: stores as UTC internally, converts to server timezone on retrieval. Range: 1970-2038 (32-bit Unix timestamp). TIMESTAMP auto-updates on INSERT/UPDATE if defined with DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP. Use TIMESTAMP for "last modified" tracking, DATETIME for future dates or timezone-neutral storage.

Answer

DATETIME stores exact values independent of timezone; TIMESTAMP converts values based on timezone and supports auto-update.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice