Sunday, May 5, 2013

function to check for time in hh:mm


'*****************************************
'function to check for time in hh:mm
'****************************************
Function  fnTimeFormat(strTime)
   'arrTime(0)="hh:mm"
  ' arrTime(1)="AM" or "PM"
  'arrTime(2)="TZ"
'  arrSplit(0)="HH"
'  arrSplit(1)="MM"
   arrTime=split(strTime," ")
 arrSplit=split(arrTime(0),":")

if((arrSplit(0)>=0 and arrSplit(0)<=12) and (arrSplit(1)>=0 and arrSplit(1)<=60) and (arrTime(1)="AM" or arrTime(1)="PM") and (LEN(arrTime(2))=3)) then
retVal=1
else
retVal=0
end if
fnTimeFormat=retVal
End Function

No comments:

Post a Comment