date_valid_datetime

With this function you can check a datetime value to see if it is valid (returns true) or not (returns false). Note that this function will only consider a valid datetime as being after 1/1/1970 and anything before that will return false, so the earliest you can check would be:

date_valid_datetime(1970, 01, 01, 0, 0, 0);

 

Syntax:

date_valid_datetime(year, month, day, hour, minute, second);

ArgumentTypeDescription
yearRealThe year to check.
monthRealThe month to check.
dayRealThe day to check.
hourRealThe hour to check.
minuteRealThe minute to check.
secondRealThe second to check.

 

Returns:

Boolean

 

Example:

if (date_valid_datetime(2011, 9, 15, 10, 3, 30))
{
    mydatetime = date_create_datetime(2011, 9, 15, 10, 3, 30);
}

This will set "mydatetime" to 15th September 2011, 10:03.30, if it is a valid value (which it is).