1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| import java.text.SimpleDateFormat;
import java.util.Date;
def mapOsterTage=[
'2011':'24.04.2011',
'2012':'08.04.2012',
'2013':'31.03.2013',
'2014':'20.04.2014',
'2015':'05.04.2015',
'2016':'27.03.2016',
'2017':'16.04.2017',
'2018':'01.04.2018',
'2019':'21.04.2019',
'2020':'12.04.2020'
];
def feiertage=[];
for (i in 2011..2011)
{
currOsterTag=mapOsterTage[i.toString()];
inputFormat= new SimpleDateFormat('dd.MM.yyyy');
currOsterTagAsDate=inputFormat.parse(currOsterTag);
Calendar calendarFix=Calendar.getInstance()
// set to Ostertag
calendarFix.setTime(currOsterTagAsDate);
cal=calendarFix.clone();
// Karfreitag
cal.add(Calendar.DATE,-2);
feiertage+=inputFormat.format(cal.getTime());
cal=calendarFix.clone();
// Ostermontag
cal.add(Calendar.DATE,+1);
feiertage+=inputFormat.format(cal.getTime());
println feiertage[0];
println feiertage[1];
} |