PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Time validity
  • Time format
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
TimeToString (Function)
In french: HeureVersChaîne
Converts a time to a string in the specified format.
WEBDEV - Browser code In this version, the time passed as parameter is converted according to the "HH:MM:SS:CC" 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
// Convert the specified time according to the "HH:MM:SS:CC" format
TimeToString("12005956")   // Returns "12:00:59:56"
Left(TimeToString("12005956"), 5) // Returns "12:00"
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows MobileJavaPHPAjaxUser code (UMC)
// Convert the time specified according to the format: "It is: HH h MM"
TimeToString(Now(), "It is: HH h MM") // Returns "It is: 12 h 32"
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows MobileJavaPHPAjaxUser code (UMC)
TodaysDate is Date = DateSys()
EDT_EditDate = DateToDayInAlpha(TodaysDate) + " " + TodaysDate.Day + ...
" " + DateToMonthInAlpha(TodaysDate) + " at " + ...
TimeToString(TimeSys(), "HH:MM:SS")
// The EDT_EditDate control contains for example: Monday 20 August at 14:44:17
Syntax
<Result> = TimeToString(<Time to convert> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Time to convert>: Character string (with quotes), Time or DateTime variable
Time to use. This time can correspond to:
  • a character string in HHMMSSCC format (HH corresponds to hours, MM to minutes, SS to seconds and CC to hundredths of a second).
  • Versions 24 and later
    a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second). In this case, only the time is taken into account.
    New in version 24
    a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second). In this case, only the time is taken into account.
    a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second). In this case, only the time is taken into account.
  • a Time variable.
  • Versions 24 and later
    a DateTime variable. In this case, only the time is taken into account.
    New in version 24
    a DateTime variable. In this case, only the time is taken into account.
    a DateTime variable. In this case, only the time is taken into account.
<Format>: Optional character string (with quotes)
Format that must be applied to the time. This parameter corresponds to:
  • a character string (a sentence for example). The specific characters representing the different elements of the time (HH, MM, SS, CC or AP) will be automatically replaced by their value identified in the <Time> string. In this string:
    • HH represents the number of hours,
    • MM represents the number of minutes,
    • SS represents the number of seconds,
    • CC represents the number of hundredths of a second,
    • AP represents "AM" or "PM" (if "AP" is used, the time is displayed in 12-hour format).
  • Versions 17 and later
    the maskSystemTime constant. This constant allows you to directly use the mask used by the system time.
    AndroidAndroid Widget Java This constant is not available.
    New in version 17
    the maskSystemTime constant. This constant allows you to directly use the mask used by the system time.
    AndroidAndroid Widget Java This constant is not available.
    the maskSystemTime constant. This constant allows you to directly use the mask used by the system time.
    AndroidAndroid Widget Java This constant is not available.
If this parameter is not specified, the result is in HH:MM:SS:CC format.
Remarks

Time validity

The time validity passed as parameter is checked. A message is displayed if the time is invalid. You can check the validity of a time using TimeValid.
Tip: To have a valid time in a string, the time must be entered in a Time Edit control.

Time format

TimeToString is used to format a time returned by IntegerToTime or TimeSys. The result can be assigned to a text control, for example.
Business / UI classification : Neutral code
Component : wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video TimeToString
https://youtu.be/qzkqFp0OzkI

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

// BTN_FORMATAR_HORA

STC_MOSTRA_HORA_FORMATADO=TimeToString(Now(),"A Hora é HH MM")
amarildo
08 May 2019