Date 1.7 (Drupal 4.7) and 1.8 (Drupal 5)

Also see Calendar documentation.

The date module defines a highly configurable date/time field type for the content module and a date API that can be used by other applications.

Date Field Types

You have a choice of creating an ISO date or a unix timestamp. If you are porting information from another application you may want to create a field using a type that matches the source data. Some advantages and disadvantages of each include:

Datestamp (Unix Timestamp)
Stores the date as an integer.
Takes up less room in the database because it\'s smaller.
Often easier to use for date calculations because you can increase or decrease it just by adding or subtracting seconds.
It is the format used by php date functions.
It must be filled with a complete date -- year, month, day, hour, minute, second, so you sometimes have to arbitrarily set some of these values even if they are not applicable.
Date (ISO Date)
Stores the date in an ISO format (YYYY-MM-DDTHH:MM:SS).
The data is in a human-readable form.
You can use it for incomplete dates, i.e. only a year or only a year and a month, and pad the other values with zeros, so it does not appear to be any more precise than it really is.
It is a format that is internationally-recognized, and it is used as-is on many web sites and in many applications.

Date Widgets

There are several widgets to choose from to control how users can enter data for this field.

Text Field
The Text Field date widget uses the strtotime function to construct a date and will accept input allowed by the php strtotime function. This allows the user to type a date in in many natural formats, like March 31, 1980 or 3/10/1980 or in numeric formats like YYYY-MM-DD.
The strtotime function will assume date shortcuts are in American format (MM/DD/YY), and it will not work for dates prior to 1970.
Select List
The Select List date widget presents users with a drop-down list or textfield for each part of the date (year, month, day, hour, etc.). The whole selector is collapsed onto a single line using css (except for the timezone selector, if date-specific timezones are collected). The selector is highly configurable and will even handle years prior to 1900.
Javascript Pop-up Calendar
The Javascript Pop-up Calendar is offered as an input alternative if the jscalendar module is installed. This widget can handle dates as early as 1900.

Date API

The file date_api.module is basically a big collection of date utility functions. You can scan through the file and it should be pretty

Date Import

The Date Copy module allows you to import date data into CCK nodes. Currently you can convert Event nodes to CCK nodes or import date data

Historical dates

You can use historical dates by using the adodb date library. The adodb date library extends the valid date range from year 100 to year 3000

Theme the Date

To print multiple date formats per node see this handbook page. Like other CCK fields, the date is formatted with the CCK formatter. The

Views Integration

Date range argument handler

Guide maintainers

Shai's picture