You are viewing a single comment's thread. Return to all comments →
public static String findDay(int month, int day, int year) { String [] daysOfWeek = {"SATURDAY", "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"}; if (month < 3) { month += 12; year -= 1; } // h = (q + (13(m + 1)/5) + K + (K / 4) + (J / 4) + 5J) mod 7 int dayOfWeek = (day + (13 * (month + 1) / 5) + year % 100 + (year % 100 / 4) + (year / 100 / 4) + 5 * (year / 100)) % 7; return daysOfWeek[dayOfWeek]; }
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Java Date and Time
You are viewing a single comment's thread. Return to all comments →