Here you can find the source of getYearFirstDay(String date)
public static Date getYearFirstDay(String date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date getYearFirstDay(String date) { SimpleDateFormat format = new SimpleDateFormat("yyyy"); Date d = null;/* ww w .ja v a2 s .c o m*/ try { d = format.parse(date); } catch (Exception e) { e.printStackTrace(); } Calendar cal = Calendar.getInstance(); if (d != null) { cal.setTime(d); } cal.add(Calendar.DAY_OF_YEAR, 0); return cal.getTime(); } }