我有一个用c#编写的应用程序无法在公共假日或周末运行。我已经环顾四周,并没有找到任何地方(官方)为下一个50年提供所有公共假期。
如果我能得到这些,我只需将它们批量插入我的sql server假期表并使用它。但是,我无法在任何地方找到这些数据。
有没有人知道Sql server是否支持公共假期或某种算法来解决它们?或者是否有任何人可以在某处官方批量插入。
答案 0 :(得分:13)
我只是通过互联网收集信息,我就可以通过这种简单的方式来计算美国银行假期。
DECLARE @Year char(4)
, @Date datetime
, @Holiday datetime
SET @Year = 2010
---- New Years Day
SET @Date=CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-01-01' )
IF DATENAME( dw, @Date ) = 'Saturday'
SET @Date=@Date-1
ELSE IF DATENAME( dw, @Date ) = 'Sunday'
SET @Date=@Date+1
SELECT @Date [New Years Day], DATENAME( dw, @Date ) [DayOfWeek]
---- Martin L King's Birthday ( 3rd Monday in January )
SET @Date = CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-01-01' )
SET @Holiday = DATEADD( wk, DATEDIFF( wk, 0, dateadd( dd, 18-datepart( day, @Date ), @Date ) ), 0 ) -- 3rd Monday of the Month
SELECT @Holiday [Martin L King's Birthday], DATENAME( dw, @Holiday ) [DayOfWeek]
---- President’s Day ( 3rd Monday in February )
SET @Date = CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-02-01' )
SET @Holiday = DATEADD( wk, DATEDIFF( wk, 0, dateadd( dd, 18-datepart( day, @Date ), @Date ) ), 0 ) -- 3rd Monday of the Month
SELECT @Holiday [President’s Day], DATENAME( dw, @Holiday ) [DayOfWeek]
---- Memorial Day ( Last Monday in May )
SET @Date = CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-05-01' )
SET @Holiday = DATEADD( wk, DATEDIFF( wk, 0, dateadd( dd, 30-datepart( day, @Date ), @Date ) ), 0 ) -- 5th Monday of the Month
SELECT @Holiday [Memorial Day], DATENAME( dw, @Holiday ) [DayOfWeek]
---- Independence Day ( July 4 )
SET @Date=CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-07-04' )
IF DATENAME( dw, @Date ) = 'Saturday'
SET @Date=@Date-1
ELSE IF DATENAME( dw, @Date ) = 'Sunday'
SET @Date=@Date+1
SELECT @Date [Independence Day], DATENAME( dw, @Date ) [DayOfWeek]
---- Labor Day ( 1st Monday in September )
SET @Date = CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-09-01' )
SET @Holiday = DATEADD( wk, DATEDIFF( wk, 0, dateadd( dd, 6-datepart( day, @Date ), @Date ) ), 0 ) -- 1st Monday of the Month
SELECT @Holiday [Labor Day], DATENAME( dw, @Holiday ) [DayOfWeek]
---- Columbus Day ( 2nd Monday in October )
SET @Date = CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-10-01' )
SET @Holiday = DATEADD( wk, DATEDIFF( wk, 0, dateadd( dd, 12-datepart( day, @Date ), @Date ) ), 0 ) -- 2nd Monday of the Month
SELECT @Holiday [Columbus Day], DATENAME( dw, @Holiday ) [DayOfWeek]
---- Veteran’s Day ( November 11 )
SET @Date=CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-11-11' )
IF DATENAME( dw, @Date ) = 'Saturday'
SET @Date=@Date-1
ELSE IF DATENAME( dw, @Date ) = 'Sunday'
SET @Date=@Date+1
SELECT @Date [Veteran’s Day], DATENAME( dw, @Date ) [DayOfWeek]
---- Thanksgiving Day ( 4th Thursday in November )
SET @Date = CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-11-04' )
SET @Holiday = DATEADD( wk, DATEDIFF( wk, 0, dateadd( dd, 22-datepart( day, @Date ), @Date ) ), 0 )+3 -- 4th Thursday of the Month
SELECT @Holiday [Thanksgiving Day], DATENAME( dw, @Holiday ) [DayOfWeek]
---- Christmas Day ( December 25 )
SET @Date=CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-12-25' )
IF DATENAME( dw, @Date ) = 'Saturday'
SET @Date=@Date-1
ELSE IF DATENAME( dw, @Date ) = 'Sunday'
SET @Date=@Date+1
SELECT @Date [Christmas Day], DATENAME( dw, @Date ) [DayOfWeek]
---- New Years Eve Day
SET @Date=CONVERT( datetime, CONVERT(varchar, YEAR( @Year ) )+'-12-31' )
IF DATENAME( dw, @Date ) = 'Saturday'
SET @Date=@Date-1
ELSE IF DATENAME( dw, @Date ) = 'Sunday'
SET @Date=@Date+1
SELECT @Date [New Years Day], DATENAME( dw, @Date ) [DayOfWeek]
答案 1 :(得分:8)
据我所知,没有任何“官方”来源,这确实高度依赖于语言环境。您必须手动管理这些。好消息来源似乎是:
http://en.wikipedia.org/wiki/List_of_holidays_by_country
即使在这些情况下,管理起来也非常棘手。例如,我住在比利时,这个国家的不同地区有不同的假期。例如,与其他劳动力相比,政府工作人员的假期不同,而且这是相同的区域代码。
答案 2 :(得分:6)
公共假期不是非常依赖于语言环境吗?
以编程方式,没有办法计算这个。或者,您需要找到每个区域设置的正式假期列表。即便如此,您也无法获得所需的粒度。
答案 3 :(得分:5)
在我们的应用程序中,我们将其作为用户配置的一部分。用户可以根据自己的需要设置他们认为的公共/银行假期。为了便于使用,可以按照前几年的日期复制它们。这也允许他们设置'定制'公共保留,也许是公司视为假期但不是国家官方的一天......
然而,编程方式完全没有假设。它实际上只是用户维护的日期表。
(这包括英国,因为如上所述,某些假期有所不同,并且不是一成不变的,有时会有特殊的一天假。)
答案 4 :(得分:4)
未来50年很少有公众假期。在一些国家,它们在未来几年内是闻名的,在一些国家则不然。它们也因州甚至城市而异。
答案 5 :(得分:4)
答案 6 :(得分:3)
您可以使用Nager.Date库来计算公共假期。 https://github.com/tinohager/Nager.Date
的NuGet
dim
示例:
PM> install-package Nager.Date
答案 7 :(得分:2)
对于我们在美国的许多人来说,有一个标准的商务假期列表可以确定性地计算。
从Vonpato的代码中汲取灵感,我整理了一个SQL语句,该语句利用Windows函数(over(partition by ..)),SQL Server 2008中的新函数来确定工作日的第N个或最后一个出现一个月之内。
这应该针对“DimDate”运行,这是一个标准的日期维度表,例如在数据仓库中找到的。 http://www.codeproject.com/Articles/647950/Create-and-Populate-Date-Dimension-for-Data-Wareho
SELECT
case
when DayNameOfWeek = 'Saturday' then dateadd(day, -1, FullDate)
when DayNameOfWeek = 'Sunday' then dateadd(day, 1, FullDate)
else FullDate end as 'Holiday Date'
FROM (
select row_number() over (partition by DayNameOfWeek, MonthOfYear, CalendarYear order by FullDate) as WeekdayOrdinal,
count(*) over (partition by DayNameOfWeek, MonthOfYear, CalendarYear ) as MaxOrdinal, *
from DimDate
) D
WHERE
(D.[MonthName] = 'January' and [DayOfMonth] = 1) /* New Years Day */
OR (D.[MonthName] = 'January' and DayNameOfWeek = 'Monday') and WeekdayOrdinal = 3 /* MLK Day */
OR (D.[MonthName] = 'February' and DayNameOfWeek = 'Monday') and WeekdayOrdinal = 3 /* President's Day */
OR (D.[MonthName] = 'May' and DayNameOfWeek = 'Monday') and WeekdayOrdinal = MaxOrdinal /* Memorial Day */
OR (D.[MonthName] = 'September' and DayNameOfWeek = 'Monday') and WeekdayOrdinal = 1 /* Labor Day */
OR (D.[MonthName] = 'October' and DayNameOfWeek = 'Monday') and WeekdayOrdinal = 2 /* Columbus Day */
OR (D.[MonthName] = 'November' and [DayOfMonth] = 11) /* Veteran's Day */
OR (D.[MonthName] = 'November' and DayNameOfWeek = 'Thursday') and WeekdayOrdinal = 4 /* Thanksgiving */
OR (D.[MonthName] = 'December' and [DayOfMonth] = 25 ) /* Christmas */
ORDER BY FullDate
答案 8 :(得分:2)
您需要为此维护一个假期表。为了实现正确的国际化,您甚至需要维持哪些日子是周末日,因为即使这不是普遍的。同样,您可能需要按区域设置维护假期,以便您的程序知道伦敦的用户休息一天,但土耳其的用户不会。
这应该由用户完全配置。如你所知,公司老板的生日可能是一个“标准”休息日。试着在网上找到那个假期。
最后,您不希望存储50年的假期数据。它只会是不准确的,并且可能会降低所有代码的速度。
答案 9 :(得分:2)
答案 10 :(得分:1)
如果它只是英格兰,那么你可以自己解决它们!您需要获得一个可靠的算法来确定复活节,否则我会说你可以在一小时内完成。
但你的意思是英格兰还是英国?因为苏格兰有不同的假期(圣诞节,Hogmanay和圣安德鲁节)和北爱尔兰,威尔士和马恩岛以及海峡群岛也很可能以不同的方式进行交易。
如其他地方所述,一旦你的范围变宽,那就更复杂了。有当地假期,半天,银行开放但没有证券交易所的日子,各种各样的恐怖。
如果你真的无法自己管理假期并且没有可以被赋予责任的用户,那么我建议你回到你的“不能在公共假期运行”的约束并寻找方法可能会被删除...
答案 11 :(得分:1)
对于那些在感恩节11月的最后一个星期四找不到的人,我首先找到该月的最后一天,然后使用WHILE()循环减去一天并检查日期名称,直到日期名称为星期四:
DECLARE @LastThursday DateTime = DATEADD(s,-1,DATEADD(mm,DATEDIFF(m,0,CONVERT(datetime,CONVERT(varchar,YEAR(GETDATE()))+'-11-01'))+1,0))
WHILE DATENAME(weekday,@LastThursday) <> 'Thursday'
BEGIN
SET @LastThursday = DATEADD(day,DATEDIFF(day,0,@LastThursday)-1,0)
END
SELECT @LastThursday
答案 12 :(得分:0)
我觉得这个话题很奇怪。在尝试在MS,PHP或本例SQL语言中查找和编写复杂函数后,我得出的结论是,这是一个毫无意义的练习。我最终的代码包含超过2000个字符,需要几个小时才能正确调试。如果您考虑一下,您只需要写下7号码,表示每个假期的1-365天,以及接下来100年每年的一行。您只需要加载那些年或下一年假期一次。因此请保留7列和100行的表格,并用正确的日期填充它们。你只需要每100年做一次,不到一个小时就可以携带。
答案 13 :(得分:0)
英国的银行假期大多是可计算的,但绝对不是全部可计算的。
英国政府提供了一个API(https://www.gov.uk/bank-holidays.json),可以为您提供此信息。
答案 14 :(得分:0)
在一些国家(即波兰),复活节假期的数量加深。
在这篇文章的最后,您可以找到一个代码来计算食客日期和几个取决于它的假期。
不可移动的假期,即1月1日,圣诞节假期,独立日等,可以存放在桌子的某个地方。
请记住,在多个国家/地区,您的地区/州可以有额外的公共假期,但是应该可以计算您所在国家或地区的所有假期。
在英国,即银行假期有一些规则,您可以在代码中使用。 - 五月的第一个星期一 - 五月的最后一个星期一 - 八月的最后一个星期一等。
请查看此链接了解更多详情 http://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom
如何在SQL中计算复活节日期:
http://www.smart.net/~mmontes/nature1876.html
http://ghiorzi.org/easterda.htm
declare @a int
declare @b int
declare @c int
declare @d int
declare @e int
declare @f int
declare @g int
declare @h int
declare @i int
declare @j int
declare @k int
declare @l int
declare @m int
declare @n int
declare @Year int
declare @Month int
declare @Day int
declare @EasterSunday datetime
declare @EasterMonday datetime
declare @Pentecost datetime
declare @CorpusChristi datetime
SET @Year = 2014
SET @a = @Year%19;
SET @b = @Year/100;
SET @c = @Year%100;
SET @d = @b/4;
SET @e = @b%4;
SET @f = @c/4;
SET @g = @c%4;
SET @h = (@b + 8)/25;
SET @i = (@b - @h + 1)/3;
SET @j = (19*@a + @b - @d - @i + 15) % 30;
SET @k = (32 + 2*@e + 2*@f - @j - @g) % 7;
SET @m = (@a + 11*@j + 22*@k) / 451;
SET @n = @j + @k - 7*@m + 114;
SET @Month = @n/31;
SET @Day = (@n % 31) + 1;
--PRINT @Year
--PRINT @Month
--PRINT @Day
SET @EasterSunday = dateadd(month,((@Year-1900)*12)+@Month-1,@Day-1)
SET @EasterMonday = dateadd(day,1,@EasterSunday)
SET @Pentecost = dateadd(day,49,@EasterSunday)
SET @CorpusChristi = dateadd(day,60,@EasterSunday)
PRINT 'Easter Sunday: ' + CONVERT(VARCHAR, @EasterSunday,120) + ' [' + DATENAME(dw, @EasterSunday) + ']'
PRINT ''
PRINT 'Easter Monday: ' + CONVERT(VARCHAR, @EasterMonday,120) + ' [' + DATENAME(dw, @EasterMonday) + ']'
PRINT ''
PRINT 'Pentecost: ' + CONVERT(VARCHAR, @Pentecost,120) + ' [' + DATENAME(dw, @Pentecost) + ']'
PRINT ''
PRINT 'CorpusChristi: ' + CONVERT(VARCHAR, @CorpusChristi,120) + ' [' + DATENAME(dw, @CorpusChristi) + ']'
PRINT ''
答案 15 :(得分:0)
让我们简化一下:
case
-- New Year's Day
when DATEPART(MM, @DATE) = 1
and DATEPART(DD, @DATE) = 1
and DATEPART(DW, @DATE) in (2,3,4,5,6) then 'Y'
when DATEPART(MM, @DATE) = 12
and DATEPART(DD, @DATE) = 31
and DATEPART(DW, @DATE) = 6 then 'Y'
when DATEPART(MM, @DATE) = 1
and DATEPART(DD, @DATE) = 2
and DATEPART(DW, @DATE) = 2 then 'Y'
-- Memorial Day (last Monday in May)
when DATEPART(MM, @DATE) = 5
and DATEPART(DD, @DATE) between 25 and 31
and DATEPART(DW, @DATE) = 2 then 'Y'
-- Independence Day
when DATEPART(MM, @DATE) = 7
and DATEPART(DD, @DATE) = 4
and DATEPART(DW, @DATE) in (2,3,4,5,6) then 'Y'
when DATEPART(MM, @DATE) = 7
and DATEPART(DD, @DATE) = 3
and DATEPART(DW, @DATE) = 6 then 'Y'
when DATEPART(MM, @DATE) = 7
and DATEPART(DD, @DATE) = 5
and DATEPART(DW, @DATE) = 2 then 'Y'
-- Labor Day (first Monday in September)
when DATEPART(MM, @DATE) = 9
and DATEPART(DD, @DATE) between 1 and 7
and DATEPART(DW, @DATE) = 2 then 'Y'
-- Thanksgiving Day (fourth Thursday in November)
when DATEPART(MM, @DATE) = 11
and DATEPART(DD, @DATE) between 22 and 28
and DATEPART(DW, @DATE) = 5 then 'Y'
-- Black Friday (day after Thanksgiving)
when DATEPART(MM, @DATE) = 11
and DATEPART(DD, @DATE) between 23 and 29
and DATEPART(DW, @DATE) = 6 then 'Y'
-- Christmas Day
when DATEPART(MM, @DATE) = 12
and DATEPART(DD, @DATE) = 25
and DATEPART(DW, @DATE) in (2,3,4,5,6) then 'Y'
when DATEPART(MM, @DATE) = 12
and DATEPART(DD, @DATE) = 24
and DATEPART(DW, @DATE) = 6 then 'Y'
when DATEPART(MM, @DATE) = 12
and DATEPART(DD, @DATE) = 26
and DATEPART(DW, @DATE) = 2 then 'Y'
else 'N' end
答案 16 :(得分:0)
我尝试了“答案”,并花了一些时间对其进行大量修改以使其更具可读性。确实不需要那些“ -DATEPART”选项,因为我们正好在之前设置日期。它工作得很好,但是在2020年MLK日遇到了问题,所以我对此表示怀疑。
此外,我不喜欢它很难阅读的事实。我发现了这一点,并且更容易实现。它的工作原理与日期维度表非常相似,并且在我尝试使用的3年中都经过了准确的测试。
https://www.codeproject.com/Tips/1168430/US-Federal-Holidays-SQL
答案 17 :(得分:0)
金融机构将订阅服务,定期更新各种地区的银行日历。
请注意,银行假日和普通假期之间通常存在差异。美国的一个例子就是通过独立日,联邦政府在7月3日承认了这个假期,但纽约联邦储备银行是开放的。
答案 18 :(得分:0)
此算法可能会减少观察基督教假期的国家/地区的手动配置量。转换为C#应该是微不足道的:
http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm
答案 19 :(得分:0)
如果有帮助我有一个文本文件,其中列出了为所有主要和次要金融中心定义的计算银行假期的规则。通常的方式是商业中心,如伦敦,纽约法兰克福等,而不是按国家。作为一个例子,这里是伦敦和其他一些人的规则和解释。如果有人想要全部让我知道。这个地段应该最早在1990年到2030年之间运作。显然,在将这些节目放在一起之后,它将不会有任何新的假期(2006年我认为)。
/*
* This file describes holiday calendars in the following way:
* 1. The "n"th "dow" in the month "m", means the 3rd Wednesday in August = "ALWAYS,3,WED,AUG"
* 2. The last etc "dow" in month "m", e.g. the last Monday in June = "LAST,MON,JUN"
* 3. A set date which if on a Sat or Sun is taken on the Monday, eg 13th Aug. = "FWDFROM,13,AUG"
* 4. A set date which if on a Sat is taken on Fri, if Sun on the Mon = "CLOSESTTO,13,AUG"
* 5. A set date which, if on a Sat is unchanged, but if a Sun is taken on the Mon = "FWDFROMSUN,13,AUG"
* 6. A set date which is unchanged if it happens to be on a weekend = "REMAINS,13,AUG"
* 7. The first day on or after day "x" in month "m" e.g. 1st Monday on or after 16th Jan = "FIRSTAFTER,16,MON,JAN"
* 8. A holiday which is a set number of days relative to Easter Sunday, e.g Easter Monday = "EASTER,1"
* 9. A holiday on one specified date only. e.g. 13th Aug 1997 = "ONEOFF,13,AUG,1997"
* 10.A specific date which has been added but is not a holiday and must be removed. = "REMOVE,13,AUG,1997"
* Note REMOVE only works on a date which is already in the calendar: you cannot remove a date which is yet to be added.
* If there is any text after the definition of the holiday it will appear in the date calendar description,
* e.g. you can have "FWDFROM,25,DEC,Christmas Day", if you wish.
*/
LON: HolidayCalendar {
Config: String {
FWDFROM,1,JAN,New Year's Day;
EASTER,-2,Good Friday;
EASTER,1,Easter Monday;
ALWAYS,1,MON,MAY,Early May Bank Holiday;
LAST,MON,MAY,Spring Bank Holiday;
REMOVE,27,MAY,2002,Spring Bank Holiday;
ONEOFF,3,JUN,2002,Spring Bank Holiday;
ONEOFF,4,JUN,2002,Spring Bank Holiday;
LAST,MON,AUG,Summer Bank Holiday;
FWDFROM,25,DEC,Christmas;
FWDFROM,26,DEC,Boxing Day;
ONEOFF,31,DEC,1999,Millenium;
}
EndDate: 31-Dec-2030;
Name: London;
StartDate: 01-Jan-1990;
Weekend: SAT,SUN,;
}
HKG: HolidayCalendar {
Config: String {
FWDFROM,1,JAN,New Year's Day;
ONEOFF,16,FEB,1999,Chinese New Year;
ONEOFF,17,FEB,1999,Chinese New Year;
ONEOFF,18,FEB,1999,Chinese New Year;
FWDFROM,5,FEB,2000,Chinese New Year;
FWDFROM,6,FEB,2000,Chinese New Year;
FWDFROM,7,FEB,2000,Chinese New Year;
CLOSESTTO,5,APR,Ching Ming;
EASTER,-2,Good Friday;
EASTER,1,Easter Monday;
FWDFROM,1,MAY,Labour Day;
ONEOFF,18,JUN,1999,Dragon Boat Festival;
FWDFROM,1,JUL,SAR Establishment Day;
FWDFROM,1,OCT,National Day;
FWDFROM,2,OCT,National Day;
ONEOFF,25,SEP,1999,Mid Autumn Festival;
ONEOFF,17,OCT,1999,Chung Yeung;
FWDFROM,25,DEC,Christmas;
FWDFROM,26,DEC,Boxing Day;
ONEOFF,4,MAY,1998,May bank holiday;
ONEOFF,25,MAY,1998,May bank holiday;
ONEOFF,3,MAY,1999,May bank holiday;
ONEOFF,31,MAY,1999,May bank holiday;
ONEOFF,1,JUL,1997;
ONEOFF,2,JUL,1997;
}
EndDate: 31-Dec-2030;
Name: Hong Kong;
StartDate: 01-Jan-1990;
Weekend: SAT,SUN,;
}
MIL: HolidayCalendar {
Config: String {
FWDFROM,1,JAN,New Year's Day;
REMAINS,6,JAN,Epiphany;
REMAINS,25,APR,Liberation Day;
REMAINS,1,MAY,May Day;
REMAINS,15,AUG,Assumption;
REMAINS,1,NOV,All Saint's;
REMAINS,8,DEC,Immaculate Conception;
EASTER,1,Easter Monday;
FWDFROM,25,DEC,Christmas;
FWDFROM,26,DEC,Boxing Day;
}
EndDate: 31-Dec-2030;
Name: Milan;
StartDate: 01-Jan-1990;
Weekend: SAT,SUN,;
}
FFT: HolidayCalendar {
Config: String {
REMAINS,1,JAN,New Year's Day;
EASTER,-2,Good Friday;
EASTER,1,Easter Monday;
REMAINS,1,MAY,Labour Day;
EASTER,39,Ascension Day;
EASTER,50,Whit Monday;
EASTER,60,Corpus Christi;
REMAINS,3,OCT,Day of German Unity;
REMAINS,24,DEC,Christmas Eve;
REMAINS,25,DEC,Christmas Day;
REMAINS,26,DEC,Boxing Day;
}
EndDate: 31-Dec-2030;
Name: Frankfurt;
StartDate: 01-Jan-1990;
Weekend: SAT,SUN,;
}
ZUR: HolidayCalendar {
Config: String {
REMAINS,1,JAN,New Year's Day;
REMAINS,2,JAN,New Year's Holiday;
EASTER,-2,Good Friday;
EASTER,1,Easter Monday;
EASTER,39,Ascension Day;
EASTER,50,Whit Monday;
REMAINS,1,AUG,August Bank Holiday;
REMAINS,1,MAY, LABOUR DAY;
REMAINS,25,DEC,Christmas;
REMAINS,26,DEC,Boxing Day;
}
EndDate: 31-Dec-2030;
Name: Zurich;
StartDate: 01-Jan-1990;
Weekend: SAT,SUN,;
}
NYK: HolidayCalendar {
Config: String {
REMAINS,1,JAN,New Year's Day;
ALWAYS,3,MON,JAN,Martin Luther King;
ALWAYS,3,MON,FEB,President's Day;
LAST,MON,MAY,Memorial Day;
CLOSESTTO,4,JUL,Independence Day;
ALWAYS,1,MON,SEP,Labor Day;
ALWAYS,2,MON,OCT,Columbus Day;
REMAINS,11,NOV,Veteran's Day;
ALWAYS,4,THU,NOV,Thanksgiving;
FWDFROMSUN,25,DEC,Christmas Day;
ONEOFF,12,NOV,2001,Veteran's Day;
}
EndDate: 31-Dec-2030;
Name: New York;
StartDate: 01-Jan-1990;
Weekend: SAT,SUN,;
}
答案 20 :(得分:0)
为全球公众假期找到了另一项服务,据称日历出版商使用该服务:
答案 21 :(得分:0)
google calendar public hollydays 也许您可以使用Google日历网络服务来检索您的国家/地区数据。
答案 22 :(得分:0)
要添加其他人已经说过的话,将自己放在桌子中是唯一真正的方法。一个典型的例子是女王的金禧年额外的银行假期。这只是提前几年宣布的,而且你没有办法提前五十年。
因此,存在许多商业服务以可靠的方式提供这些数据。一个是GoodBusinessDay.com,但我没有经验。
答案 23 :(得分:0)
除了允许用户配置假期的哪些日期外,如果您允许用户选择要导入甚至订阅的日历,那将会很不错。 iCalShare有一个很好的清单。然而,对于一个仅仅很好的功能来说,这可能太过分了。