What is "date"

A date represents a specific point of a calendar, usually represented by one day, month and year. The values of these fields may vary according to the calendar used, as different cultures use different ways to refer to time.

For example, the date of 3 April 2019 (03/04/2019 at gregorian calendar) is equivalent to 25/07/1735 in coptic calendar. You can use this site to test the conversion between these calendars.

An important detail is that a date (only the day, month and year) does not represent an absolute instant (as is the case with timestamp). The date of "today" is something that may vary according to the , since in every part of the world, "today" can be a different day. So, concepts derived from "today", like "yesterday" and "tomorrow" - and any other date, actually - are relative and depend on the time and the Timezone. If you only have the day, month and year, without any information about the time or Timezone, it will not be possible to tell exactly to which point of the timeline this date refers.

In some programming languages, such as Java and Javascript, the type Date actually represents a timestamp (a specific point in the timeline) and not a date (a specific day, month and year). The name Date, in this case, it does not represent exactly the same concept that was implemented, which causes several criticisms to these classes.

For the vast majority of applications, dates referring to the gregorian calendar for default, which is the international civil calendar in fact. But many Apis support other calendars, such as Java, the C# and the PHP, for example.


Another important detail is that a date does not have a format. The date of April 3, 2019, for example, represents only the idea (the concept) of a specific point of the calendar, whose values are day 3, month 4 and year 2019. Of course I can represent this date in different ways (like 03/04/2019, Apr 3rd, 2019, 2019-04-03, etc.), but these are just different ways of representing the same date. But the date alone does not have a specific format, only the values of the day, month and year.

Taking this idea to the programming languages, the formats (03/04/2019, Apr 3rd, 2019, etc) are actually text (strings) that have the date information, but they are not dates per se. To represent dates, you use the specific types (such as Date, DateTìme, LocalDate or any other name the language/API uses). These types only have the values, and to display them the conversion is made to a string in a given format.