Date Localization

The format of dates output or parsed as input can be configured using constants. When a new installation is created the user can select one of the following locales:

  • en_GB
  • en_US
  • de_DE
  • fr_FR

This will automatically configure the date constants for the selected locale. This will also cause the PHP locale to be set for LC_TIME (see

If the locale value needs to be altered this can be done in the set_constants.php script. Sometimes the locale name will differ depending on the operating system.

On unix based systems you can list the available locales using locale -a.

Date output

Dates are output using formatDateTime(). There are some scenarios when it's still acceptable to use date(), such as if the date doesn't need to be localised or if we're only outputting something simple such as the year.

print formatDateTime(FORMAT_DATE_SHORT, $news->newsDate);

Multiple formats can be combined by concatenating the constant values.

print formatDateTime(FORMAT_DATE_SHORT . ' ' . FORMAT_TIME_SHORT, $news->newsDate);

For a full list of available format constants please refer to the table below.

Constant Format (en_GB) Example output
FORMAT_DATE_FULL %A, %d %B %Y Monday, 15 November 2010
FORMAT_DATE_LONG %d %B %Y 15 November 2010
FORMAT_DATE_MEDIUM %d %b %Y 15 Nov 2010
FORMAT_DATE_SHORT %d/%m/%Y 15/11/2010
FORMAT_TIME_LONG %H:%M:%S %z 10:59:29 +0000

formatDateTime() uses strftime() internally, therefore format options available to strftime are also available to formatDateTime. For more information on strftime please refer to

Parsing date inputs

Dates and times can be parsed using parseDate($date, $format).

$parts = parseDate('15/11/2010 11:22', FORMAT_DATE_INPUT . ' ' . FORMAT_TIME_INPUT);
// returns an array containing the parsed date parts

To convert a date string directly to a unix-timestamp use convertDateTimeToTimeStamp($datetime, $format = FORMAT_DATE_INPUT).

$timestamp = convertDateTimeToTimeStamp('15/11/2010 11:22', FORMAT_DATE_INPUT . ' ' . FORMAT_TIME_INPUT);
// returns the Unix timestamp value for the date string,
   which in this case would be equivalent to mktime(11,22,0,11,15,2010)

To validate a date string use validateDateTime($date, $format = FORMAT_DATE_INPUT)

if (validateDateTime('15/11/2010 11:22', FORMAT_DATE_INPUT . ' ' . FORMAT_TIME_INPUT)) {
  // This date would be valid

Input formats are controlled by the following constants.

Constant Format (en_GB) Example input
FORMAT_DATE_INPUT %d/%m/%Y 15/11/2010

Where dates or times are being inputted an example date string is output using the following constants.

Constant Value (en_GB)


In some countries the convention is for the week to start on Sunday and others Monday.

The constant CALENDAR_FIRST_DAY can be used to determine the day on which the week starts. This is the number of days to offset the calendar by, assuming Sunday is 0 and Saturday is 6. So for en_GB this value is 1 and en_US it is 0.

If a calendar is used as a date picker then is should now format the date using FORMAT_DATE_INPUT.


Continuum CMS expects that timezone should be set to the correct local value in php.ini.

The default timezone is "Europe/London". If no other values can be found, this is the timezone that will be used.

If php.ini date.timezone value is empty, the default timezone is overridden by the value of DEFAULT_TIMEZONE constant where set.

DEFAULT_TIMEZONE is not set at install and must be added to the JaduConstants database table as required.

results matching ""

    No results matching ""