get First Day Of Year - Java java.util

Java examples for java.util:Year

Description

get First Day Of Year

Demo Code


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

import java.util.Date;

public class Main {
    public static void main(String[] argv) throws Exception {
        Date date = new Date();
        System.out.println(getFirstDayOfYear(date));
    }// w w w. ja  v  a  2 s.c  o  m

    public static String getFirstDayOfYear(Date date) {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-01-01");
        return sf.format(date);
    }
}

Related Tutorials