pb_india
asked on
SystemTime
I ahve SYSTEMTIME sysTimeA and sysTimeB
I want to know the difference in number of days.
Ex. If sysTimeA was 20 days befor sysTimeB,
then sysTimeA-sysTimeB = 20 days.
I want their difference in days. Not as: 2 week and 6 days (which I can get from SYSTEMTIME structure)
Is there any API or a way to do so?
I want to know the difference in number of days.
Ex. If sysTimeA was 20 days befor sysTimeB,
then sysTimeA-sysTimeB = 20 days.
I want their difference in days. Not as: 2 week and 6 days (which I can get from SYSTEMTIME structure)
Is there any API or a way to do so?
ASKER
Nope. ABout week, that was just one example I gave. SystemTime gives in year, month, etc too. I wanted to know if there was any better API that does it already.,
In MFC, it provides CTime(), that takes Systemtime as parameter .
int days = CTime(sysTimeA,0)-CTime(sy sTimeB,0) ;
I am looking for something like this but without MFC
In MFC, it provides CTime(), that takes Systemtime as parameter .
int days = CTime(sysTimeA,0)-CTime(sy
I am looking for something like this but without MFC
Hi pb_india,
Use SystemTimeToFileTime to convert it.
I quote:
'The FILETIME structure holds an unsigned 64-bit date and time value for a file. This value represents the number of 100-nanosecond units since the beginning of January 1, 1601.'
A little simple maths should get you what you want from there.
Paul
Use SystemTimeToFileTime to convert it.
I quote:
'The FILETIME structure holds an unsigned 64-bit date and time value for a file. This value represents the number of 100-nanosecond units since the beginning of January 1, 1601.'
A little simple maths should get you what you want from there.
Paul
ASKER
Can you please show me the math to convert it to days?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hmmmm ... what about: days_diff = weeks * 7 + days ???
ike