PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | French 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 duration to a character string in the specified format.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
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 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
// Start time and end time
StartTime is Time = "125324"
EndTime is Time = "140852"
// Calculate the duration
MyDuration is Duration = EndTime - StartTime
// Format the duration in order to get a result in the same format as DateTimeDifference
Res = MyDuration.ToString(durationCenti) // Res = "001152800"
// Custom formatting
Res = MyDuration.ToString("D-HH:MM")    // Res =  "0-01:15"
Syntax
<Result> = <Duration>.ToString(<Format>)
<Result>: Character string
Character string in the specified format.
<Duration>: Duration variable
Duration variable containing the duration in "+DHHMMSSCCC" format (D corresponds to the number of days, HH to hours, MM to minutes, SS to seconds and CCC to milliseconds).
<Format>: Character string or constant
Format to apply to the duration. This parameter can correspond to:
  • a character string (a sentence for example). The characters that represent the different elements of the duration (D, HH, MM, SS or CCC) will be automatically replaced by the value in the <Duration> parameter. The following characters are used in this string:
    • + is used to take the negative numbers into account,
    • D represents the number of days,
    • HH represents the number of hours,
    • MM represents the number of minutes,
    • SS represents the number of seconds,
    • CCC represents the number of milliseconds.
  • one of the following constants:
    durationMilliFormat used: "+DHHMMSSCCC"
    durationCentiFormat used: "+DHHMMSSCC". This format allows you to retrieve the result in the format used by DateTimeDifference.
Remarks
The direct assignment <String> = <Duration> is equivalent to using <Duration type>.ToString with the "+DHHMMSSCCC" format.
Component : wd260std.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment