Find Date Difference in BrightScript

I have a problem with datetime.

I have two lines. for example 24-9-15

and 2-10-15

. Both lines are two lines.

I want to know the difference (between days) between them.

Could you help me?

+3


source to share


3 answers


1) Split 2 lines into roDateTime objects.

Link - http://sdkdocs.roku.com/display/sdkdoc/roDateTime

2) get time in seconds for both dates by doing date1.AsSeconds()

anddate2.AsSeconds()



3) Subtract 2 times, so you have a time difference in seconds.

4) Divide those seconds by 3600 to convert to hours, then divide by 24 to convert to days

t. (seconds/3600) / 24

+1


source


date1 = CreateObject("roDateTime")
date2 = CreateObject("roDateTime")
diffInSeconds = date1.asSeconds() - date2.asSeconds()
print "seconds lapsed " diffInSeconds

      



0


source


If these are your lines, I don't think there are any functions to help you. You may need to do this manually. However, you can take a look at the ifDateTime functions and see if they help.

0


source







All Articles