Macro Macro2965
Macro Macro2965
out
DateTime t.FromComputerTime
out F"{t.ToStr} - now"
t.AddParts(0 1)
out F"{t.ToStr} - now+1h"
out "-----"
out
DateTime tNow tNext
tNow.FromComputerTime
tNow.t-tNow.t%10000 ;;AddMonths ignores microseconds, then GetParts would return days-1
out F"{tNow.ToStr} - now"
tNext=sub.GetLastDayOfMonth(tNow 1)
out F"{tNext.ToStr} - last day of next month"
int daysDiff; DateTime.TimeSpanGetParts(tNext-tNow daysDiff)
out F"{daysDiff} - daysDiff"
int weekDayNow; tNow.GetParts(0 0 0 0 0 0 0 0 weekDayNow)
out F"{weekDayNow} - weekDayNow"
;I cannot help more, but now you have all info to subtract sundays and saturdays from daysDiff
#sub GetLastDayOfMonth
function'DateTime DateTime't monthsToAdd
t.AddMonths(monthsToAdd)
int year month day lastDay; t.GetParts(year month day)
lastDay=DateTime.DaysInMonth(year month)
t.AddParts(lastDay-day)
ret t