Epic Systems Interview Question
Software DevelopersCountry: United States
Interview Type: Written Test
looks like he counted all the days from begin to end.
53 years worth of days + leap days + days in 2064 until march 6th
this sum %7 should give you how many days away from Tuesday it will be which should be Sunday
Right. And now I think it is actually Saturday, since I mistakenly counted Jan 1 2011 as part of the total.
String str1= "January 1, 2011";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.ENGLISH);
LocalDate d1 = LocalDate.parse(str1, formatter);
String str2 = "March 6, 2064";
LocalDate d2 = LocalDate.parse(str2, formatter);
long noOfMiliSecondsInDay = (100 * 60 * 60 * 24)
long totalMiliSec = d1.getTime() - d2.getTime();
long totalDays = totalMiliSec / noOfMiliSecondsInDay ;
int dayDiff = totalDays % 7;
tuesday + ((64-11)*365 + 52/4 (leap year days) + 31 + 28 + 6) % 7
- tjcbs2 March 05, 2015