Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Thursday at 14:55
- private static Date calcPatchNotesStartDate() {
- Calendar calendar = Calendar.getInstance();
- boolean runToday = false;
- int today = calendar.get(Calendar.DAY_OF_WEEK);
- if(today == Calendar.THURSDAY && calendar.get(Calendar.HOUR_OF_DAY) < 14 && calendar.get(Calendar.MINUTE) < 55) {
- runToday = true;
- }
- //Run at 14:55
- calendar.set(Calendar.HOUR_OF_DAY, 14);
- calendar.set(Calendar.MINUTE, 55);
- calendar.set(Calendar.SECOND, 0);
- if(runToday) {
- return calendar.getTime();
- }
- int dif = Calendar.THURSDAY - today;
- if(dif > 1) {
- calendar.set(Calendar.DAY_OF_YEAR, dif + calendar.get(Calendar.DAY_OF_YEAR));
- } else {
- calendar.set(Calendar.DAY_OF_YEAR, 7 + dif + calendar.get(Calendar.DAY_OF_YEAR));
- }
- return calendar.getTime();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement