Calendar.MakeNightShiftCalendar

Calendar.MakeNightShiftCalendar method

Makes a given Calendar as Night Shift Calendar.

public static Calendar MakeNightShiftCalendar(Calendar calendar)
ParameterTypeDescription
calendarCalendarCalendar to make Night Shift Calendar.

Return Value

Night Shift Calendar.

Examples

Shows how to create a night shift calendar.

Project project = new Project();
var calendar = project.Calendars.Add("New calendar");
Calendar.MakeNightShiftCalendar(calendar);

var workingHours = calendar.GetWorkingTimes(new DateTime(2020, 4, 8));

// show working hours
foreach (var wh in workingHours)
{
    Console.WriteLine("From: " + wh.From);
    Console.WriteLine("To: " + wh.To);
}

Shows how to transform a calendar into a night shift calendar.

var project = new Project();

var calendar = project.Calendars.Add("Night Shift");
calendar = Calendar.MakeNightShiftCalendar(calendar);

var workingHours = calendar.GetWorkingTimes(new DateTime(2020, 4, 8));

// show working hours
foreach (var wh in workingHours)
{
    Console.WriteLine("From: " + wh.From);
    Console.WriteLine("To: " + wh.To);
}

See Also