MT Code - Mask Time

The MT code is used to convert time notations such as 01:40:30 or 1:30 AM to or from the internal format.

Time is stored internally as the number of seconds from midnight. The stored value can be output in the 12 hour or 24 hour (international) format.

Input Conversion

Input conversion is valid. Generally, for selection processing you should specify MT codes in attribute 7 of the data definition item.

Times can be specified with or without colon separators. If the separators are omitted, the time elements (hours, minutes and seconds) must each consist of two digits, with leading zeros if appropriate.

Note

If the ALT.MT environment option is set, decimal points can also be used as separators.

Syntax

MT{H}{S}

Syntax Elements

H Specifies 12-hour format. If omitted, 24-hour format is used. If included in an output conversion, the AM or PM suffix (as appropriate) is automatically appended.

S Specifies that seconds should be included.

These modifiers apply only to output conversions; they are ignored when used in an input conversion.

Comments

12:00AM is midnight and 12:00PM is noon.

For input conversions, if minutes and/or seconds are omitted they default to 0.

For input conversions, the AM and PM suffixes are ignored if the preceding time is greater than 12:59:59. For example, 13:00AM converts to the same value as 01:00PM.

Input Conversion Examples

Code

Input String

Result

Comments

MT

01:00AM

3600

 

MT

01:00

3600

 

MTH

01:00

3600

H modifier is ignored.

MT

01:00PM

46800

 

MT

01:00:30PM

46830

 

MTS

01:00:30PM

46830

S modifier is ignored.

MT

13:00

46800

 

MT

00:00

0

 

MT

12:00AM

0

Midnight.

MT

12:00PM

43200

Noon.

MT

043020

16220

 

MT

0430

16200

 

MT

4

14400

 

Output Conversion Examples

Code

Stored Value Result

MT

46800

13:00

MTS

46800

13:00:00

MTS

0

00:00:00

MT

3600

01:00

MTH

3600

01:00AM

MTH

46800

01:00PM

MTHS

46800

01:00:00PM

MTHS

0

12:00:00AM