Small library routines that validate or format time strings. Will format times as hour, hour:minute or hour:minute:second. Standard formatting will include am or pm, military formatting will present hour values in 24 hour format. You can optionally trim leading zeros.

Basic usage is:

 
If IsValidTime( value, ":" ) Then ... 
v = FormatStandardTime( value, %TimeFormats.H, ":" ): ' .......................... hh pm 
v = FormatStandardTime( value, %TimeFormats.HM, ":" ): ' ......................... hh:mm pm 
v = FormatStandardTime( value, %TimeFormats.HMS, ":" ): ' ........................ hh:mm:ss pm 
v = FormatStandardTime( value, %TimeFormats.H Or %TimeFormats.TrimZero, ":" ): ' h pm 
v = FormatStandardTime( value, %TimeFormats.HM Or %TimeFormats.TrimZero, ":" ): ' h:mm pm 
v = FormatStandardTime( value, %TimeFormats.HMS Or %TimeFormats.TrimZero, ":" ): ' h:mm:ss pm 
v = FormatMilitaryTime( value, %TimeFormats.H, ":" ): ' .......................... hh 
v = FormatMilitaryTime( value, %TimeFormats.HM, ":" ): ' ......................... hh:mm 
v = FormatMilitaryTime( value, %TimeFormats.HMS, ":" ): '......................... hh:mm:ss 
v = FormatMilitaryTime( value, %TimeFormats.H Or %TimeFormats.TrimZero, ":" ): ' h 
v = FormatMilitaryTime( value, %TimeFormats.HM Or %TimeFormats.TrimZero, ":" ): ' h:mm 
v = FormatMilitaryTime( value, %TimeFormats.HMS Or %TimeFormats.TrimZero, ":" ): ' h:mm:ss