如何创建假期日历表 [英] how to create a holiday calendar table
本文介绍了如何创建假期日历表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能给我关于如何创建和使用假期日历表的想法.
我需要计算南非的上学日,不包括周末和节假日.
在我的schoolterm表中,我有StartDate和EndDate列,我尝试使用DATEDIFF
,但它包括周末和假期.
Can anyone give me ideas on how to create and use holiday calendar tables.
I need to calculate South African school days, excluding weekends and holidays.
In my schoolterms table I have got columns StartDate and EndDate, I tried using DATEDIFF
but it includes weekends and holidays.
推荐答案
假日表
编号ID
DATE HOLIDAY_DATE
VARCHAR COUNTRY
我觉得这对您来说还不够,但是您需要指定您的问题.
重播此解决方案的第一条评论
算法:
holiday table
NUMERIC ID
DATE HOLIDAY_DATE
VARCHAR COUNTRY
I get the feeling that''s not enough for you, but you need specify your question.
Replay to the first comment to this solution
The algorithm:
List schoolDays = empty list
Loop over each date in your date range
if(IsSchoolDay)
Add current date to schoolDays
return schoolDays
IsSchoolDay定义为
IsSchoolDay is defined as
IsSchoolDay (Date date)
is date a saturday or sunday
return false
is date in the holiday table
return false
return true
这篇关于如何创建假期日历表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文