import java.io.*;
import java.util.Calendar;
class DayofDate {
public static void main(String args[]) throws IOException
{
String months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String wday[] = {" ", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
Calendar calendar = Calendar.getInstance();
int d,m,y;
BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Date");
System.out.println("Enter Day");
d=Integer.parseInt(ob.readLine());
System.out.println("Enter Month");
m=Integer.parseInt(ob.readLine());
System.out.println("Enter Date");
y=Integer.parseInt(ob.readLine());
calendar.clear();
calendar.set(Calendar.YEAR, y);
calendar.set(Calendar.MONTH, m-1);
calendar.set(Calendar.DATE, d);
System.out.print("Date: ");
System.out.print(months[calendar.get(Calendar.MONTH)]);
System.out.print(" " + calendar.get(Calendar.DATE) + " ");
System.out.println(calendar.get(Calendar.YEAR));
System.out.println(wday[calendar.get(Calendar.DAY_OF_WEEK)]);
}
}
No comments:
Post a Comment