I need a Time function to display Am/Pm

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

I need a Time function to display Am/Pm

#1 Post by unixkd »

Hi all
I need a Time function to display Am/Pm format

Thanks.

Joe

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: I need a Time function to display Am/Pm

#2 Post by bwolfsohn »

************
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

User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

Re: I need a Time function to display Am/Pm

#3 Post by unixkd »

Thanks,

Work well for me.

Joe

Post Reply