Fullscreen
Loading...
 
[Show/Hide Left Column]
[Show/Hide Right Column]

Print

TOTIME()

Syntax

Formatted_Short_Time as C = TOTIME( Number_Of_Seconds as N, Format_Code as N, Decimal_Places as N )

Argument

Description

Number_Of_Seconds

The number of seconds past midnight.

Format_Code

One of the following formats.

Format Parameter Value

Format

0

ss

1

hh:mm

2

hh:mm:ss

3

ddd:hh:mm:ss

11

hh:mm AM/PM

12

hh:mm:ss AM/PM

13

ddd:hh:mm:ss AM/PM

Decimal_Places

The number of decimal places for seconds. The integer value can be from 0 to 3.

Description

TOTIME() returns a formatted character string containing a time based on the specified Number_Of_Seconds past midnight. The Formatted_String returned can be in one of seven formats specified by the Format_Code, and can contain up to three Decimal_Places for seconds.

Supported By

Alpha Five Version 5 and Above

Examples

? totime(125, 2, 0)

= "0:02:05"

? totime(863.5, 12, 1)

= "0:14:23.5 AM"

You may often need to compute an event's ending time, given the event's start time and duration. For example, assume that an event's start time is stored in START and the event duration (expressed as hh:mm) is stored in DURATION. You can use the following expression to return the time that the event ended:

totime((toseconds(START) + toseconds(DURATION), 1, 0)

If you have imported a time value from Microsoft Excel as a character or numeric value and you wish to convert it to a Short Time value, the following expressions will do the job.

dim dat as C

dat = .345

? totime((val(dat) * 86400),1,0)

= "8:17"

dim dat2 as N

dat2 = .345

? totime(dat2 * 86400,1,0)

= "8:17"

See Also

Date and Time Format Elements, Date and Time Functions


Created by admin. Last Modification: Friday 22 of August, 2014 21:34:39 EDT by Anonymous.

Print