public
class
TestDate {
DateFormat dateFormat =
new
SimpleDateFormat(
"yyyy-MM-dd"
);
@Test
public
void
test1()
throws
Exception {
String dateStart =
"2009-01-01"
;
Date d1 = dateFormat.parse(dateStart);
//d1=2009-01-01
Calendar c1 = Calendar.getInstance();
c1.setTime(d1);
int
y = c1.get(Calendar.DAY_OF_YEAR);
System.out.println(
"Day of year:"
+ y +
" of "
+ d1);
}
}