@@ -106,6 +106,8 @@ data and other input::
106106 use function Cake\Core\toBool;
107107 use function Cake\Core\toInt;
108108 use function Cake\Core\toString;
109+ use function Cake\I18n\toDate;
110+ use function Cake\I18n\toDateTime;
109111
110112 // $active is bool|null.
111113 $active = toBool($this->request->getQuery('active'));
@@ -116,6 +118,12 @@ data and other input::
116118 // $query is string|null.
117119 $query = toString($this->request->getQuery('query'));
118120
121+ // Parse a date based on the format or null
122+ $date = toDate($this->request->getQuery('date'), 'Y-m-d');
123+
124+ // Parse a datetime based on a format or null
125+ $date = toDateTime($this->request->getQuery('datetime'), 'Y-m-d H:i:s');
126+
119127.. versionadded :: 5.1.0
120128 Casting functions were added.
121129
@@ -413,7 +421,7 @@ There are several built-in detectors that you can use:
413421 X-Requested-With = XMLHttpRequest.
414422* ``is('ssl') `` Check to see whether the request is via SSL.
415423* ``is('flash') `` Check to see whether the request has a User-Agent of Flash.
416- * ``is('json') `` Check to see whether the request URL has 'json' extension or the
424+ * ``is('json') `` Check to see whether the request URL has 'json' extension or the
417425 `Accept ` header is set to 'application/json'.
418426* ``is('xml') `` Check to see whether the request URL has 'xml' extension or the `Accept ` header is set to
419427 'application/xml' or 'text/xml'.
0 commit comments