Holidays 4.7 build: 9450 released: 2011-02-16 Calculates when holidays occur in any given year. Copyright: (c) 2012 Canadian Mind Products. signed Java Applet (that can also be run as an application). Download from: http://mindprod.com/products1.html#HOLIDAYS View HTML to run this program online at: http://mindprod.com/applet/holidays.html ===> Free <=== Full source included. You may even include the source code, modified or unmodified in free/commercial open source/proprietary programs that you write and distribute. May be used freely for any purpose but military. For more details on this restriction, see http://mindprod.com/contact/nonmil.html If you include any Canadian Mind Products code in your own applications, your app too must be labeled non-military use only. All Java jars and source code are included. ---- Prerequisites: This program runs under any OS, (e.g. Win2K/XP/Vista/W7x86/W7-64/OSX/Linux/Solaris/AIX...) so long as you have <><> Java version 1.5 <><> or later installed (32-bit or 64-bit Java). See http://mindprod.com/jgloss/installingjava.html for details. ---- Installing on a PC: Download source and compiled class files to run on your own machine as an application or Applet First install a recent Java JDK or JVM. See http://mindprod.com/jgloss/installingjava.html. To install, extract the zip download with WinZip (or similar unzip utility) into any directory you please, often J:\ -- ticking off the "use folder names" option. To run as an application,type: java -ea -jar J:\com\mindprod\holidays\holidays.jar {put any parms here} adjusting as necessary to account for where the jar file is. ---- Installing on a MacIntosh: Use Safari to download source and compiled class files to run on your own machine as an application or Applet. Safari will automatically unpack the zip into ~/Downloads (version 10.5) [or on the Desktop (version 10.4 and earlier)]. First install a recent Java JDK or JVM. See http://mindprod.com/jgloss/installingjava.html. You may optionally move the download tree to a permanent home. I don't have a MacIntosh, just a PC, so I can't test my Java programs for Mac compatibility. In theory they should work without problems, but in practice that does not always happen. If you have problems please, let me know, preferably with screenshots and complete verbatim error messages. To run as an application, without parameters, just double click the jar file. To run as an application with parameters, in bash shell type: open Terminal.app cd ~/Desktop java -ea -jar com/mindprod/holidays/holidays.jar {put any parms here} adjusting as necessary to account for where the jar file is. ---- Rebuilding: The zip already contains the necessary class and jar files, so unless you modify the program, there is no need to recompile the source or rebuild the jar. Configure.java basedir="E:/" in rebuild.xml to the drive where your files are. Configure.java your certificate name with environment SET cert=mindprodcert2012dsa Configure.java your certificate password with environment SET jarsignerpassword=sesame Use ANT and rebuild.xml, not build.xml, to recompile and recreate the jar. ---- Use: Caculates when various holidays occur in any given year BC or AD. Designed to be cannibalised to include the calculation routines in your own programs. It can also be used as an Applet or a standalone application. It currently calculates 66 "holidays" including the following: New Years Day Congress Start Day Martin Luther King Day Inauguration Day Robbie Burns Day Australia Day Groundhog Day Mardi Gras Ash Wednesday Lincoln's Birthday Valentines Day Presidents Day Alberta Family Day Washington's Birthday Commonwealth Day Daylight Savings Day St Patrick's day Vernal Equinox Palm Sunday Good Friday Earth Hour April Fools Day Earth Day Easter Sunday Easter Monday ANZAC Day Cinco de Mayo Europe Day Mothers Day Armed Forces Day Victoria Day Memorial Day Change Your Password Day Australia Queen's Birthday Fathers Day Summer Solstice Aboriginal Day St Jean-Baptiste Day Canada Day Independence Day Utah Pioneer Day Parents' Day Canada Civic Day Canadian Labour Day American Labor Day Grandparents Daay Autumnal Equinox Canadian Thanksgiving Columbus Day Creationism Day Halloween Daylight Savings End General Election Day Remembrance Day Veterans Day American Thanksgiving Black Friday St. Andrews Day World AIDS Day Human Rights Day Winter Solstice Christmas Eve Christmas Christmas in the USA Boxing Day New Years Eve If a holiday was not celebrated in a given year, it will not show. Includes complete Java source code to calculate when the holiday occurs in a given year, when it was first celebrated, when first proclaimed, the rule for how it is calculated in words and an authority to go to for more information. Also calculates the nearest weekday to any given holiday, when you actually get the day off. This is what I refer to by the term "shifted". Boxing day has special shift handling. In the source are methods that can also be used to calculate how many business days were between given dates. It is quite easy to specify which days you want considered as holidays using methods like addHoliday where you specify the date or the name of the Holiday, addAmericanFederalHolidays and addWeekDaysAsHolidays. The main holiday still missing is Chinese New Year, the second new moon after Winter solstice. Since it is an astronomical moment, the civil calendar day it occurs on depends on time zone. There is an additiontal package of German holidays designed to work in the Holidays framework available from http://www.applicate.de/freesoftware/holiday/ One typical use embedding in your own program: public class DemoGermanHolidayUtils { public static void main(String[] args) { // 1. Enable calculation from 1995 to 2010 IsHoliday holiday = new IsHoliday(1995, 2010); // 2. Mark weekends as holidays holiday.addWeekendsAsHolidays(); // 3. Add German federal holidays GermanHolidayUtils.addGermanFederalHolidays(holiday); System.out.print("Is May 1st 2002 a holiday: "); System.out.println(holiday.isHoliday( new BigDate(2002, 5, 1))); } } To install, Extract the zip download with WinZip, available from http://www.winzip.com (or similar unzip utility) into any directory you please, often C:\ -- ticking off the "user folder names" option. To run as an application, type: java -jar C:\com\mindprod\holidays\holidays.jar adjusting as necessary to account for where the jar file is. Why the turkey icon? It represents the holiday feasts of Thanksgiving and Christmas. You may use the code freely in your own programs. Exporting Holidays to CSV ************************* You can use the ExportHolidaysToCSV program to calculate and export the holidays for any given year in CSV format. You can the import them into programs or databases written in other languages. Use it like this: java -jar exportholidaystocsv.jar 2050 verbose to get the authority and rules includes. These generate multiple line fields, incompatible with some simple-minded CSV programs. Or java -jar exportholidaystocsv.jar 2050 to get just the holiday name, yyyy-mm-dd when observed in 2050, year first observed and year first proclaimed. If you leave of the year, the current year is presumed. The results appear in a file called: holidaysInYear2050.csv in the current directory. The file is in UTF-8 encoding. View it with NotePad, Jedit or other modern UTF-8 text editor. You can convert it with CSVEntify to make visbible the awkward characters with HTML entities, ---- Version History: 1.0 1999-09-09 to show off the Holidays class 1.1 1999-09-10 add St Patrick's Day and Commonwealth Day 1.2 1999-09-17 reorg so each holiday calculator is a separate class add equinox and solstice calculators. 1.3 1999-10-24 add Robbie Burns Day 1.4 2000-05-08 more accurate Victoria Day calculation. 1.5 2001-01-14 configurable default year 1.6 2001-04-07 add inauguration day 1.7 2002-01-08 change default date to 2003 fix bug in Victoria Day calc. 1.8 2002-03-16 make fromYear and toYear protected to make it easier to override in isHoliday.java. 1.9 2002-03-18 improve Javadoc improve constructor for IsHoliday class 2.0 2004-04-24 add Earth Day 2.1 2005-02-12 change default year to 2005 2.2 2005-06-18 consistent bat files. 2.3 2005-06-18 about box 2.4 2005-07-27 added Parents' Day added extensive Javadoc 2.5 2005-12-01 added Human Rights Day 2.6 2006-03-05 reformat with IntelliJ, add Javadoc 2.7 2006-03-05 2.8 2006-03-05 2.9 2006-03-05 3.0 2006-03-05 3.1 2007-05-22 add PAD and icon, more IntelliJ inspect tidying. 3.2 2007-10-10 additional notes. 3.3 2007-10-13 UK vs US Christmas, calculate when get day off. 3.4 2007-12-19 display year to ensure have correct one. 3.5 2008-01-25 add Australia Day 3.6 2008-02-02 add ANZAC day, Australian Queen's Birthday 3.7 2008-02-07 add Mardi Gras 3.8 2008-03-20 convert to JDK 1.5, sort holidays, tidy word wraps, use of rsquo 3.9 2008-06-21 add Aboriginal Day 4.0 2008-10-19 add Daylight Saving Start and Daylight Saving End Day 4.1 2008-11-01 add St. Andrews day 4.2 2008-12-03 add World AIDS day 4.3 2009-09-15 add Change Your Password Day 4.4 2009-11-23 add Black Friday 4.5 2010-03-30 add Earth Hour 4.6 2010-10-23 add Creationism Day 4.7 2011-02-16 add ExportHolidaysAsCSV -30-