Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
chaklasiyanikun
Roku Guru

Is there any way to Time addition and subtraction in Roku?

For Time Addition and subtraction. I'm trying with the below code. and for reference to this linkBut no luck. Is there any other option available to do this?

m.time1 = "13:00" 
m.time2 = "06:40"
m.timesplit1 = m.time1.Split(":")
m.timesplit2 = m.time2.Split(":")

m.seconds1 = (m.timesplit1[0].ToInt() * 60) * 60 + m.timesplit1[1].ToInt() * 60  'm.time1 convert into seconds
m.seconds2 = (m.timesplit2[0].ToInt() * 60) * 60 + m.timesplit2[1].ToInt() * 60 'm.time2 convert into seconds
?"m.seconds1 :"m.seconds1
?"m.seconds2 :"m.seconds2

m.subtraction = m.seconds1 - m.seconds2    
m.addition = m.seconds1 + m.seconds2
?"m.subtraction : "m.subtraction
?"m.addition : "m.addition
    
m.totalsubtractionhour = ((m.subtraction / 60) / 60)    
m.totalsubtractionminitus = (m.subtraction / 60)
m.totaladditionhour = ((m.addition / 60) / 60)
m.totaladditionminitus = (m.addition / 60)
?"m.totalsubtractionhour : "m.totalsubtractionhour
?"m.totalsubtractionminitus : "m.totalsubtractionminitus
?"m.totaladditionhour : "m.totaladditionhour
?"m.totaladditionminitus : "m.totaladditionminitus

I refer Both(roDateTime and roTimeSpan) documentations. But Here I tried with all types of string But, I'm not able to parse. I tried to parse with "FromISO8601String" field which is available on roDateTime Object and "GetSecondsToISO8601Date" field which is available on roTimeSpan Object.  or Is there any option available for change clock format(12 hours or 24 hours) using coding. I refer to this Post TheEndless Suggestion. But no luck.

Tags (1)
0 Kudos
1 REPLY 1
chaklasiyanikun
Roku Guru

Re: Is there any way to Time addition and subtraction in Roku?

Any Solution for this.

Tags (1)
0 Kudos
Community is Temporarily in Read-Only Mode!

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. You will not be able to log in or post new comments or kudos 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 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!