Time

Description:              This function returns a formatted string for a time of day.

Returns:                    Text

Usage:                       Script or Steady State

Format:                      Time(Sec, TimeForm [, Flags])

Parameters:             Sec     { numeric }  { required }  { no default: }

                                                Any numeric expression giving the number of seconds since mid night.

                                    TimeForm     { varies }  { required }  { no default: }

                                                Any numeric expression giving the option for the time format. If TimeForm is numeric, the format for the time will be interpreted.

                             If TimeForm is a text value that does not resolve to a numeric, it is interpreted as a time formatting string as follows:

String

Description

h

Hours with no leading zero for single-digit hours; 12-hour clock.

hh

Hours with leading zero for single-digit hours; 12-hour clock.

H

Hours with no leading zero for single-digit hours; 24-hour clock.

HH

Hours with leading zero for single-digit hours; 24-hour clock.

m

Minutes with no leading zero for single-digit minutes.

mm

Minutes with leading zero for single-digit minutes.

s

Seconds with no leading zero for single-digit seconds.

ss

Seconds with leading zero for single-digit seconds.

t

One character time-marker string, such as A or P.

tt

Multi character time-marker string, such as AM or PM.

 

                             In the event that the TimeForm parameter does not resolve to either a numeric or text value, the system-configured time format, as specified through the Windows Control Panel, is used. In this case, the Flags parameter is used to select from a number of options for the date.

                                    Flags is an optional parameter that is only used in the event that the DateForm parameter does not resolve to a numeric or a text value. The Flags parameter may be set as follows to adjust the format of the date.

Value

Description

1

Do not generate minutes or seconds.

2

Generate minutes, but do not generate seconds.

8

Force 24-hour time format.

Note: The format string characters are case-sensitive. If you wish to include one of the formatting characters in your output string, then you must surround it with single quotation marks. For example, h'h' would display the current hour number in 12-hour clock format, with a lowercase h suffixed to it.

Comments:               The Sec parameter may be negative, in which case it specifies the time before midnight. If greater than 86400, it specifies the time in the next day. The text string returned is at most 11 characters long.

Examples:

ZText(10, 10, Time(Now(1), 2), 15, 0);

time1 = Time(28800, 2);

time2 = Time(28800, 7);

The first statement will display the current time in the upper right corner of the window in the form "08:24:13", and will update every second. The value of time1 and time2 will not be displayed, but will be set to "08:00:00" and "08:00 AM" respectively.

See Also:

Date | Now | Seconds