I am working on an app that is counting down to a student’s test date. How is this best accomplished? I am using this below, but if the test date is in 2017 or further, this treats the days until the test as if it were the same year
If I choose a test date of 2016-08-15, then the days until is showing as 6 (probably figuring in today). When I choose 2017-08-15 (next year), it shows 5 days until, so this is not right.
What is the setup to account for future years and count the number of days?
Also, I am using the Calendar Picker from the examples. Is there a way to not choose a date earlier than today?
Just for the record, for anybody interested in the subject of time difference, there was a very long thread a couple years ago, which among other things, showed the difference between counting days in Europe and in the US.
This is how you could do it using the new framework:
Dim testDate As New Xojo.Core.Date(2017, 8, 15, Xojo.Core.TimeZone.Current)
Dim interval As Xojo.Core.DateInterval
interval = testDate - Xojo.Core.Date.Now
MsgBox("The test is " + interval.Years.ToText + " years, " + interval.Days.ToText + " days and " + interval.Hours.ToText + " hours from now.")