Hi all
I need a Time function to display Am/Pm format
Thanks.
Joe
I need a Time function to display Am/Pm
Re: I need a Time function to display Am/Pm
************
function cusampm(timestring)
************
local minutes,hours,suffix,char_min
hours :=val(subs(timestring,1,2))
minutes:=val(subs(timestring,4,2))
minutes:=hours*60+minutes
hours:=minutes/60
suffix:=if(hours<12,'am','pm')
if hours>12
hours:=hours-12
endif
if hours<1
hours:=12+hours
endif
char_min:=str(60*(hours-int(hours)),2,0)
return( str(int(hours),2,0)+':'+IF(char_min=' ','0'+SUBS(char_min,2,1),char_min)+suffix )
function cusampm(timestring)
************
local minutes,hours,suffix,char_min
hours :=val(subs(timestring,1,2))
minutes:=val(subs(timestring,4,2))
minutes:=hours*60+minutes
hours:=minutes/60
suffix:=if(hours<12,'am','pm')
if hours>12
hours:=hours-12
endif
if hours<1
hours:=12+hours
endif
char_min:=str(60*(hours-int(hours)),2,0)
return( str(int(hours),2,0)+':'+IF(char_min=' ','0'+SUBS(char_min,2,1),char_min)+suffix )
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Re: I need a Time function to display Am/Pm
Thanks,
Work well for me.
Joe
Work well for me.
Joe