[fusion_builder_container type=”flex” hundred_percent=”no” hundred_percent_height=”no” min_height_medium=”” min_height_small=”” min_height=”” hundred_percent_height_scroll=”no” align_content=”stretch” flex_align_items=”flex-start” flex_justify_content=”flex-start” flex_column_spacing=”” hundred_percent_height_center_content=”yes” equal_height_columns=”no” container_tag=”div” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” status=”published” publish_date=”” class=”” id=”” spacing_medium=”” margin_top_medium=”” margin_bottom_medium=”” spacing_small=”” margin_top_small=”” margin_bottom_small=”” margin_top=”” margin_bottom=”” padding_dimensions_medium=”” padding_top_medium=”” padding_right_medium=”” padding_bottom_medium=”” padding_left_medium=”” padding_dimensions_small=”” padding_top_small=”” padding_right_small=”” padding_bottom_small=”” padding_left_small=”” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” link_color=”” link_hover_color=”” border_sizes=”” border_sizes_top=”” border_sizes_right=”” border_sizes_bottom=”” border_sizes_left=”” border_color=”” border_style=”solid” box_shadow=”no” box_shadow_vertical=”” box_shadow_horizontal=”” box_shadow_blur=”0″ box_shadow_spread=”0″ box_shadow_color=”” box_shadow_style=”” z_index=”” overflow=”” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ background_color=”” background_image=”” skip_lazy_load=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” enable_mobile=”no” parallax_speed=”0.3″ background_blend_mode=”none” video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” video_preview_image=”” render_logics=”” absolute=”off” absolute_devices=”small,medium,large” sticky=”off” sticky_devices=”small-visibility,medium-visibility,large-visibility” sticky_background_color=”” sticky_height=”” sticky_offset=”” sticky_transition_offset=”0″ scroll_offset=”0″ animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” filter_hue=”0″ filter_saturation=”100″ filter_brightness=”100″ filter_contrast=”100″ filter_invert=”0″ filter_sepia=”0″ filter_opacity=”100″ filter_blur=”0″ filter_hue_hover=”0″ filter_saturation_hover=”100″ filter_brightness_hover=”100″ filter_contrast_hover=”100″ filter_invert_hover=”0″ filter_sepia_hover=”0″ filter_opacity_hover=”100″ filter_blur_hover=”0″ admin_toggled=”no” admin_label=”P1″][fusion_builder_row][fusion_builder_column type=”1_6″ layout=”1_6″ align_self=”auto” content_layout=”column” align_content=”flex-start” valign_content=”flex-start” content_wrap=”wrap” spacing=”” center_content=”no” link=”” target=”_self” link_description=”” min_height=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” type_medium=”” type_small=”” order_medium=”0″ order_small=”0″ dimension_spacing_medium=”” dimension_spacing_small=”” dimension_spacing=”” dimension_margin_medium=”” dimension_margin_small=”” margin_top=”” margin_bottom=”” padding_medium=”” padding_small=”” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” hover_type=”none” border_sizes=”” border_color=”” border_style=”solid” border_radius=”” box_shadow=”no” dimension_box_shadow=”” box_shadow_blur=”0″ box_shadow_spread=”0″ box_shadow_color=”” box_shadow_style=”” overflow=”” background_type=”single” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ background_color=”” background_image=”” background_image_id=”” background_position=”left top” background_repeat=”no-repeat” background_blend_mode=”none” render_logics=”” filter_type=”regular” filter_hue=”0″ filter_saturation=”100″ filter_brightness=”100″ filter_contrast=”100″ filter_invert=”0″ filter_sepia=”0″ filter_opacity=”100″ filter_blur=”0″ filter_hue_hover=”0″ filter_saturation_hover=”100″ filter_brightness_hover=”100″ filter_contrast_hover=”100″ filter_invert_hover=”0″ filter_sepia_hover=”0″ filter_opacity_hover=”100″ filter_blur_hover=”0″ animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” last=”false” border_position=”all” first=”true” spacing_right=””][/fusion_builder_column][fusion_builder_column type=”2_3″ layout=”1_3″ align_self=”auto” content_layout=”column” align_content=”flex-start” valign_content=”flex-start” content_wrap=”wrap” spacing=”” center_content=”no” link=”” target=”_self” link_description=”” min_height=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” type_medium=”” type_small=”” order_medium=”0″ order_small=”0″ dimension_spacing_medium=”” dimension_spacing_small=”” dimension_spacing=”” dimension_margin_medium=”” dimension_margin_small=”” margin_top=”” margin_bottom=”” padding_medium=”” padding_small=”” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” hover_type=”none” border_sizes=”” border_color=”” border_style=”solid” border_radius=”” box_shadow=”no” dimension_box_shadow=”” box_shadow_blur=”0″ box_shadow_spread=”0″ box_shadow_color=”” box_shadow_style=”” overflow=”” background_type=”single” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ background_color=”” background_image=”” background_image_id=”” background_position=”left top” background_repeat=”no-repeat” background_blend_mode=”none” render_logics=”” filter_type=”regular” filter_hue=”0″ filter_saturation=”100″ filter_brightness=”100″ filter_contrast=”100″ filter_invert=”0″ filter_sepia=”0″ filter_opacity=”100″ filter_blur=”0″ filter_hue_hover=”0″ filter_saturation_hover=”100″ filter_brightness_hover=”100″ filter_contrast_hover=”100″ filter_invert_hover=”0″ filter_sepia_hover=”0″ filter_opacity_hover=”100″ filter_blur_hover=”0″ animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” last=”false” border_position=”all” first=”false” spacing_right=””][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”none” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

Each new year brings new challenges, but one challenge that come back year after year is adding your holidays to your calendar, or worse calendars.

Traditionally this has been a manual tedious process, especially if you have multiple calendars, and Easter is its own special challenge.

From version 9.3 though it has been possible to use WAPL to automate this, all the commands you need have been there since the beginning. The trick is knowing how to string them together to make it all work each year without intervention.

The process is broadly split into 2 chunks, calculating the holidays and then applying the holidays to your calendar(s).

[/fusion_text][fusion_title title_type=”text” marquee_direction=”left” marquee_speed=”15000″ rotation_effect=”bounceIn” display_time=”1200″ highlight_effect=”circle” loop_animation=”off” highlight_width=”9″ highlight_top_margin=”0″ before_text=”” rotation_text=”” highlight_text=”” after_text=”” title_link=”off” link_url=”” link_target=”_self” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” content_align_medium=”” content_align_small=”” content_align=”left” size=”2″ animated_font_size=”” fusion_font_family_title_font=”” fusion_font_variant_title_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” hue=”” saturation=”” lightness=”” alpha=”” animated_text_color=”” text_shadow=”no” text_shadow_vertical=”” text_shadow_horizontal=”” text_shadow_blur=”0″ text_shadow_color=”” text_stroke=”no” text_stroke_size=”1″ text_stroke_color=”” text_overflow=”none” margin_top_medium=”” margin_right_medium=”” margin_bottom_medium=”” margin_left_medium=”” margin_top_small=”” margin_right_small=”” margin_bottom_small=”” margin_left_small=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” margin_top_mobile=”” margin_bottom_mobile=”” gradient_font=”no” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ highlight_color=”” style_type=”none” sep_color=”” link_color=”” link_hover_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=””]

Calculating the holidays

[/fusion_title][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”none” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

To calculate the holidays the holidays the VARDATE command lets you create a variable for a date based on some rules. You can pick particular dates with a month, or days within a month to cover most holidays.

Let’s start with a simple one, the Fourth of July. The VARDATE rule for that is quite simple –

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSREFURSBQSF9JTkRFUEVOREVOQ0UgT05MWSg0KSBNT05USChKVUwpCgpFeGFtcGxlOiBTZXR0aW5nIHRoZSBGb3VydGggb2YgSnVseQ==[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”none” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

This statement creates a variable call PH_INDEPENDENCE and sets it to the 4th day of July this year, but really you want to be able to calculate your holidays in advance, so you could add YEAR as an extra keyword to the VARDATE statement. Alternatively you can set the default YEAR for your job, which avoids you having to set the YEAR on every holiday you calculate. Not only that you can specify the year relative to this year.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSREFURSA9IFlFQVIoKzEpClZBUkRBVEUgUEhfSU5ERVBFTkRFTkNFIE9OTFkoNCkgTU9OVEgoSlVMKQoKRXhhbXBsZTogU2V0dGluZyB0aGUgRm91cnRoIG9mIEp1bHkgZm9yIG5leHQgeWVhcg==[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

VARDATE = without a variable name before the = sign is what allows you to set defaults for variable calculation.

[/fusion_text][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

So that covers setting holidays for a specific date, but what if that date falls on a weekend? Sometimes you might want to bring the move the date to the preceding Friday, other times you might want to move it to the following Monday. Sometimes you might want to move it to the closest non-weekend date, other times you may leave it where it is.

This is where the RULE keyword comes in. This is a little bit like the FREEDAY rule, but explicitly for Saturdays and Sundays. It’s important to understand this as we cannot use FREEDAYs as we are creating calendars here. The values for RULE are –

[/fusion_text][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

  • BEFORE – If the date lands on a weekend move it to the preceding FRIDAY
  • AFTER – If the date lands on a weekend move it to the following MONDAY
  • ON – If the date lands on a weekend leave it where it is. This is the default.
  • NEAREST – If the date lands on a SATURDAY move it to the preceding FRIDAY. If it lands on a SUNDAY move it to the following MONDAY

[/fusion_text][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

Again you can code this keyword on each VARDATE statement, or you can set the default in the same way you set the YEAR. If most holidays follow the same RULE you can set the default and set it specifically only on holidays that don’t follow the default.

If your holidays move to the nearest day it would look something like this.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSREFURSA9IFlFQVIoKzEpIFJVTEUoTkVBUkVTVCkKVkFSREFURSBQSF9JTkRFUEVOREVOQ0UgT05MWSg0KSBNT05USChKVUwpCgpFeGFtcGxlOiBTZXR0aW5nIHRoZSBGb3VydGggb2YgSnVseSBmb3IgbmV4dCB5ZWFyLCBtb3Zpbmcgd2Vla2VuZHMgdG8gdGhlIG5lYXJlc3Qgd2VlayBkYXk=[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

We’ve covered specific dates in a month, but what about specific days within a month. For example Martin Luther King day is the third Monday of January. All we do is add the DAY keyword for a specific day, and the ONLY value then counts that day type only, rather than every day that month.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSREFURSBQSF9NQVJUSU5fTFVUSEVSX0tJTkcgT05MWSgzKSBEQVkoTU9OKSBNT05USChKQU4pCgpFeGFtcGxlOiBTZXR0aW5nIE1hcnRpbiBMdXRoZXIgS2luZyBkYXksIDNyZCBNb25kYXkgb2YgSmFudWFyeQ==[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

Similarly we can count from the end of the month as well. Use LAST instead of ONLY, so LAST(1) DAY(MON) MONTH(AUG) would give you the last MONDAY in August.

So far so good, but what about consecutive holidays, where 2 days are expected to be together in the calendar. In the UK Christmas day is the 25th of December, Boxing Day is the 26th. Except when one or both of them falls on the weekend. So if the 25th of December falls on a Sunday, it would automatically shift to the 26th, but then this overlaps with Boxing Day, which in reality would need to move to the 27th, but if calculated by ONLY(26) MONTH(DEC) if it lands on a MONDAY it will not move.

We handle this by calculating Christmas Day the normal way and use the Christmas Day variable to set the base for calculating Boxing Day. Note that because we are using the value of the Christmas Day variable we need to turn on variable substitution with the VARSUB statement.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSU1VCIFNDQU4oISkKVkFSREFURSA9IFJVTEUoQUZURVIpClZBUkRBVEUgUEhfQ0hSSVNUTUFTIE9OTFkoMjUpIE1PTlRIKERFQykKVkFSREFURSBQSF9CT1hJTkdfREFZIEJBU0UoIVBIX0NIUklTVE1BUykgT0ZGU0VUKDEpCgpFeGFtcGxlOiBTZXR0aW5nIHR3byBjb25zZWN1dGl2ZSBtb3ZlYWJsZSBob2xpZGF5cw==[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

The BASE keyword sets the baseline, and the OFFSET moves it onwards a number of days. So whatever date Christmas Day might get moved to, Boxing Day is calculated initially as the day after, and if that lands on a weekend it too will be moved onwards.

Then the BIG question is what about Easter, which moves astronomically each year. WAPL has a special base date called EASTER that returns the date of Easter Sunday for each year. Which can then be offset to get either Good Friday or Easter Monday.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSU1VCIFNDQU4oISkKVkFSREFURSBQSF9HT09EX0ZSSURBWSBCQVNFKEVBU1RFUikgT0ZGU0VUKC0yKQpWQVJEQVRFIFBIX0VBU1RFUl9NT05EQVkgQkFTRSghUEhfR09PRF9GUklEQVkpIE9GRlNFVCgzKQoKRXhhbXBsZTogSGFuZGxpbmcgRWFzdGVy[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

We could have calculated both of these dates using BASE(EASTER) but adding 3 days to Good Friday is a much simpler calculation than calculating Easter Sunday twice, so uses less CPU cycles.

From what we have seen so far you can probably calculate all of your holidays. In the SEQQWAPL library there are some sample members beginning with EQQDR that have sets of date rules for Italy, Netherlands, UK and the US.

[/fusion_text][fusion_title title_type=”text” marquee_direction=”left” marquee_speed=”15000″ rotation_effect=”bounceIn” display_time=”1200″ highlight_effect=”circle” loop_animation=”off” highlight_width=”9″ highlight_top_margin=”0″ before_text=”” rotation_text=”” highlight_text=”” after_text=”” title_link=”off” link_url=”” link_target=”_self” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” content_align_medium=”” content_align_small=”” content_align=”left” size=”2″ animated_font_size=”” fusion_font_family_title_font=”” fusion_font_variant_title_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” hue=”” saturation=”” lightness=”” alpha=”” animated_text_color=”” text_shadow=”no” text_shadow_vertical=”” text_shadow_horizontal=”” text_shadow_blur=”0″ text_shadow_color=”” text_stroke=”no” text_stroke_size=”1″ text_stroke_color=”” text_overflow=”none” margin_top_medium=”” margin_right_medium=”” margin_bottom_medium=”” margin_left_medium=”” margin_top_small=”” margin_right_small=”” margin_bottom_small=”” margin_left_small=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” margin_top_mobile=”” margin_bottom_mobile=”” gradient_font=”no” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ highlight_color=”” style_type=”none” sep_color=”” link_color=”” link_hover_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=””]

Updating the calendar

[/fusion_title][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

Now we have a set of variables, how do we turn that into calendar updates? The trick is to use the CLSTART batch loader statement with some CLDATE keywords to set the specific dates to be free days for each of the variables.

This needs to use DBMODE(UPDATE) so it adds the new dates to the calendar without losing any existing entries. Also for clarity you might want to also use the CLDAY keywords to make it clear which days of the week are work or free days. This in turn makes it easy to use the same technique to add brand new calendars, because whilst CLDAY is optional for existing calendars, for a new calendar you MUST specify the days of the week.

So the update part of the process would look like this.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]T1BUSU9OUyBEQk1PREUoVVBEQVRFKQpWQVJTVUIgU0NBTighKQpDTFNUQVJUIENBTEVOREFSKENBTFVTKSBERVNDUihVUyBob2xpZGF5cykKQ0xEQVkgREFZKE1PTkRBWSkgU1RBVFVTKFcpIERFU0NSKE1vbmRheSkKQ0xEQVkgREFZKFRVRVNEQVkpIFNUQVRVUyhXKSBERVNDUihUdWVzZGF5KQpDTERBWSBEQVkoV0VETkVTREFZKSBTVEFUVVMoVykgREVTQ1IoV2VkbmVzZGF5KQpDTERBWSBEQVkoVEhVUlNEQVkpIFNUQVRVUyhXKSBERVNDUihUaHVyc2RheSkKQ0xEQVkgREFZKEZSSURBWSkgU1RBVFVTKFcpIERFU0NSKEZyaWRheSkKQ0xEQVkgREFZKFNBVFVSREFZKSBTVEFUVVMoRikgREVTQ1IoU2F0dXJkYXkpCkNMREFZIERBWShTVU5EQVkpIFNUQVRVUyhGKSBERVNDUihTdW5kYXkpCkNMREFURSBEQVRFKCFQSF9ORVdfWUVBUikgU1RBVFVTKEYpCkRFU0NSKE5ldyB5ZWFycyBkYXkpCkNMREFURSBEQVRFKCFQSF9NQVJUSU5fTFVUSEVSX0tJTkcpIFNUQVRVUyhGKQpERVNDUihNYXJ0aW4gTHV0aGVyIEtpbmcgRGF5KQpDTERBVEUgREFURSghUEhfVEhBTktTR0lWSU5HKSBTVEFUVVMoRikKREVTQ1IoVGhhbmtzZ2l2aW5nKQpDTERBVEUgREFURSghUEhfQkxBQ0tGUklEQVkpIFNUQVRVUyhGKQpERVNDUihUdXJrZXkgY29tYSkKQ0xEQVRFIERBVEUoIVBIX0NIUklTVE1BUykgU1RBVFVTKEYpCkRFU0NSKENocmlzdG1hcyBEYXkpCkNMREFURSBEQVRFKCFQSF9KVU5FVEVFTlRIKSBTVEFUVVMoRikKREVTQ1IoSnVuZXRlZW50aCkKCkV4YW1wbGU6IFVwZGF0aW5nIHRoZSBjYWxlbmRhcg==[/fusion_syntax_highlighter][fusion_title title_type=”text” marquee_direction=”left” marquee_speed=”15000″ rotation_effect=”bounceIn” display_time=”1200″ highlight_effect=”circle” loop_animation=”off” highlight_width=”9″ highlight_top_margin=”0″ before_text=”” rotation_text=”” highlight_text=”” after_text=”” title_link=”off” link_url=”” link_target=”_self” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” content_align_medium=”” content_align_small=”” content_align=”left” size=”2″ animated_font_size=”” fusion_font_family_title_font=”” fusion_font_variant_title_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” hue=”” saturation=”” lightness=”” alpha=”” animated_text_color=”” text_shadow=”no” text_shadow_vertical=”” text_shadow_horizontal=”” text_shadow_blur=”0″ text_shadow_color=”” text_stroke=”no” text_stroke_size=”1″ text_stroke_color=”” text_overflow=”none” margin_top_medium=”” margin_right_medium=”” margin_bottom_medium=”” margin_left_medium=”” margin_top_small=”” margin_right_small=”” margin_bottom_small=”” margin_left_small=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” margin_top_mobile=”” margin_bottom_mobile=”” gradient_font=”no” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ highlight_color=”” style_type=”none” sep_color=”” link_color=”” link_hover_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=””]

Handling more complex scenarios

[/fusion_title][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

Your eventual job will be formed of a section to calculate the variables, followed by a section for each calendar you want to apply holiday dates to.

You can create variables at the top of your job for all of the possible public holidays, and then it is up to you which variables you use in a calendar by calendar basis. Some calendars may only use national holidays, others my use both national and regional holidays. You build each calendar specific to your requirements.

Many companies also have a concept of “Bridge days” which is if a holiday falls on a Tuesday, then it will also make the Monday a freeday. Similarly if it falls on a Thursday it will make the Friday a freeday. This can also be handled by a simple bit of code like this to calculate the Bridge day.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]VkFSU1VCIFNDQU4oISkKVkFSREFURSBQSF9JTkRFUEVOREVOQ0UgT05MWSg0KSBNT05USChKVUwpClZBUkRBVEUgUEhfQlJJREdFIEJBU0UoIVBIX0lOREVQRU5ERU5DRSkKSUYgQCgiVFVFIiwhUEhfSU5ERVBFTkRFTkNFKSBUSEVOClZBUkRBVEUgUEhfQlJJREdFIEJBU0UoIVBIX0lOREVQRU5ERU5DRSkgT0ZGU0VUKC0xKQpJRiBAKCJUSFUiLCFQSF9JTkRFUEVOREVOQ0UpIFRIRU4KVkFSREFURSBQSF9CUklER0UgQkFTRSghUEhfSU5ERVBFTkRFTkNFKSBPRkZTRVQoKzEpCiAgCkV4YW1wbGU6IENhbGN1bGF0aW5nIGEgYnJpZGdlIGRheQ==[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

We do this by having 2 variables, one for the actual holiday, another for the bridge day. The first thing we do is set the Bridge day to the actual holiday.

Then we can use the @ function to check of the holiday falls on a Tuesday, set the Bridge variable to the holiday minus 1 day. If it falls on a Thursday set the bridge variable to the holiday plus 1 day.

Then when applying it to the calendar code a pair of CLDATE keywords like this.

[/fusion_text][fusion_syntax_highlighter theme=”” language=”txt” line_numbers=”no” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”#000000″ hue=”” saturation=”” lightness=”” alpha=”” border_style=”solid” background_color=”rgba(0,0,0,0.12)” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=””]Q0xEQVRFIERBVEUoIVBIX0JSSURHRSkgU1RBVFVTKEYpCkRFU0NSKEluZGVwZW5kZW5jZSBkYXkgYnJpZGdlIGRheSkKQ0xEQVRFIERBVEUoIVBIX0lOREVQRU5ERU5DRSkgU1RBVFVTKEYpCkRFU0NSKEluZGVwZW5kZW5jZSBkYXkpCgpFeGFtcGxlOiBBcHBseWluZyBhIGJyaWRnZSBkYXk=[/fusion_syntax_highlighter][fusion_text columns=”” column_min_width=”” column_spacing=”” rule_style=”” rule_size=”” rule_color=”” hue=”” saturation=”” lightness=”” alpha=”” content_alignment_medium=”” content_alignment_small=”” content_alignment=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” margin_top=”” margin_right=”” margin_bottom=”” margin_left=”” fusion_font_family_text_font=”” fusion_font_variant_text_font=”” font_size=”” line_height=”” letter_spacing=”” text_transform=”” text_color=”” animation_type=”” animation_direction=”left” animation_color=”” animation_speed=”0.3″ animation_delay=”0″ animation_offset=”” logics=””]

You should ALWAYS apply the bridge day ahead of the actual holiday. This is because if there is no bridge day the date of the bridge variable will be the same as the holiday. In that case the bridge day will be overwritten by the following actual holiday.

There are many other things you can do with this kind of technique, for example using the PRSTART and PRDATE batch loader to do similar things to automatically build periods.

Getting this tedious job automated each year should lead to a happier new year.

[/fusion_text][/fusion_builder_column][fusion_builder_column type=”1_6″ layout=”1_6″ align_self=”auto” content_layout=”column” align_content=”flex-start” valign_content=”flex-start” content_wrap=”wrap” spacing=”” center_content=”no” link=”” target=”_self” link_description=”” min_height=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” sticky_display=”normal,sticky” class=”” id=”” type_medium=”” type_small=”” order_medium=”0″ order_small=”0″ dimension_spacing_medium=”” dimension_spacing_small=”” dimension_spacing=”” dimension_margin_medium=”” dimension_margin_small=”” margin_top=”” margin_bottom=”” padding_medium=”” padding_small=”” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” hover_type=”none” border_sizes=”” border_color=”” border_style=”solid” border_radius=”” box_shadow=”no” dimension_box_shadow=”” box_shadow_blur=”0″ box_shadow_spread=”0″ box_shadow_color=”” box_shadow_style=”” overflow=”” background_type=”single” gradient_start_color=”” gradient_end_color=”” gradient_start_position=”0″ gradient_end_position=”100″ gradient_type=”linear” radial_direction=”center center” linear_angle=”180″ background_color=”” background_image=”” background_image_id=”” background_position=”left top” background_repeat=”no-repeat” background_blend_mode=”none” render_logics=”” filter_type=”regular” filter_hue=”0″ filter_saturation=”100″ filter_brightness=”100″ filter_contrast=”100″ filter_invert=”0″ filter_sepia=”0″ filter_opacity=”100″ filter_blur=”0″ filter_hue_hover=”0″ filter_saturation_hover=”100″ filter_brightness_hover=”100″ filter_contrast_hover=”100″ filter_invert_hover=”0″ filter_sepia_hover=”0″ filter_opacity_hover=”100″ filter_blur_hover=”0″ animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” last=”true” border_position=”all” first=”false” spacing_right=””][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]