Bitrix Site Manager

CDatabase::IsDate

bool
CDatabase::IsDate(
 string date,
 string format=false,
 string site=false,
 string type="SHORT"
 )

The method IsDate checks the date for validity.

Parameters

ParameterDescription
date Date to be verified.
format Date format. If false, the date format is inferred from the current site (for public section) or language (for administrative section).
Optional; "false" by default.
site 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.
type Type of the date format: "FULL" - date and time, "SHORT" - date only.
Optional; "SHORT" by default.

Return Values

 Returns true if the date is valid or false otherwise.

See Also

Example



<?
if (!$DB->IsDate("12.10.2005 22:34:15", "DD.MM.YYYY HH:MI:SS"))
  echo "Error: invalid date format.";
?>