05-20-2021, 07:28 PM
What am I overlooking here? I'm wanting to do a date difference but can't remember/figure out how to cast string as int.
How can I do this?
Macro Macro5
How can I do this?
Macro Macro5
int spanDays
_s.timeformat("{yMMdd}")
_i=_s
TimeSpanGetParts sub.DateIntToDateTime(_i)-sub.DateIntToDateTime(210405) spanDays
out spanDays
end
#sub DateIntToDateTime
function'DateTime dateInt
;dateInt - date in decimal format, like 160103 (2016-01-03)
;note: year must be 2-digit, assuming that the actual year is 2000-2099.
DateTime r.FromParts(dateInt/10000%100+2000 dateInt/100%100 dateInt%100)
ret r