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.2a
Syntax
 FUNCTION AmPm(
	c24HrTime AS STRING
) AS STRING
View Source

Parameters

c24HrTime
Type: String
A valid military time in the form hh:mm: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#
? AmPm("10:45:23")                                // 10:45:23 am
? AmPm("22:45:23")                                // 10:45:23 pm
? AmPm("10:45:23Hello")                        // NULL_STRING
? AmPm("1045")                                        // NULL_STRING
? AmPm("10:45")                                        // NULL_STRING
See Also