Post Reply 
Time and Battery Indicators
10-25-2017, 05:38 PM
Post: #9
RE: Time and Battery Indicators
I was aware of the Time variable and had that part, and a date display, updating with these little programs to create the strings to display. I had not yet discovered CAS.Time, thanks for that, I saved a conversion as a result.

Code:
// return 12 hour string of current time
TimeString()
BEGIN
  LOCAL h,m,dtime:=CAS.Time;
  h:=IP(dtime) MOD 12;
  m:=IP(FP(dtime)*60);
  RETURN(STRING(h,1,0)+":"+IFTE(m<10,"0","")+STRING(m,1,0)+IFTE(dtime>12,"PM","AM"));
END;

// convert the internal value for Date to a date string in the format MMM DD
DateString()
BEGIN
  LOCAL date_val:=Date,year,month,day,month_list:={"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};
  year:=IP(date_val);
  month:=IP((date_val-year)*100);
  day:=FP(FP(date_val)*100)*100;
  RETURN(month_list(month)+" "+STRING(day,1,0));
END;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Time and Battery Indicators - Jacob Wall - 10-22-2017, 09:30 PM
RE: Time and Battery Indicators - Jacob Wall - 10-25-2017 05:38 PM



User(s) browsing this thread: 1 Guest(s)