Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
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
0 Kudos
2 REPLIES 2
destruk
Binge Watcher

Re: Show Time on Screen

That looks about right - as long as you call that every minute to update the display.
0 Kudos
btpoole
Channel Surfer

Re: Show Time on Screen

Yep that's what stinks about it. Kinda of thought maybe there was a simple component or brightscript function that displayed standard time like on the main roku screen.
0 Kudos