Question

Is it common to use "timestamp" to mean with time zone and "datetime" to mean without time zone?

No correct solution

OTHER TIPS

No.

Usually a datetime is data type or data structure, as a means of storing moments in memory/disk. A timestamp is an individual record that indicates an instant in time that something took place, virtually always in the past.

Often you could use a datetime to store a timestamp, but not all datetime records would be timestamps. The instant a vending machine dispenses a beverage could be recorded with a datetime record and would be a timestamp. However a datetime could also record when next weeks dentist appointment is, but that is definitely not a timestamp. The moment I clicked "Schedule" to schedule the appointment would be a timestamp, seperate from when the appointment is.

Both of these concepts can be timezone aware or naive. Many systems have their datetime structures include timezone info, many others don't and developers are responsible for keeping track of that elsewhere, if at all. A vending machine can probably operate just fine assuming local time for everything. A global social media network, probably not so much.

I'm not sure this issue is language agnostic but there is a common practice of handling these types differently when it comes to timezone:

MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.)

MySQL datetime

Licensed under: CC-BY-SA with attribution
scroll top