Navigation
eZ Documentation Center
 

This is outdated documentation made for eZ Publish Platform 5.2. It is being moved into the eZ Publish 5.x documentation, so please go there for most up-to-date documentation.

Skip to end of metadata
Go to start of metadata

DateAndTime

This field type represents a full date including time information.

NameInternal nameExpected input type
DateAndTimeezdatetimemixed

Description

This FieldType makes it possible to store and retrieve a full date including time 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()

Validation

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

Settings

The field definition of this FieldType can be configured with several options:

NameTypeDefault valueDescription
useSecondsbooleanfalseUsed to control displaying of seconds in the output.
defaultType
Type::DEFAULT_EMPTY
Type::DEFAULT_CURRENT_DATE
Type::DEFAULT_CURRENT_DATE_ADJUSTED
Type::DEFAULT_EMPTY
The constant used here defines default input value when using administration interface.
dateInterval
null|\DateInterval
null

This setting complements defaultType setting and can be used only when latter is set to Type::DEFAULT_CURRENT_DATE_ADJUSTED.

In that case the default input value when using administration interface will be adjusted by the given \DateInterval.

DateAndTime FieldType example settings

Value object

Properties

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

PropertyTypeDescription
$value\DateTimeThe date and time value as an instance of \DateTime.
String representation

String representation of the date value will generate the date string in the format "D Y-d-m H:i:s" as accepted by PHP's built-in date() function.

Example: Wed 2013-22-05 12:19:18

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.

 

  • No labels