How to Programmatically Update Custom Calendar Date Definitions


The calendar can be updated programmatically using the AddHolidays sample job which is located in the Samples folder.  The AddHolidays sample job source will need to be customized for your holiday calendar.  

In JAMS V6, each calendar date update portion of the script looks like the following:

$newdate = ConvertTo-Date "

    1st day of year" -today $baseDate 

$holiday = New-Item JAMSHost:\Dates\

    Holidays\ -value ("{0:yyyy-MM-dd}" -f $newdate) -force 

$formattedDate= "{0:yyyy-MM-dd}" -f $newdate 
$holiday = Get-Item JAMSHost:\Dates\
$holiday.Description = "

    New Years Day" 
$holiday.Workday = $

All of the items marked in Red will need to be customized for your application.  The first line contains the language specification for the day you want to mark off.  The second line references the Date Definition that you are updating.  The 4th line is the same reference to the date definition.  The 5th line is a short description of the day that is being added.  The 6th line is setting whether the date definition is a workday or not. The rest is powershell language used to perform the update through JAMS.

Users can then run the AddHolidays job at the end of every year and it will populate the days for next year's calendar.

Have more questions? Submit a request


  • Avatar
    Kevin Dunn

    Once created, is this a calendar that all jobs are required to abide by? Can specific jobs be forced to recognize holidays while other jobs are scheduled as usual?

  • Avatar
    Daniel St Jean

    Hi Kevin,
    No, creating a calendar definition does not mean it applies to all jobs automatically, but it can be used in the Schedule Date or the Except For fields in a job definition.

  • Avatar
    Patel, Jayesh

    Is there a version 7 example of Adding Calendar, Date Type and Holiday?

  • Avatar
    Dan Fowle