Click or drag to resize

AmPm Function

Convert a 24-hour military time to a 12-hour clock time.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.4a
Syntax
 FUNCTION AmPm(
	c24HrTime AS STRING
) AS STRING
View Source

Parameters

c24HrTime
Type: String
A valid military time in the form hh:mO:ss, where hh is hours in 24-hour format, mm is minutes, and ss is seconds.

Return Value

Type: String
An 11-character string in 12-hour format with either "am" or "pm."
If <cTime> does not represent a valid military time, a NULL_STRING is returned.
Remarks
Examples
These examples use AmPm():
X#
1? AmPm("10:45:23")                // 10:45:23 am
2? AmPm("22:45:23")                // 10:45:23 pm
3? AmPm("10:45:23Hello")            // NULL_STRING
4? AmPm("1045")                    // NULL_STRING
5? AmPm("10:45")                    // NULL_STRING
See Also