Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
StringToDuration (Function)
In french: ChaîneVersDurée
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.
// 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.")
<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"
The direct assignment <Duration variable> = <String> is equivalent to using StringToDuration with the "+DHHMMSSCCC" format.
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help