Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

I want to write a program which will run every day, but show some information to user after 5 days. I am planning to do this by saving in the registry as a date. But can any one tell me the API which will help me getting the date after 5 day from current day???

I mean I want a api which will give the date 6/01/00 if today date is 1/01/00 ( dd/mm/yy)?

Thanks
Posted
Comments
ZurdoDev 27-Mar-13 14:33pm    
You need an api to add 5 days to today's date? I'm confused.
Sergey Alexandrovich Kryukov 27-Mar-13 14:43pm    
What difference would it make? I would say, any time. I basically answered, please see.
—SA
ZurdoDev 27-Mar-13 14:48pm    
What's the difference? No need to complicate things.
Sergey Alexandrovich Kryukov 27-Mar-13 14:51pm    
Sorry, I don't see who do you think is complicating what...
—SA
iDebD 27-Mar-13 14:42pm    
http://msdn.microsoft.com/en-us/library/1f4c8f33(v=vs.80).aspx Gives me current time...What will be date after 5 days???Is there any api...I don't want to make some big calculation....

1 solution

Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724950%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724284%28v=vs.85%29.aspx[^].

As you can see, you have two logically equivalent time data structures, with conversion between them:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms725473%28v=vs.85%29.aspx[^].

Now, pay attention that the FILETIME time is measured in 100ns intervals. That said, you need to convert any time you have to this structure and add required value to is. Apparently, one day will be equal to 24 * 60 * 60 * 1000000000/100. If you need, you can then convert this structure to SYSTEMTIME.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900