
how to find the given date is sunday in java?

Hi Friend,
Try the following code:
import java.util.*;
import java.text.*;
class CheckDay{
public static void main(String[] args){
Date date= (new GregorianCalendar(2010, Calendar.SEPTEMBER, 20)).getTime();
SimpleDateFormat f = new SimpleDateFormat("EEEE");
String day=f.format(date);
if(day.equals("Sunday")){
System.out.println("20-09-2010 was a Sunday");
}
else{
System.out.println("No, it was "+day);
}
}
}
Thanks

Thankyou. its working fine.