I am sure this is explained in the documentation, but I could not find it: when I want to add a date field to a content type I get to choose between "Date", "Datetime" and "Datestamp". They all give me the same list of available widgets. So what is the difference? For what purpose should I choose which type?

Comments

choster’s picture

Status: Active » Fixed

There is a difference as to how they are stored with the database.

From http://drupal.org/node/269813 :

"The ISO date is useful if you want to store incomplete dates, like year and month only. The datetime field is better when you are storing complete dates." Datestamp is available for legacy installations.

gustav’s picture

choster, thank you very much for that link. So if I understand correctly, all three field types provide exactly the same functionality, only they will be doing it with different efficiency due to the different choice of format for saving the date in the database. Is that right? If so, Karen, with your intimite knowledge of how you have designed the code, can you tell us which type is the most efficient for calendar-type events with minute-level granularity start and end dates on a site where all users are in the same time zone? I assume it must make a difference because otherwise you would not bother to support three different formats.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

FreddieK’s picture

Hah, I also wonder about Date, Datestamp and Datetime. The discussions I see only mentions the two latter, but doesn't mention the first?

msielski’s picture

For anyone finding this page through search, the Date documentation has been updated to explain the difference between these fields. Scroll down to the Date Fields section of this page.

halefx’s picture

Thanks, msielski