Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
btpoole
Level 7

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
destruk
Level 10

Re: Show Time on Screen

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

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