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?
shilpa kulkarni
Ranch Hand
Joined: Jun 07, 2000
Posts: 87
posted
0
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));
Chanpreet Julka
Ranch Hand
Joined: Nov 09, 2001
Posts: 40
posted
0
thanks.. ill check it out
Matthew Phillips
Ranch Hand
Joined: Mar 09, 2001
Posts: 2676
posted
0
This post will probably be more appropriate in the Java in general intermidiate forum. I will move it there. Matthew Phillips
Matthew Phillips
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.