Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find Date Difference in BrightScript

I have an issue with datetime.

I have two strings. e.g 24-9-15 and 2-10-15. Both are two strings.

I want to find out the difference (in days) between them.

Can you please help me out?

like image 582
Developer Avatar asked May 11 '26 20:05

Developer


1 Answers

1) Parse the 2 strings to roDateTime objects.

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

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

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

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

ie. (seconds/3600) / 24

like image 92
Akshat Agarwal Avatar answered May 18 '26 17:05

Akshat Agarwal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!