Java Today getTommorrow(String today)

Here you can find the source of getTommorrow(String today)

Description

get Tommorrow

License

Open Source License

Declaration

public static String getTommorrow(String today) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {
    public static String getTommorrow(String today) {
        Calendar cal = Calendar.getInstance();
        cal.set(Integer.parseInt(today.substring(0, 4)), Integer.parseInt(today.substring(4, 6)) - 1,
                Integer.parseInt(today.substring(6, 8)));
        cal.add(Calendar.DATE, 1);

        String curMonth, curDay;// w  w  w .ja v  a 2 s .co  m
        int tmpMonth, tmpDay;

        tmpMonth = cal.get(Calendar.MONTH) + 1;
        tmpDay = cal.get(Calendar.DATE);

        if (tmpMonth < 10)
            curMonth = "0" + String.valueOf(tmpMonth);
        else
            curMonth = String.valueOf(tmpMonth);

        if (tmpDay < 10)
            curDay = "0" + String.valueOf(tmpDay);
        else
            curDay = String.valueOf(tmpDay);

        return (Integer.toString(cal.get(Calendar.YEAR)) + curMonth + curDay);
    }
}

Related

  1. getTodayYmd()
  2. getTodayYMD()
  3. getTodayZero()
  4. getTodayZero()
  5. getTodayZeroHour()
  6. getYestoday()
  7. getYestoday(String sourceDate, String format)
  8. isBeforeToday(Date date)
  9. isBeforeToday(Date date)