PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Calculation mode
  • Valid dates/times
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
Converts a date and a time into an 8-byte real. This real corresponds to:
  • the day number from January 1st 1900 (compatible with Excel, starts from 1).
  • the day number from January 1st 1904 (compatible with Excel with the option "Use the calendar from 1904", starts from 0).
Note: The option "Use the calendar from 1904" can be configured in the advanced options of MS Excel. In Open Office, this option is available in the options of Open Office Calc ("Calculate" item).
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.
Example
// Displays "3.25"
Info(DateTimeToReal("190001030600"))
MyDay is DateTime
MyDay = "190001030600"
// Displays "3.25"
Info(DateTimeToReal(MyDay))
Syntax
<Result> = DateTimeToReal(<DateTime to convert> [, <From 1904>])
<Result>: Real
  • Number of the day corresponding to the DateTime variable passed in parameter.
  • -1 if an error occurred (invalid date and time).
<DateTime to convert>: DateTime variable or character string
Value of the date and time to convert. This parameter can correspond to:
  • a DateTime variable.
  • a character string in the following format:
    • YYYYMMDDHHMMSSLLL
    • YYYYMMDDHHMMSSCC
    • YYYYMMDDHHMMSS
    • YYYYMMDDHHMM
    • YYYYMMDDHH
    • YYYYMMDD
<From 1904>: Optional boolean
Calculation mode:
  • True if the date is calculated from 1904.
  • False (default value) if the date is calculated from 1900.
Remarks

Calculation mode

The integer part of the real gives the day number of the date part of the parameter:
  • the numbering starts from 1 for 01/01/1900.
  • the numbering starts from 0 for 01/01/1904 if <From 1904> is set to True.
The decimal part gives the day fraction of the time part of the parameter (for example, 06:00 gives a decimal part of 0.25).

Valid dates/times

<DateTime to convert> is considered as being invalid:
  • if the date is invalid or if it is earlier than the start date of numbering. The date must be included between 01/01/1900 or 01/01/1904 and 12/31/999. The date validity can be checked by DateValid.
  • if the time is invalid. The time validity can be checked by TimeValid.
Business / GUI classification : Neutral code
Component : wd250std.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment