Link to home
Start Free TrialLog in
Avatar of pb_india
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?
Avatar of ikework
ikework
Flag of Germany image

hi pb_india,

hmmmm ... what about:   days_diff = weeks * 7 + days ???


ike
Avatar of pb_india
pb_india

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(sysTimeB,0) ;

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
Can you please show me the math to convert it to days?
ASKER CERTIFIED SOLUTION
Avatar of PaulCaswell
PaulCaswell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial