get Last Day Of Year - Android java.util

Android examples for java.util:Day

Description

get Last Day Of Year

Demo Code


//package com.java2s;

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

import java.util.Locale;

public class Main {

    public static String getLastDayOfYear() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd",
                Locale.CHINA);//from  w  w  w  . j  av  a2s  .c  om
        Calendar cal = Calendar.getInstance();

        cal.set(Calendar.MONTH, Calendar.DECEMBER);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        return format.format(cal.getTime());
    }
}

Related Tutorials