Originally posted by Santhosh Jali:
I am writing a batch program. The batch program has a check as below how do I write it, any suggestions ?
Check the current system time falls between Saturday 1.00 AM and Sunday 1.00 PM.
Create a Calendar() object. Then use it's get() method to see if (DAY_OF_WEEK is Saturday and HOUR_OF_DAY >= 1) or (DAY_OF_WEEK is SUNDAY and HOUR_OF_DAY < 13).
Calendar is a class that isn't constructed with new. You have to call it's getInstance() method.
Calendar now = Calendar.getInstance();
To get values you have to use Calendar defined constants
int theHourOfDay = now.get(Calendar.HOUR_OF_DAY)
if ( now.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY )
{
}