|
|
|
|
|
DateValid (Function) In french: DateValide Checks the validity of a date between January 01 0001 and December 31 9999.
Res = DateValid("20011225") // Res returns True Res = DateValid("20012512") // Res returns False Res = DateValid("2001") // Res returns False Res = DateValid("14821225") // Res returns True
Syntax
<Result> = DateValid(<Date>)
<Result>: Boolean - True if the date is valid,
- False otherwise. A date is considered invalid if:
- "MM" is not between "01" and "12".
- "DD" is not between "01" and "30", "01" and "31", "01" and "28" or "01" and "29" (according to the specified month).
- The string passed as parameter does not contain 8 characters.
- The date is between October 5, 1582, and October 14, 1582, inclusive. In fact, the calendar change took place during the night of October 4 to October 15, 1582 (Gregorian calendar adjustment: see "Remarks").
<Date>: Character string, Date or DateTime variable Date to check. This date can correspond to: - a character string in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
- a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second (use CCC for thousandths of a second)). In this case, only the date validity is checked.
- a Date variable.
- a DateTime variable. In this case, only the date validity is checked.
Remarks - If the date is before October 4, 1582, it belongs to the Julian calendar. In this case, the date is valid.
- If the date is after October 15, 1582, it belongs to the Gregorian calendar. In this case, the date is valid.
- A year is a leap year if it is divisible by 4 but is not a multiple of 100. However, if this year is multiple of 400, then it is a leap year. For other years, DateValid returns False for February 29.
Tip To enter a date in the correct format, use an Edit control of type Date. In this case, the date validity is automatically checked. - The date storage format allows you to store dates from 01/01/0001 to 12/31/9999.
- WLanguage functions and WLanguage properties make accurate calculations on dates from January 1st, 1583.
Related Examples:
|
Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
|
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|