Message-ID: <31515641.3896.1485855818362.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3895_1625626837.1485855818362" ------=_Part_3895_1625626837.1485855818362 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html The Date FieldType

The Date FieldType

This field type represents a date without time information.

Name Internal name Expected input type
Date ezdate mixed

Table of contents:

=20 =20

Description


This FieldType makes possible to store and retrieve a date information.<= /p>

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 appl= y.

It is also possible to directly pass an instance of \DateT= ime.

Type Example
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 th= e day in the given or the environment timezone.

Value object


Properties

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

Property Type Description
$date \DateTime This 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 bu= ilt-in date() function.

Example:

Wednesday 22 May 2013

Constructor

The constructor for this value object will initialize a new Value o= bject 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

t= imestamp

integer Time information as a time= stamp.

1400856992

=

r= fc850

string

Time information as a string in RFC 850 date format.

As input, this will have higher preceden= ce over the timestamp value.

"Friday, 23-May-14 14:56:14 = GMT+0000"
Example of the hash value in PHP
=20
$hash =3D array(
    "timestamp" =3D> 1400856992,
    "rfc850" =3D> "Friday, 23-May-14 14:56:14 GMT+0000"
);
=20

Validation


This FieldType does not perform any special validation of the input valu= e.

Settings


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

Name Type Default value Description
defaultType
mixed
Type::DEFAULT_EMPTY

One of the D= EFAULT_* constants, used by the administration interfa= ce for setting the default field value.

See below for more details.

Following defaultT= ype default value options are available as constants i= n the eZ\Publish\Core\FieldType\Date\Type<= /strong> class:

Constant Description
DEFAULT_EMPTY
Default value will be empty.
DEFAULT_CURRENT_DATE
Default value will use current date.
Date FieldType example settings
=20
use eZ\Publish\Core\FieldType\Date\Type;

$settings =3D array(
=09"defaultType" =3D> Type::DEFAULT_EMPTY
);
=20
------=_Part_3895_1625626837.1485855818362--