It looks like you're new here. If you want to get involved, click one of these buttons!
public static boolean checkWorkingDay(Date inputDate)
{
boolean workingDay = true;
Date returnDt = inputDate;
returnDt.setHours(0);
returnDt.setMinutes(0);;
returnDt.setSeconds(0);
try {
List<Tradingcalendar> tradingCalendarlistHoliday = TradingCalendar.GetClassInstance().
getTradingCalendarList().stream().
filter(p -> p.getHolidaytype().equals("holiday") &&
p.getProduct().equals("equities") ).collect(Collectors.toList());
for (int i = 0; i < tradingCalendarlistHoliday.size(); i++) {
Date javaDate = new Date() ;
javaDate.setTime(tradingCalendarlistHoliday.get(i).getHolidaydate().getTime());
if (javaDate.toString().equals(returnDt.toString())) {
workingDay=false;
}
}
if (returnDt.getDay()==0 || returnDt.getDay()==6) {
List<Tradingcalendar> tradingCalendarlistMuharam = null;
tradingCalendarlistMuharam = TradingCalendar.GetClassInstance().
getTradingCalendarList().stream().
filter(p -> p.getHolidaytype().equals("muhurat") &&
p.getProduct().equals("equities") ).collect(Collectors.toList());
boolean chkMuharam=false;
for (int i = 0; i < tradingCalendarlistMuharam.size(); i++) {
Date javaDate = new Date() ;
javaDate.setTime(tradingCalendarlistMuharam.get(i).getHolidaydate().getTime());
if (javaDate.toString().equals(returnDt.toString())) {
chkMuharam=true;
}
}
if (!chkMuharam) {
workingDay=false;
}
}
} catch (Exception e) {
misc.PrintConsole(e.getMessage());
}
return workingDay;
}
Anyway thanks for the solution.