date_valid_datetime(year, month, day, hour, minute, second);
Argument | Description |
---|---|
year | The year to check. |
month | The month to check. |
day | The day to check. |
hour | The hour to check. |
minute | The minute to check. |
second | The second to check. |
Returns: Boolean
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);
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).