@@ -106,6 +106,8 @@ data and other input::
106
106
use function Cake\Core\toBool;
107
107
use function Cake\Core\toInt;
108
108
use function Cake\Core\toString;
109
+ use function Cake\I18n\toDate;
110
+ use function Cake\I18n\toDateTime;
109
111
110
112
// $active is bool|null.
111
113
$active = toBool($this->request->getQuery('active'));
@@ -116,6 +118,12 @@ data and other input::
116
118
// $query is string|null.
117
119
$query = toString($this->request->getQuery('query'));
118
120
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
+
119
127
.. versionadded :: 5.1.0
120
128
Casting functions were added.
121
129
@@ -413,7 +421,7 @@ There are several built-in detectors that you can use:
413
421
X-Requested-With = XMLHttpRequest.
414
422
* ``is('ssl') `` Check to see whether the request is via SSL.
415
423
* ``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
417
425
`Accept ` header is set to 'application/json'.
418
426
* ``is('xml') `` Check to see whether the request URL has 'xml' extension or the `Accept ` header is set to
419
427
'application/xml' or 'text/xml'.
0 commit comments