Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

This field type represents a date without time information.

NameInternal nameExpected input type
Dateezdatemixed

Table of contents:

Description


This FieldType makes possible to store and retrieve a date information.

Input expectations


If input value is of type string or integer, it will be passed directly to the PHP's built-in \DateTime class constructor, therefore the same input format expectations apply.

It is also possible to directly pass an instance of \DateTime.

TypeExample
string"2012-08-28 12:20 Europe/Berlin"
integer
1346149200
\DateTime
new \DateTime()

Time information is not stored.

Before storing, given input value will be set to the the beginning of the day in the given or the environment timezone.

Value object


Properties

The Value class of this field type contains the following properties:

PropertyTypeDescription
$date\DateTimeThis property will be used for the text content.

String representation

String representation of the date value will generate the date string in the format "l d F Y" as accepted by PHP's built-in date() function.

Example:

Wednesday 22 May 2013

Constructor

The constructor for this value object will initialize a new Value object with the value provided. It accepts an instance of PHP's built-in \DateTime class.

Hash format

Hash value of this FieldType is an array with two keys:

Key
Type
Description
Example

timestamp

integerTime information as a timestamp.

1400856992

rfc850

string

Time information as a string in RFC 850 date format.

As input, this will have higher precedence over the timestamp value.

"Friday, 23-May-14 14:56:14 GMT+0000"
Example of the hash value in PHP

Validation


This FieldType does not perform any special validation of the input value.

Settings


The field definition of this FieldType can be configured with one option:

NameTypeDefault valueDescription
defaultType
mixed
Type::DEFAULT_EMPTY

One of the DEFAULT_* constants, used by the administration interface for setting the default field value.

See below for more details.

Following defaultType default value options are available as constants in the eZ\Publish\Core\FieldType\Date\Type class:

ConstantDescription
DEFAULT_EMPTY
Default value will be empty.
DEFAULT_CURRENT_DATE
Default value will use current date.
Date FieldType example settings