Home | Sign in | English UK
  • Valid dates/times
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Checks the validity of a date/time included between January 01 0001 at 0 hour 0 minute 0 second 0 hundredth 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 date/time is considered as being invalid if:
    • The "MM" part of the date is not included between "01" and "12".
    • The "DD" part of the date is not included between "01" and "30", between "01" and "31", between "01" and "28" or between "01" and "29" (according to the specified month).
    • This date is included between October 5, 1582 (inclusive) and October 14, 1582 (inclusive). Indeed, the calendar changed in the night from October 4th 1582 to October 15th 1582 (Adjustment to the Gregorian calendar: see the notes).
    • The "HH" part of the time is not included between "00" and "23".
    • The "MM" part of the time is not included between "00" and "59".
    • The "SS" part of the time is not included between "00" and "59".
    • The "CC" part of the time is not item included between "00" and "99".
<Date/Time>: Character string or DateTime variable
Character string in YYYYMMDDHHMMSSCC format (AAAA corresponds to the year, MM to the month, DD to the day, HH to the hour, MM to the minutes, SS to the seconds and CC to the hundredths of a second).

Valid dates/times

  • If the date/time is before October 4th 1582, this date/time belongs to the Julian calendar. This date/time is valid.
  • If the date is after October 15th 1582, this date/time belongs to the Gregorian calendar. This date/time is valid.
  • A year is a leap year if it can be divided by 4, except if the year is also a multiple of 100. The exception concerns the years multiple of 400 that are leap years. For the other years, DateTimeValid returns False for February 29.
    Tip: To enter a date/time in correct format, use a Date/Time edit control. In this case, the validity of the date/time is automatically checked.
  • The storage format allows you to store dates from 01/01/0001 to 12/31/9999.
The calculations performed on the dates/times by the WLanguage functions or by the WLanguage properties are accurate from January 1st 1583.
Business / UI classification : Neutral code
Component : wd250std.dll
Minimum version required
  • Version 19
This page is also available for…
Click [Add] to post a comment