Here you can find the source of getRealCalendar(Timestamp time)
protected static Calendar getRealCalendar(Timestamp time)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.util.Calendar; public class Main { protected static Calendar getRealCalendar(Timestamp time) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time.getTime()); if (c.get(Calendar.DAY_OF_WEEK) == 6 && c.get(Calendar.HOUR_OF_DAY) >= 19) { c.setTimeInMillis(c.getTimeInMillis() + 86400000 * 3); clearTime(c);// w ww .jav a2 s . c o m return c; } if (c.get(Calendar.DAY_OF_WEEK) == 7) { c.setTimeInMillis(c.getTimeInMillis() + 86400000 * 2); clearTime(c); return c; } if (c.get(Calendar.DAY_OF_WEEK) == 1) { c.setTimeInMillis(c.getTimeInMillis() + 86400000); clearTime(c); return c; } if (c.get(Calendar.HOUR_OF_DAY) >= 10 && c.get(Calendar.HOUR_OF_DAY) < 19) return c; if (c.get(Calendar.HOUR_OF_DAY) >= 19) c.setTimeInMillis(c.getTimeInMillis() + 86400000); clearTime(c); return c; } protected static void clearTime(Calendar c) { c.set(Calendar.HOUR_OF_DAY, 10); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); } }