I want to have timer info/status string in my sitemap that shows an expiration time of the form:
“Timer Expires at: 12:53PM TODAY, 54 minutes remaining,” where the “TODAY” part is either “TODAY” or “TOMORROW” in cases where the timer is set today (say, at 10:45PM, for 3 hours) and expires in the early AM hours the following day.
I have the "expires at: " and “minutes remaining” worked out, I just need a way to calculate TODAY or TOMORROW by comparing time.Now to Timer_Ends_At
What is the easiest way to accomplish this using JodaTime? So far I have:
.rules file:
var string TimerRemainingDisp_TodayTomorrow = "empty" // starting value
if ( daysBetween(time.Now,Timer_Ends_At.DateTime ) == 0 )
// If there are zero days between Now and the Timer_Ends_At, that means it is the same day, i.e. Today.
// The timer is never longer than 12 hours, so the difference between Now and Timer_Ends_At is never greater than 1 day. No need to cover multi-day cases.
{ TimerRemainingDisp_TodayTomorrow = "TODAY"}
else
{ TimerRemainingDisp_TodayTomorrow = "TOMORROW"}