With this Code I try to get the Difference in Days between two Dates:
When lngToday is 22/03/2017 and lngNewDate is 04/05/2017 the Difference is 14 Days.
But When between this 2 Dates is a Sunday, the result of variable "DaysLeft" is one day less
Only when the current date has exceeded Sunday, the correct difference is displayed.
Where is my Error ??
B4X:
...
Dim lngToday As Long
Dim lngNewDate As Long
Dim lngDiff As Long
Dim DaysLeft As Long
lngToday = DateTime.DateParse(DateTime.Date(DateTime.Now))
lngNewDate = DateTime.DateParse(04/05/2017)
lngDiff = lngNewDate - lngToday
DaysLeft = lngDiff / DateTime.TicksPerDay
...
But When between this 2 Dates is a Sunday, the result of variable "DaysLeft" is one day less
Only when the current date has exceeded Sunday, the correct difference is displayed.
Where is my Error ??