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: 
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.

0 Kudos
1 REPLY 1
chaklasiyanikun
Roku Guru

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

Any Solution for this.

0 Kudos