Anyone got some fancy trick on how to calculate differences in days between two dates?

Date1: 02/01/04
Date2: 03/01/04
Difference: 29 days
Posted on 2004-12-05 16:16:05 by JimmyClif

Convert the dates to days since 01.01.1601 and it becomes a simple task.

invoke SendMessage,hWin,DTM_GETSYSTEMTIME,0,addr stime
invoke SystemTimeToFileTime,addr stime,addr ftime
;Convert to days since 01.01.1601
mov ecx,10*1000*1000
mov eax,ftime.dwHighDateTime
xor edx,edx
div ecx
mov ftime.dwHighDateTime,eax
mov eax,ftime.dwLowDateTime
div ecx
mov ftime.dwLowDateTime,eax
mov ecx,24*60*60
mov edx,ftime.dwHighDateTime
mov eax,ftime.dwLowDateTime
div ecx
;eax contains days since 01.01.1601

Posted on 2004-12-05 16:25:45 by KetilO
Oh sweet, thank you very much :thumbsup:
Posted on 2004-12-05 16:47:38 by JimmyClif