My requirement is to schedule the timer at 11 AM and repeat it after every minute.
Here is my code.
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("EST"));
Date stTime = cal.getTime();
if (!stTime.before(new Date()))
new Timer(true).scheduleAtFixedRate(new ImportTimerUtil(), stTime, 60000);
The timer is scheduled when I click a button.
The problem is the timer is started immediately after clicking a button(clicked the button at 10:30 AM). It is starting after evey 1 minute delay. It is not supposed to start immediately. It is supposed to start at 11:00 AM and after every minute from then.