Java Date And Time HackerRank
CODE:
public static String findDay(int month, int day, int year) {
String finalday=" ";
try{
String d1= day+"/"+month+"/"+year;
SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
Date date1=sdf.parse(d1);
DateFormat format1=new SimpleDateFormat("EEEE");
finalday=format1.format(date1);
// return finalday;
}
catch(Exception e){
System.out.println(e);
}
return finalday.toUpperCase();
}
Comments
Post a Comment