I am using the Java Calender class and I am reading in a Year for a Day of Year, for example 2001 for the year, and 045 for the Day of Year. Does anyone know how I would could get this Day of Year to set the month as Feburary. Is there anything in the Calander class which can read the Day of Year and automatically tell what month it is? If there is how would I do this?
This piece of code returns date as 14 Feb 2001. Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2001); cal.set(Calendar.DAY_OF_YEAR, 45); System.out.println(cal.get(Calendar.DATE)); System.out.println(cal.get(Calendar.MONTH)+1); System.out.println(cal.get(Calendar.YEAR));