Click or drag to resize

TString Function

X#
Convert a specified number of seconds to a time string.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION TString(
	nSeconds AS USUAL
) AS STRING
Request Example View Source

Parameters

nSeconds
Type: Usual
The number of seconds to convert.

Return Value

Type: String
The format of the return value is dependent on several functions, including SetAMPM(), SetAMExt(), SetPMExt(), and SetInternational(), which you can refer to for more information.
If nSeconds is greater than 86,400 (the number of seconds in one day), the number of seconds past the whole number of days is returned (see the second example below).
Remarks
TString() converts a specified number of seconds to a time string. Days() is a related function that is particularly useful when nSeconds is greater than 86,400, since it returns the number of full days in a given number of seconds.
Examples
This example uses TString() on a number less than 86,400.
The initial settings define a 12-hour time format with " AM" and " PM" as the morning and evening extensions:
X#
1SetAMPM(TRUE)
2SetAMExt(" AM")
3SetPMExt(" PM")
4? TString(6400)        // 01:46:40 AM
This example passes 303,600 to TString(). Since 303,600 seconds is equal to 3 days, 11 hours, and 20 minutes, TString() only returns the time past the whole 3 days.
The initial settings define a 24-hour format with no morning or evening extension:
X#
1SetAMPM(FALSE)
2SetAMExt(NULL_STRING)
3SetPMExt(NULL_STRING)
4? TString(303600)        // 12:20:00
5? Days(303600)            // 3
See Also