Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Channel Surfer

Show Time on Screen

How can you show standard time that updates with time change? I am able to show time on screen but I have to call dt.roDateTime, then convert to standard time. My code is below and not very convenient just to show the standard time.
datetime=createobject("roDateTime")
dt=createobject("roDateTime")
dt.tolocaltime()
chour=dt.GetHours()
cminute=dt.GetMinutes()
IF chour=0
chour=12
ampm="AM"
ELSE
If chour=12
chour=12
ampm="PM"
Else
If chour>12
chour= chour-12
ampm="PM"
Else
If chour<12
chour=chour
ampm="AM"
ENDIF
ENDIF
ENDIF
ENDIF
if dt.getMinutes() <10
cminute="0"+str(dt.getMinutes())
else
cminute=str(dt.getMinutes())
end if
ctime=str(chour) + ":" + cminute + " " + ampm
Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!