Language: C#
View on GitHub to download or comment.
See the Client API Examples Introduction for additional information and prerequisites.
This script demonstrates how to retrieve a Holiday Set and get a list of the holiday dates that it defines
void Main()
{
//if the adTempus server is on a different computer, replace "." with the name
using (var session = Scheduler.Connect(".", LoginAuthenticationType.Windows, "", ""))
{
using (var context = session.NewDataContext())
{
//retrieve the Holiday Set
var holidays=context.GetHolidaySet("Standard U.S. Holidays");
if(holidays==null)
return;
var startDate=new DateTime(2021,1,1);
var endDate=startDate.AddYears(1);
var matchingDates=holidays.GetMatchingDates(startDate, endDate);
foreach(var item in matchingDates)
{
Console.WriteLine($"{item.MatchingDate} ({item.RuleName})");
}
}
}
}
View on GitHub to comment.