如何从表示一年中某一天的整数创建Date
?
您可以在日历对象中设置一年中的某一天,然后可以从中获取日期对象:
Calendar cal = Calendar.getInstance();// just make sure it's the right year
cal.set(Calendar.DAY_OF_YEAR, dayOfYear);
Date date = cal.getTime();