Date
This field type represents a date without time information.
Name | Internal name | Expected input type |
---|---|---|
Date | ezdate | mixed |
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
.
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 the day in the given or the environment timezone.
Validation
This FieldType does not use any special validation of the input value.
Settings
The field definition of this FieldType can be configured with one option:
Name | Type | Default value | Description |
---|---|---|---|
defaultType | Type::DEFAULT_EMPTY | Type::DEFAULT_EMPTY | The constant used here defines default input value when using administration interface. |
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 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.