Support Center

Drupal 7 Date and Time field types

Last Updated: Sep 05, 2013 05:49PM EEST
Dates are an important data type for a lot of different Drupal websites. You can find bellow some useful info regarding the Date field type. 

1. Webform Date/Time field

​How to add a Date/Time field to a Drupal webform

Webform module is the module for making surveys in Drupal. After a submission, users may be sent an e-mail "receipt" as well as sending a notification to administrators.

Webform components are basically the equivalent of CCK fields. You can add any number of fields to a Webform node that an end-user can fill out. All components are included with the Webform module. These include:
  • date
  • email
  • fieldset
  • file
  • grid
  • hidden
  • markup
  • pagebreak
  • select
  • textarea
  • textfield
  • time
If you want to add a Date/Time field to your Webform node, you should add one Date field and one Time field. For example, our CHIQUE product comes with a built-in reservation page. This reservation page is just a Webform node and already consists of two Date fields: Check-in and Check-out.

These two fields are just Date fields. If you need for example to add Check-in time, you should add an extra Time field.

Finally, this is the Reservation page webform with the new Time field.


2. Content type Date/Time field

​How to add a Date/Time field to a Drupal Content type

In order to have a Datetime field in any of your content types, you should install the Date module You might not need all the complexity that the Date module can currently handle (repeating dates, etc), but if you need at least to handle a simple "Date" field out of the box just install the following modules (Date API, Date and Date Popup). The Date module has a submodule called "Date Popup" which provides a jQuery UI popup widget for fields.

After the installation of the above Date modules, you should add a new Date field to your Content type, and when choosing the widget select "Pop-up calendar"

Add your new Date field and then select the Date attributes that you want to collect/store and Save the field settings

Finally, you will be able to see your Date field inside your Content type.

You can also find "What's New in Date and Calendar for Drupal 7" at the following Lullabot article -

In case this article leaves any of your questions or concerns unanswered, please feel welcome to email us or post a public question.

​More than (just) Themes

Contact Us
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found