IsDate
bool CDatabase::IsDate( string date, string format=false, string lang=false, string format_type="SHORT" )
The method checks the date for validity and returns true if the date is valid or false otherwise. Non-static method.
Parameters
Parameter | Description | Available from version |
---|---|---|
date | Date to be verified. | |
format | Date format. Optional. If false, the date format is inferred from the current site (for public section) or language (for administrative section). | |
lang | Site ID (for public section) or the language ID (for administrative section). Used to determine the format if format is false. Optional; by default, current site (for public section) or language (for administrative section) are used. | |
format_type | Type of the date format: "FULL" - date and time, "SHORT" - date only.
Optional; "SHORT" by default. Form version 3.3.7 to version 4.1.0 the parameter was named Type. |
See Also
Examples of use
<? if (!$DB->IsDate("12.10.2005 22:34:15", "DD.MM.YYYY HH:MI:SS")) echo "Error. Invalid date format."; ?>
© «Bitrix24», 2001-2024