Java Date Now getCurrentYearBegDate(Date date)

Here you can find the source of getCurrentYearBegDate(Date date)

Description

get Current Year Beg Date

License

Open Source License

Declaration

public static Date getCurrentYearBegDate(Date date) 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date getCurrentYearBegDate(Date date) {

        try {/* ww  w.  j a  v  a2  s. c o m*/
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            String strDate = format.format(date);
            String[] split = strDate.split("-");
            String year = split[0];
            String beginDate = year + "-" + "01" + "-" + "01";
            Date parse = format.parse(beginDate);
            return parse;
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }

    }
}

Related

  1. getCurrentUTCTimeAsString()
  2. getCurrentWeekDay(Date date, int day)
  3. getCurrentWeekDays()
  4. getCurrentWeekFirst()
  5. getCurrentYear()
  6. getCurrentYMDDate()
  7. getCurrentZeroTime()
  8. getDayToMonthEnd(boolean iscurrentdate)
  9. getNowDate()