ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Converts a duration in character string format to a duration that can be used by a Duration variable.
Remarks:
  • This function is mainly used to assign the result of DateTimeDifference to a Duration variable.
  • The direct assignment <Duration variable> = <String> is equivalent to using StringToDuration with the "+DHHMMSSCCC" format.
Example
// Pour remplir une durée à partir du résultat de DateHeureDifférence
sDiff is string 
sDiff = DateTimeDifference(sDébut, sFin)
// On convertit la différence dans une variable de type Durée
dDurée is Duration 
dDurée = StringToDuration(sDiff, durationCenti)
sMaChaîne is string = "La durée est de 3 jours, 13 heures, 45 minutes." 
dDurée is Duration 
dDurée = StringToDuration(sMaChaîne, "La durée est de J jours, HH heures, MM minutes.")
Trace(dDurée)
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: "+JHHMMSSCC": creates a duration from the format of the result of the DateTimeDifference function
    durationMilliFormat used: "+JHHMMSSCCC".
Business / UI classification: Neutral code
Component: wd300std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help