File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ DateTime
33
44Validates that a value is a valid "datetime", meaning either a ``DateTime ``
55object or a string (or an object that can be cast into a string) that follows
6- a valid YYYY-MM-DD HH :MM: SS format.
6+ a specific format.
77
88+----------------+------------------------------------------------------------------------+
99| Applies to | :ref: `property or method <validation-property-target >` |
1010+----------------+------------------------------------------------------------------------+
11- | Options | - `message `_ |
11+ | Options | - `format `_ |
12+ | | - `message `_ |
1213| | - `payload `_ |
1314+----------------+------------------------------------------------------------------------+
1415| Class | :class: `Symfony\\ Component\\ Validator\\ Constraints\\ DateTime ` |
@@ -78,6 +79,17 @@ Basic Usage
7879 Options
7980-------
8081
82+ format
83+ ~~~~~~
84+
85+ **type **: ``string `` **default **: ``Y-m-d H:i:s ``
86+
87+ .. versionadded :: 3.1
88+ The ``format `` option was introduced in Symfony 3.1.
89+
90+ This option allows to validate a custom date format.
91+ See `DateTime::createFromFormat <date_create_from_format >`_ for formatting options.
92+
8193message
8294~~~~~~~
8395
@@ -86,3 +98,5 @@ message
8698This message is shown if the underlying data is not a valid datetime.
8799
88100.. include :: /reference/constraints/_payload-option.rst.inc
101+
102+ .. _`date_create_from_format` : http://php.net/manual/en/datetime.createfromformat.php
You can’t perform that action at this time.
0 commit comments