Windows api将在5天后获得日期。(如果今天的日期是1/01/00(年/月/日),则返回6/01/00) [英] Windows api to get 5 days later date.(return 6/01/00 if today date is 1/01/00 ( dd/mm/yy))

查看:89
本文介绍了Windows api将在5天后获得日期。(如果今天的日期是1/01/00(年/月/日),则返回6/01/00)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想编写一个每天都会运行的程序,但会在5天后向用户显示一些信息。我计划通过将注册表保存为日期来实现此目的。但是,任何人都可以告诉我API将帮助我在当天5天后获得日期吗???



我的意思是我想要一个api,这将给予日期6/01/00如果今天的日期是1/01/00(年/月/日)?



谢谢

解决方案

请参阅:

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 [ ^ ]。



如你所见,你有两个逻辑等效的时间数据结构,它们之间有转换:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms725473%28v=vs.85%29.aspx [ ^ ]。



现在,请注意 FILETIME 时间是以100ns间隔测量的。也就是说,您需要在任何时候转换到此结构并将所需值添加到is。显然,一天将等于 24 * 60 * 60 * 1000000000/100 。如果需要,您可以将此结构转换为 SYSTEMTIME



-SA

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

解决方案

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


这篇关于Windows api将在5天后获得日期。(如果今天的日期是1/01/00(年/月/日),则返回6/01/00)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆