| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Converts a time string into am/pm format.
AmPm( <cTime> ) --> cFormattedTime
The return value is the formatted time string.
AmPm() is a utility function that converts the 24h time string returned by the Time() function to a 12h am/pm time string.
| See also: | Time(), Transform() |
| Category: | Conversion functions |
| Source: | rtl\ampm.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates formatting of Time() string
PROCEDURE Main
LOCAL cMidnight := "00:00:00"
LOCAL cMorning := "07:30:45"
LOCAL cNoon := "12:00:00"
LOCAL cEvening := "19:30:45"
? AmPm( cMidNight ) // result: 12:00:00 am
? AmPm( cMorning ) // result: 07:30:45 am
? AmPm( cNoon ) // result: 12:00:00 pm
? AmPm( cEvening ) // result: 7:30:45 pm
RETURN
http://www.xHarbour.com