Ask a schoolchild to write down a date. They will likely write a month, day of the month and maybe a year too (not necessarily in that order). So will most other literate people at any age.
Ask a programmer to write a date and they might write not just a date, but also add hours, minutes and seconds to it!
But a date does not have hours, minutes and seconds. Most people know this. Except many programmers. Well they probably know, but many use the word date to mean a combination of date and point of time in hours and minutes (and more detailed than that).
Why it is like this
Certain systems and programming languages have a simplistic structure to handle all kinds of time and date:
One type to rule them all.
This is a bad idea, but it is very prevalent. For instance typing
date in Linux gives you not just a date,
Date structure is really a datetime with certain
timezone related information added on.
Handling date and time in a computer context has enough challenges by itself: uneven months, leap years, time zones, DST, updates to time zones and so on. Hijacking and changing the meaning of the word “date” does not help.
Because if “date” in certain contexts implicitly means “datetime - maybe with a specified offset from UTC”, what word do you use to describe a simple date?
Those that do it better
SQL databases have their share of problems when it comes to handling date and time. Especially when it comes to time zones. But at least MySQL has pretty good names for these three types:
|DATE||year, month, day|
|TIME||hour, minute, second|
|DATETIME||year, month, date, hour, minute, second|
(Note: this is not a recommendation of MySQL.)
How to solve this problem
This issue is just one of many issues with date and time in a software context. But nonetheless I think it is important. And why not tackle each of the issues one step at the time?
Be concious of the difference between what a date is in the real world and the badly named structures used in certain languages and libraries.
Remember a date has no hours, minutes or seconds.
If you want to talk about a datetime, call it a datetime not a date.
If you are using a language with a
Dateclass, that is really a datetime, some times you need to talk about the Date class. In that case be explicit about calling it e.g. a “Java Date object” and not just a “date”.
It is hard to change existing languages and libraries, but if you design a new programming language or date/time related library please call the concepts by their right name. A date is a just a date.
If you talk to someone involved in a software project and they call a datetime a “date”, make it clear what you are talking about. Maybe even send them a link to this blog post so that you are all on the same page.