SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Function IsDate to check valid date or date variable

We 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.

IsDate(my_date)


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.

my_date="02/28/2007"
Response.Write my_date & " = " & IsDate(my_date)


Here IsDate function will return True. If we change the variable my_date like this.

My_date="02/29/2007"


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

Further readings
Getting todays Date and Time based on local settings
Formatting date and time on local settings
Adding Date intervals using DateAdd function
Finding difference between two dates using DateDiff function
Collecting parts of Date by using DatePart function
Collecting Month name by using Month number by MonthName function
Collecting Name of the weekday of any Date by WeekDayName function
Generating Date variables by using Month, Day and Year Value
Function IsDate to check valid date or date variable
Checking user entered date value
 
Scripts
PHP
JavaScript
All ASP Tutorials
Popular Tutorials
Managing two drop downs
ASP Tutorials
Date and time
Declaring array
Form in ASP
Server.MapPath
Date Time & MSSQL
Select Query
File System Object
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.