如何查找给定日期范围之间的生日 [英] How do I find the birthdays between a given date range

查看:145
本文介绍了如何查找给定日期范围之间的生日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到特定日期范围内的周年纪念日和生日

解决方案

答案非常简单:它是所有日期的完整集合给定的范围。为什么?因为生日意味着日月组合;他们每个人都是某人的生日。没有没有生日的日子。这些简单的推测应该向您展示精确制定问题的重要性。



以下提示将告诉您自己解决问题的重要性。所有你需要的是:

http://msdn.microsoft.com/ en-us / library / xcfzdy4x.aspx [ ^ ],

http:// msdn.microsoft.com/en-us/library/system.datetime.compare.aspx [ ^ ](但请改为使用'==','>','<','> ='或'< ='),

http://msdn.microsoft。 com / zh-cn / library / system.datetime.date.aspx [ ^ ],

HTTP:// MSDN .microsoft.com / zh-cn / library / system.datetime.day.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.datetime.month.aspx [ ^ ]。



关键提示:您需要忽略时间和年份的部分时间。此外,您需要解决问题:如果给定范围的日期超过一年,该怎么办。



-SA

I want to find the anniversary and birthdays that fall on a particular date range

解决方案

The answer is very simple: it is the full set of all dates in the given range. Why? Because "birthday" means day-months combination; and each of them is someone's birthday. There are no days which are "not birthdays". These simple speculations should show you how important to formulate problems precisely.

And the following hints are to teach you how important to solve problems by yourself. All you need is this:
http://msdn.microsoft.com/en-us/library/xcfzdy4x.aspx[^],
http://msdn.microsoft.com/en-us/library/system.datetime.compare.aspx[^] (but instead, use '==', '>', '<', '>=' or '<='),
http://msdn.microsoft.com/en-us/library/system.datetime.date.aspx[^],
http://msdn.microsoft.com/en-us/library/system.datetime.day.aspx[^],
http://msdn.microsoft.com/en-us/library/system.datetime.month.aspx[^].

The key hint: you need to ignore time and year part of the time. Also, you will need to resolve the problem: what to do if the given range has dates of more then one year.

—SA


这篇关于如何查找给定日期范围之间的生日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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