Here you can find the source of nextWeekday(int weekday, int hour, int minute, int second)
public static Date nextWeekday(int weekday, int hour, int minute, int second)
//package com.java2s; //License from project: Artistic License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { public static Date nextWeekday(int weekday, int hour, int minute, int second) { Calendar now = now();// w w w . j av a2 s.c o m int day = now.get(Calendar.DAY_OF_MONTH) + (7 - now.get(Calendar.DAY_OF_WEEK)) + weekday; return year(now.get(Calendar.MONTH), day, hour, minute, second); } public static Calendar now() { Calendar now = new GregorianCalendar(); now.setTimeInMillis(new Date().getTime()); now.setTimeZone(TimeZone.getDefault()); return now; } public static Date year(int month, int day, int hour, int minute, int second) { Calendar now = now(); return new GregorianCalendar(now.get(Calendar.YEAR), month, day, hour, minute, second).getTime(); } }