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
Converts a local datetime to Epoch format (number of time units since 01/01/1970 at 00h00 UTC).
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.
Example
// Displays "1501056581" (in France)
Info(DateTimeToEpoch("20170726100941"))
MyDay is DateTime
MyDay = "20170726100941"
// Displays "1501056581" (in France)
Info(DateTimeToEpoch(MyDay))
Syntax
<Result> = DateTimeToEpoch(<Data to convert> [, <Conversion options>])
<Result>: 8-byte integer
  • Date and time in Epoch format (number of time units since 01/01/1970 at 00h00 UTC).
  • -1 if an error occurred (invalid date and time).
<Data to convert>: Character string (with quotes) or DateTime variable
Local date and time to convert. Can correspond to:
  • a DateTime variable.
  • a character string with one of the following formats:
    • YYYYMMDDHHmmSSCC
    • YYYYMMDDHHmmSSCC
    • YYYYMMDDHHmmSS
    • YYYYMMDDHHmm
    • YYYYMMDDHH
    • YYYYMMDD
This parameter will be considered invalid in the following cases:
  • if the date is invalid or earlier than 01/01/1970. 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.
Remark: It is possible to use dates beyond 2038.
<Conversion options>: Optional Integer constant
Options for converting the date and time to Epoch format:
epochUnixMillisecondThe result will be expressed in milliseconds since 01/01/1970 at 00h00 UTC (time 0 in Unix).
epochUnixSecond
(default value)
The result will be expressed in seconds since 01/01/1970 at 00h00 UTC (time 0 in Unix).
Business / UI classification: Neutral code
Component: wd260std.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment