previous next top contents index framed top this page unframed
Figure 48–13. $timeToStr
| STRING PROCEDURE $timeToStr (LONG INTEGER time; OPTIONAL BITS ctrlBits; OPTIONAL POINTER($area) area); |
$timeToStr produces a STRING from a MAINSAIL time of day, which may be an absolute (local or GMT) time or a time difference. area specifies the destination area for the resulting STRING if new STRING text is generated; see Section 29.4.
The default format for $timeToStr if time is an absolute time is hour:minute:second, where hour is measured on a 24-hour clock, e.g., 22:16:09, 0:44:00. The minute and second fields always occupy exactly two digits, even if they are zero; the hour field may occupy one or two digits, depending on its value.
Time differences are converted by default to the format:
{-}h hour{s} m minute{s} s second{s}
The - is included if time is negative.
The null STRING is returned if an invalid input value is detected.
The following predefined BITS constants are valid:
| Bit | Meaning |
|---|---|
| $twelveHour | A twelve-hour clock is used. The time is followed by A.M. or P.M., as appropriate. Midnight is given as 12 rather than 0. |
| $excludeSeconds | The time is truncated to the minute. |
| $briefFormat | If time is a time difference, convert it to [+|-]h:m:s, e.g., +02:17:03, -00:01:55. A zero difference has a plus sign (+00:00:00). |
| errorOK | No error message is given if an invalid input value is detected. |
The standard MAINSAIL date and time formats are described in Section 24.1.
Example 48–14. Sample $timeToStr Output Formats
| For sample times of 0:00:17 and 15:46:54, the following
STRING representations are possible:
| ||||||||||||||||||||
MAINSAIL Language Manual, Section 48.14