Date API

Last updated on
30 April 2025

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 obvious what they are and what they do.

The date_api_xxx.inc files are files you can optionally include to do other things -- create cross-database date sql or work with ical. The date sql is implemented for views queries in date_api.views.inc, which should give you ideas on how to use it. The ical functions are implemented by the Calendar iCal module, which you can use as an example.

The basic date functions are the PHP 5.2 date functions -- date_create(), date_timezone_set(), date_format(), etc, all of which are documented on php.net.

The Date PHP4 module provides those 5.2 date functions for systems that don't have them (earlier than PHP 5.2).

The Date Repeat module has an API for creating and parsing iCal RRULEs. You can use it to add a form element that allows users to select repeat rules (a form with type => '#date_repeat') and the repeat_calc function will parse an iCal RRULE and return an array of the dates that fit that rule.

Help improve this page

Page status: Not set

You can: