Fields - formats (time)


Time format templates

A format template may be assigned to a clock time or elapsed time field. Five components are available: days, hours, minutes, seconds and milliseconds. Not all components are compatible with all logical types.

The following characters are used in the definition of time formats:

d|D

Days.

h|H

Hours.

m|M

Minutes

s|S

Seconds

l|L

Milliseconds.

Any other character appearing in a time format is displayed unaltered in its assigned position.

Any component may consist of a single character (i.e. h), or two or more consecutive characters (i.e. mM, HHH). If the value requires more characters than are assigned, a question mark is displayed.

A lower-case character displays a space if the digit at that position is not significant, unless this would cause an embedded space, in which case a zero is displayed.

An upper-case character displays a zero if the digit at that position is not significant, unless the next component is blank, in which case a space is output.

In these examples, a field with logical type es is assigned the value 5.

Format

Output

“HH:MM:SS”

00:00:05

The capital letters cause leading zeros to be displayed.

“HH:MM:sS”

00:00:05

The small s cannot be replaced by a space as this would cause an embedded space.

“hH:mM:SS”

0:00:05

The small h can be replaced by a space, but the small m cannot.

“hh:mm:sS”

5

All the small characters can be replaced by spaces. A leading punctuation character is automatically replaced by a space.

“hH:mm:sS”

5

Normally the H would be replaced by a zero; here however the next component (minutes) is blank, so a space is output.

Alternatively, a standard integer format such as “#####0” can be used. See Numeric formats for time fields.


Default time formats

Each time field type has a standard default format stored in the configuration file common (items 62 - 66), which may be viewed or amended using the configurable text editor sctextw. The default for each type is listed below.

ts

Clock time (in seconds). Valid components are hours, minutes and seconds. A clock time is always modulus the number of seconds in a day, so the greatest possible value is 86399, after which the value returns to 0. If a numeric format is assigned, displays as a number of seconds.

Default: HH:MM (item 62 in common).

td

Time and date. The template must consist of a valid clock time format (type ts) followed by a valid date format (type dn).It is essential that both parts of the format are present and that the clock time appears first. Therefore the first mm component refers to minutes and the second to months.

Default: HH:MM,dD/mM/YY (item 63 in common).

ed

Elapsed days. No time format characters can be meaningfully assigned to this type. The base unit is days, which cannot be displayed in a higher unit such as months or years as these are not of fixed lengths.

Default: the default for the field type and size

eh

Elapsed hours. Time format characters cannot be assigned to this type.

Default: the default for the field type and size

em

Elapsed minutes. Valid components are days, hours and minutes. If a numeric format is assigned, displays as a number of minutes.

Default: hH:MM (item 64 in common)

es

Elapsed seconds. Valid components are days, hours, minutes and seconds. If a numeric format is assigned, displays as a number of seconds.

Default: hH:MM:SS (item 65 in common)

el

Elapsed milliseconds. Valid components are days, hours, minutes, seconds and milliseconds. If a numeric format is assigned, displays as a number of milliseconds.

Default: mM:SS:LLL (item 66 in common)


Numeric formats for time fields

It is not compulsory to display time fields in the form of hours, minutes, and seconds. A suitable numeric format may also be assigned, and the field’s value displayed in terms of the base unit. The ed and eh types (elapsed days and elapsed hours) are only suitable for display in numeric form.


Arithmetic and assignments

Calculations and assignments never carry a format forward with them. For example, a u3 clock time type field with the format “hh:mm” will use this format for input into the field, and for display and printing. But if it the contents of the field are assigned to another field, that field will not inherit the format. It will use its own, or the default for the field type.


RELATED TOPICS

Data fields

Field formats

Numeric formats

Date formats

Logical types

Field flags