3.2.54. TIME([option_out [,time [option_in]]])

Returns a string containing information about the time. To get the
time in a particular format, an option_out can be specified. The
default option_out is Normal. The meaning of the possible options
are:

[C]
     (Civil) Returns the time in civil format.  The return value
     might be “hh:mmXX”, where XX are either am or pm. The hh part
     will be stripped of any leading zeros, and will be in the
     range 1-12 inclusive.

[E]
     (Elapsed) Returns the time elapsed in seconds since the
     internal stopwatch was started.  The result will not have any
     leading zeros or blanks.  The output will be a floating point
     number with six digits after the decimal point.

[H]
     (Hours) Returns the number of complete hours that have passed
     since last midnight in the form “hh”. The output will have no
     leading zeros, and will be in the range 0-23.

[L]
     (Long) Returns the exact time, down to the microsecond. This
     is called the long format. The output might be
     “hh:mm:ss.mmmmmm”.  Be aware that most computers do not have
     a clock of that accuracy, so the actual granularity you can
     expect, will be about a few milliseconds. The hh, mm and ss
     parts will be identical to what is returned by the options H,
     M and S respectively, except that each part will have leading
     zeros as indicated by the format.

[M]
     (Minutes) Returns the number of complete minutes since
     midnight, in a format having no leading zeros, and will be in
     the range 0-59.

[N]
     (Normal) The output format is “hh:mm:ss”, and is padded with
     zeros if needed. The hh, mm and ss will contain the hours,
     minutes and seconds, respectively. Each part will be padded
     with leading zeros to make it double-digit.

[R]
     (Reset) Returns the value of the internal stopwatch just like
     the E option, and using the same format. In addition, it will
     reset the stopwatch to zero after its contents has been read.

[S]
     (Seconds) Returns the number of complete seconds since
     midnight, in a format having no leading spaces, and will be
     in the range 0-59.

Note that the time is never rounded, only truncated. As shown in
the examples below, the seconds do not get rounded upwards, even
though the decimal part implies that they are closer to 59 than to
58 . The same applies for the minutes, which are closer to 33 than
to 32, but is truncated to 32.

None of the formats will have leading or trailing spaces.

Assuming that the time is exactly 14:32:58.987654, the following
will be true:

     TIME(‘C’) –>   ‘2:32pm’
     TIME(‘E’) –>   ‘0.01200’  /* Maybe */
     TIME(‘H’) –>   ‘14’
     TIME(‘L’) –>   ‘14:32:58.987654’
     TIME(‘M’) –>   ‘32’
     TIME(‘N’) –>   ‘14:32:58’
     TIME(‘R’) –>   ‘0.430221’  /* Maybe */
     TIME(‘S’) –>   ‘58’

If the time option is specified, the function provides for time
conversions.  The optional option_in specifies the format in which
time is supplied.  The possible values for option_in are:  CHLMNS.
The default value for option_in is N.

     TIME(‘C’, ‘11:27:21’)         –>   ‘11:27am’
     TIME(‘N’, ‘11:27am’, ‘C’)     ->   ‘11:27:00’

The time conversion capability of the TIME BIF was introduced with
the ANSI standard.



PREV NEXT