PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | French EN
  • 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 to an 8-byte real. This real corresponds to:
  • the number of elapsed days since January 1, 1900 (compatible with Excel, starts with 1).
  • the number of elapsed days since January 1, 1904 (compatible with Excel by checking the option "Use 1904 date system", starts with 0).
Remark: The option "Use 1904 date system" can be configured in the advanced options of Microsoft Excel. In Open Office, this option is available in the options of Open Office Calc ("Calculate" section, "Date" option).
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 25 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 25
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
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
// 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 days that correspond to the DateTime variable passed as 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 one of the following formats:
    • YYYYMMDDHHmmSSCCC
    • 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 result gives the serial number that corresponds to the date in the parameter:
  • the count starts with 1 for 01/01/1900.
  • the count starts with 0 for 01/01/1904 if <From 1904> is set to True.
The decimal part gives the fraction of a day that corresponds to the time in the parameter (for example, 06:00 corresponds to 0.25).

Valid dates/times

<DateTime to convert> is considered invalid:
  • if the date is invalid or earlier than the starting date. The date must be between 01/01/1900 and 12/31/999 or 01/01/1904 and 12/31/999. You can check the validity of a date using DateValid.
  • if the time is invalid. You can check the validity of a time using TimeValid.
Business / UI classification : Neutral code
Component : wd260std.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment