get Tomorrow in yyyy/MM/dd format - Android java.util

Android examples for java.util:Year

Description

get Tomorrow in yyyy/MM/dd format

Demo Code


//package com.java2s;
import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    @SuppressLint("SimpleDateFormat")
    public static String getTomorrow() {
        Calendar cal = new GregorianCalendar();
        cal.add(Calendar.DATE, 1);
        return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime());
    }/*  w w  w.j  a  va 2 s. c o m*/

    @SuppressLint("SimpleDateFormat")
    public static String getTomorrow(String strFormat) {
        Calendar cal = new GregorianCalendar();
        cal.add(Calendar.DATE, 1);
        return new SimpleDateFormat(strFormat).format(cal.getTime());
    }
}

Related Tutorials