Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
  • Valid dates/times
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Checks the validity of a date/time between January 01, 0001 at 0 hours 0 minutes 0 seconds 0 hundredths of a second and December 31, 9999 at 23 hours 59 minutes 59 seconds 99 hundredths of a second.
Res = DateTimeValid("2001122523122222") // Res returns True
Res = DateTimeValid("200125122312")   // Res returns False
Res = DateTimeValid("200123")       // Res returns False
Res = DateTimeValid("1482122524")   // Res returns False
<Result> = DateTimeValid(<Date/Time>)
<Result>: Boolean
  • True if the date/time is valid.
  • False otherwise. A DateTime 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 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 the notes).
    • "HH" is not between "00" and "23".
    • "mm" is not between "00" and "59".
    • "SS" is not between "00" and "59".
    • "CC" is not between "00" and "99" (or "CCC" is not between "00" and "999").
<Date/Time>: Character string or DateTime variable
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)).

Valid dates/times

  • If the date/time is before October 4, 1582, it belongs to the Julian calendar. In this case, the date/time is valid.
  • If the date/time is after October 15, 1582, it belongs to the Gregorian calendar. In this case, the date/time 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, DateTimeValid returns False for February 29.
    Tip: To enter a date/time with the correct format, use a Date Edit control and choose or define an input mask that includes the date and time (e.g. "DD/MM/YYYY HH:mm:SS"). In this case, the validity of the date/time 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 and times from January 1st, 1583.
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 19
This page is also available for…
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help