Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time span in days (int)
#2
Quote:I wonder whether there exists a fast way
No.
One of ways:
Macro Macro2766
Code:
Copy      Help
int d1=(16<<16) | (1<<8) | 3 ;;date 16-01-03 -> 0x100103
int d2=d1+5 ;;+ 5 days

int spanDays
TimeSpanGetParts sub.DateIntToDateTime(d2)-sub.DateIntToDateTime(d1) spanDays
out spanDays


#sub DateIntToDateTime
function'DateTime dateInt

;note: year must be 2-digit, assuming that the actual year is 2000-2099.


DateTime r.FromParts(dateInt>>16&255+2000 dateInt>>8&255 dateInt&255)
ret r


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)