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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Converts a duration in character string format to a duration that can be used by a Duration variable.
Remark: This function is mainly used to assign the result of DateTimeDifference to a Duration variable.
Example
// To fill a duration from the result of DateTimeDifference
sDiff is string
sDiff = DateTimeDifference(sStart, sEnd)
// Convert the difference to a Duration variable
dDuration is Duration
dDuration = StringToDuration(sDiff, durationCenti)
sMyString is string = "The duration is 3 days, 13 hours, 45 minutes."
dDuration is Duration
dDuration = StringToDuration(sMyString, "The duration is D days, HH hours, MM minutes.")
Trace(dDuration)
Syntax
<Result> = StringToDuration(<String> , <Format>)
<Result>: Duration variable
Duration in a format recognized by the Duration variables.
<String>: Character string
Duration in the format specified in <Format>.
<Format>: Character string
Format of the duration to convert. This format corresponds 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 with the value in the <String> parameter. In this string:
    • 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:
    durationCentiFormat used: "+DHHMMSSCC": used to create a duration from the format of the result of DateTimeDifference
    durationMilliFormat used: "+DHHMMSSCCC"
Remarks
The direct assignment <Duration variable> = <String> is equivalent to using StringToDuration with the "+DHHMMSSCCC" format.
Business / UI classification: Neutral code
Component: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment