tips:refresh_age
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
tips:refresh_age [2018/01/10 21:21] – Formula to calculate time since last weather refresh toby_goodlock | tips:refresh_age [2018/01/26 19:24] – [Example] toby_goodlock | ||
---|---|---|---|
Line 4: | Line 4: | ||
===== Example ===== | ===== Example ===== | ||
- | '{dh24}' > (string.sub(' | + | |
+ | '{dh23z}' > (string.sub(' | ||
+ | (string.sub(' | ||
===== Explanation ===== | ===== Explanation ===== | ||
- | By using this formula in the text field we are comparing the current hour (1-24) to the hour of the last refresh. | + | By using this formula in the text field we are comparing the current hour (00-23) to the hour of the last refresh. |
+ | |||
+ | If the current hour is greater then we add 60 to the current minute and subtract the last refresh minutes value. | ||
If the hours are the same we simply subtract the last refresh minutes from the current minutes. | If the hours are the same we simply subtract the last refresh minutes from the current minutes. | ||
+ | |||
+ | For 12am, we check if the current hour is 00 and if the last refresh hour is 23 and if so make the current hour 24 to do our math. | ||
tips/refresh_age.txt · Last modified: 2018/01/26 19:25 by toby_goodlock