Closed samdark closed 5 months ago
DateRule validates a string value that represents a date. DateTimeRule validates a string value that represents date and time.
DateRule
DateTimeRule
format, see DateTime::createFromFormat()
format
For Date default could be 'Y-m-d', for DateTime it could be Y-m-d H:i:s.
Date
DateTime
Y-m-d H:i:s
Use \DateTime::createFromFormat() then \DateTime::getLastErrors() or regex + validating if date and time are valid.
\DateTime::createFromFormat()
\DateTime::getLastErrors()
I wrote a similar one for my needs (need to fix namespaces). It may be useful with a little tweaking DateTime.zip
DateRule
validates a string value that represents a date.DateTimeRule
validates a string value that represents date and time.Options
format
, see DateTime::createFromFormat()For
Date
default could be 'Y-m-d', forDateTime
it could beY-m-d H:i:s
.Implementation
Use
\DateTime::createFromFormat()
then\DateTime::getLastErrors()
or regex + validating if date and time are valid.