Java Year Day getFirstDayOfThisYear()

Here you can find the source of getFirstDayOfThisYear()

Description

get First Day Of This Year

License

Open Source License

Declaration

public static String getFirstDayOfThisYear() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    public static final SimpleDateFormat shortDateFormat = new SimpleDateFormat("yyyy-MM-dd");

    public static String getFirstDayOfThisYear() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MONTH, 1);
        calendar.set(Calendar.DAY_OF_YEAR, 1);
        Date date = new Date(calendar.getTimeInMillis());
        return shortDateFormat.format(date);
    }/*from   w w w .jav a2 s  .  c om*/
}

Related

  1. getCurrYearFirstDay(int year)
  2. getFirstDay4CurrentYear()
  3. getLastDayOfTheYear(int year)
  4. getLastDayOfYear(int year)
  5. getLastDayOfYear(int year)
  6. getTodayYear()