Lotus Notes FAQ Visit Our Sponsor!

How do you convert a time field to display as military time?

REM "From Jason Collier (jcollier@sd.synetics.com)";
time := @Time(StartTime);
t:= @Text(@Time(time));
t2:=@Left(@Text(@ReplaceSubstring(@Text(@Time(time)); ":" ;"")); 6);
h:=@Left(t2;2);
s:=@Right(t2;2);
m:=@Middle(t2;2;2);
AM:=@ReplaceSubstring(@Left(t2;2) ; "12" ;"00");
PM:=@ReplaceSubstring(@Left(t2;2) ; "12" ;"12");
PM2:=@Text(@TextToNumber(h)+12);
timecheck:= @If(@Contains(t;"AM"); AM ; @If(@Contains(t;"PM") & @Contains(@Left(t2;2);"12") ; PM ; PM2));
timecheck + m

Applies to Notes Versions: 3, 4, 4.5, 4.6, 5
Last Modified: February 7, 2000