PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Checks the validity of a date between January 01 0001 and December 31 9999.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 26 and later
Apple Watch This function is now available for Apple Watch applications.
New in version 26
Apple Watch This function is now available for Apple Watch applications.
Apple Watch This function is now available for Apple Watch applications.
Example
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. The calendar changed on the night of October 4, 1582 to October 15, 1582 (Change to the Gregorian calendar: 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).
  • Versions 24 and later
    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.
    New in version 24
    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 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.
  • Versions 24 and later
    a DateTime variable. In this case, only the date validity is checked.
    New in version 24
    a DateTime variable. In this case, only the date validity is checked.
    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 the other years, DateValid returns False for February 29.
    Tip: To enter a date in the correct format, use a Date edit control. 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.
  • The calculations performed on dates by the WLanguage functions or the WLanguage properties are accurate from January 1st 1583.
Related Examples:
Management of dates Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
Business / UI classification: Neutral code
Component: wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment