Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>ampm() time string to 12-format examplep.prg</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
AmPm()         Time string to 12-format                Examplep.prg


Syntax:        AmPm(<expC>)

Argument:      <expC> is a time string in the form: HH:MM:SS.

Returns:       An 11-byte character string in 12-hour am/pm format.

Library:       EXTEND.LIB


----------------------------------- Example --------------------------------

   ? AmPm("13:14:00")               && Result:  1:14:00 pm
   ? AmPm("09:15:00")               && Result: 09:15:00 am


--------------------------------- Source Code ------------------------------

   FUNCTION AmPm

   PARAMETERS cl_time

   RETURN IF(        VAL(cl_time) < 12, cl_time + " am",;
              IF(    VAL(cl_time) = 12, cl_time + " pm",;
                 STR(VAL(cl_time) - 12, 2) + SUBSTR(cl_time, 3) + " pm" ))

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson