Java Year Day getCurrYearFirstDay(int year)

Here you can find the source of getCurrYearFirstDay(int year)

Description

get Curr Year First Day

License

Open Source License

Declaration

public static String getCurrYearFirstDay(int year) 

Method Source Code

//package com.java2s;
/*/*ww  w.  j  ava  2s .c om*/
 * Copyright 2012-2014 sammyun.com.cn. All rights reserved.
 * Support: http://www.sammyun.com.cn
 * License: http://www.sammyun.com.cn/license
 */

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

public class Main {
    private static String default_format = "yyyy-MM-dd";

    public static String getCurrYearFirstDay(int year) {
        SimpleDateFormat format = new SimpleDateFormat(default_format);
        Calendar calendar = Calendar.getInstance();
        calendar.clear();
        calendar.set(Calendar.YEAR, year);
        Date currYearFirst = calendar.getTime();
        return format.format(currYearFirst);
    }
}

Related

  1. getFirstDay4CurrentYear()
  2. getFirstDayOfThisYear()
  3. getLastDayOfTheYear(int year)
  4. getLastDayOfYear(int year)