PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Time validity
  • Time format
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
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.
Example
// Formater l'heure spécifiée selon le format "HH:MM:SS:CC"
TimeToString("12005956")   // Renvoie "12:00:59:56"
Left(TimeToString("12005956"), 5) // Renvoie "12:00"
WEBDEV - Server codePHPAjax
// Formater l'heure spécifiée selon le format "Il est: HH h MM"
TimeToString(Now(), "Il est: HH h MM") // Renvoie "Il est: 12 h 32"
WEBDEV - Server codePHPAjax
DateAujourdhui is Date = DateSys()
SAI_SaisieDate = DateToDayInAlpha(DateAujourdhui) + " " + DateAujourdhui.Day + ...
" " + DateToMonthInAlpha(DateAujourdhui) + " à " + ...
TimeToString(TimeSys(), "HH:MM:SS")
// Le champ SAI_SaisieDate contient par exemple: Lundi 20 Août à 14:44:17
Syntax
<Result> = TimeToString(<Time to convert> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Time to convert>: Character string, Variable of type Time or Variable of type DateTime
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
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 with 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.
    New in version 17
    the maskSystemTime constant. This constant allows you to directly use the mask used by the system time.
    the maskSystemTime constant. This constant allows you to directly use the mask used by the system time.
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: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment