如何编写函数,让您在两个日期之间的一周结束时获得所有假期 [英] how to write function which gives you all holidays that fall on week ends between two dates

查看:63
本文介绍了如何编写函数,让您在两个日期之间的一周结束时获得所有假期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GetWeekEndHolidays(dtFromDate,dtToDate)

如何编写函数来为您提供两个日期之间的一周中的所有假期

GetWeekEndHolidays(dtFromDate, dtToDate)

how to write function which gives you all holidays that fall on week ends between two dates

推荐答案

如果您的计算机上安装了Outlook,则可以获取假期列表,它随安装一起提供.

如果已安装Microsoft Office 2007,请检查以下路径:
C:\ Program Files \ Microsoft Office \ Office12 \ 1033 \ Outlook.hol

该文件包含以下格式的许多国家/地区已知的假期:
...
[美国] 168
2006年12月25日圣诞节,
2007年12月25日圣诞节,
圣诞节,2008/12/25
2009年12月25日圣诞节,
2010年12月25日圣诞节,
2011年12月25日圣诞节,
2012年12月25日圣诞节,
圣诞前夕,2006/12/24
...

只是个想法而已:)

问候
Espen Harlinn
If you have Outlook installed on your machine, you can obtain the holidays list, which is shipped with its installation.

If you''ve installed Microsoft Office 2007, check the following path:
C:\Program Files\Microsoft Office\Office12\1033\Outlook.hol

This file contains known holidays for many countries in the following format:
...
[United States] 168
Christmas Day,2006/12/25
Christmas Day,2007/12/25
Christmas Day,2008/12/25
Christmas Day,2009/12/25
Christmas Day,2010/12/25
Christmas Day,2011/12/25
Christmas Day,2012/12/25
Christmas Eve,2006/12/24
...

It''s just a thought :)

Regards
Espen Harlinn


建立假期列表:

0)定义假期,指示假期的起始日期(一年中的某天).

1)编写一种将序号日期应用于当前年份的方法,并查看其登陆日期是星期六还是星期日.将此布尔值(bool m_isWeekend)存储在列表项中.

比较日期:

0)将假日日期与指定的日期范围进行比较,并检查m_isWeekend变量以查看是否为周末假日
Build a list of holidays:

0) Define the holidays indicates their ordinal date (day of the year).

1) Write a method that applies the ordinal date to the current year, and see if the day it lands on is either Saturday or Sunday. Store this boolean value (bool m_isWeekend) in the list item.

Compare the dates:

0) Compare the holiday dates with the specified date range, and check the m_isWeekend variable to see if it''s a weekend holiday


这篇关于如何编写函数,让您在两个日期之间的一周结束时获得所有假期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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