I would suggest you use an
enumerated type for months. Also look through the
Java® Language Specification (=JLS) about enums because although the JLS is often difficult to read, it has several examples in.
I would suggest you might do well to stop using
int arithmetic. The shortest month in the year (=February) has 28 × 24 × 60² × 1000ms = 2419200000, which is considerably greater than the largest positive
int (=2147483647), so there is a severe risk of overflow errors.
Do all your arithmetic with
longs. For days in month, February = 24L.
Are you using milliseconds since 1st January 1970? If you use currentTimeMillis, that is what you will get.
Have you considered taking the opposite approach? You can divide the number of milliseconds by milliseconds per day (24 × 60² × 1000 = 86400000L). That gives you the number of completed days since 1st January 1970. So 1st January 1970 is day 0, 2nd January 1970 day 1, etc. 31st December 1970=day 364. You must assume that midnight is not the end of one day but the beginning of the next, so 86400000ms is not the end of 1st January but the beginning of 2nd January.
Remember there are 365 days in a year, so there are 1461 days in four years. By taking days ÷ 365 or days ÷ 1461, you can work out the year remembering the 3rd year in each 4 (=year2=1972) is a leap year. There has been no missed leap year for a century since 1970; the last xx00 year with 365 days was 1900, so you can simplify your calculations of leap years.
Then try taking days off.
As well as dividing by 86400000 or 365, take the remainder from those divisions. If it is not 0 you are not on 1st January or at midnight. I trust you are not required to correct for timezones.