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 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.
Versions 16 and later
Android This function is now available for Android applications.
New in version 16
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.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 20 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 20
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
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
// 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 by 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:
    durationMilliFormat used: "+DHHMMSSCCC"
    durationCentiFormat used: "+DHHMMSSCC": used to create a duration from the format of the result of DateTimeDifference
Remarks
The direct assignment <Duration variable> = <String> is equivalent to using StringToDuration with the "+DHHMMSSCCC" format.
Business / UI classification: Neutral code
Component: wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video StringToDuration
https://youtu.be/c-Ih6WpX4Ws

https://windevdesenvolvimento.blogspot.com/2019/05/dicas-2106-windev-webdev-mobile-data-29.html

// EDT_BTN_cALCULAR_DIAS

diferencia is string = DateTimeDifference(EDT_DATA_INICIAL_1, EDT_DATA_FINAL_1)
duracao is Duration=StringToDuration(diferencia, durationCenti)
EDT_dias_1=duracao..Day
amarildo
11 May 2019