Here you can find the source of endOfYear(Date referenceDate, TimeZone timeZone)
Parameter | Description |
---|---|
referenceDate | The given date. |
public static Calendar endOfYear(Date referenceDate, TimeZone timeZone)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { /**/*from w w w. jav a 2s. c o m*/ * Calcuate the date at the end of the year from the * given date. * * @param referenceDate The given date. * @return The calendar at the end of the year. */ public static Calendar endOfYear(Date referenceDate, TimeZone timeZone) { Calendar c1 = Calendar.getInstance(timeZone); c1.setTime(referenceDate); Calendar c2 = Calendar.getInstance(); c2.clear(); c2.set(c1.get(Calendar.YEAR) + 1, 0, 1); c2.setTimeZone(timeZone); return c2; } }