there has been a few other question which are pretty much the same, but i cant seem to get my bit of code to work. I get the user input which is there birthday dd/mm/yyyy. I'm ignoring leap years by the way. Im trying to determine what day of the week it was when the user was born. I have to determine how many days they were born from a certain date which in this case is Tuesday the 1st of January 1901. That's why ive done year-1901
day=int day;
used a switch to determine how many days in each month which is represented by dayMonth
so July has 31, feb has 28 etc.
year=int year;
String[] days =
{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
howManyDays = ((year-1901)*365 + dayMonth + day - 1);
whatDay = (howManyDays%7);
days[whatDay]
It works sometimes, but then sometimes it doesn't. Any help is appreciated, if any questions feel free to ask. Thanks in advance and hope it makes sense!