Function IsDate to check valid date or date variableWe can check (or validate) the date variable or a date by using IsDate() function. User entered date values in a form are to be checked for correct date or not before further processing. This function takes one input and gives output as TRUE or FALSE based on the input. A valid date or date variable will return TRUE or it will return FALSE. Here is the syntax of IsDate() function.
Here my_date is a date variable or a date itself. Out put of IsDate function is either True or False. Here is the complete code of IsDate() function.
Here IsDate function will return True. If we change the variable my_date like this.
Then the output of IsDate() function will be false.
IsDate function is useful where user entered date value is to be checked for a valid date for further processing. Whatever date entered by the user through a form can also be checked by using this function.
In PHP date checking can be done by using checkdate() function
This article is written by plus2net.com team.
Be the first to post comment on this article :