Java SQL Date getNextDayStr(String curday)

Here you can find the source of getNextDayStr(String curday)

Description

get Next Day Str

License

Apache License

Declaration

public static String getNextDayStr(String curday) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;
import java.sql.Date;

public class Main {
    static public SimpleDateFormat MMddYYYY_HHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    static public SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");

    public static String getNextDayStr(String curday) {
        java.util.Date date = str2utilDate(curday);
        return date2str(new Date(date.getTime() + 24 * 3600 * 1000));
    }/*from   w  ww. ja v a 2  s.  c  o m*/

    public static java.util.Date str2utilDate(String str) {
        try {
            java.util.Date udate = yyyyMMdd.parse(str);
            return udate;
        } catch (Exception e) {
            System.out.println("DateUtil.str2utilDate(str) Error:e = " + e);
            return null;
        }
    }

    public static String date2str(java.util.Date date) {
        if (date == null)
            return "";
        try {
            return MMddYYYY_HHmmss.format(date);
        } catch (Exception e) {
            return "";
        }
    }

    static public String date2str(java.sql.Date date) {
        if (date == null)
            return "";
        try {
            return yyyyMMdd.format(date);
        } catch (Exception e) {
            return "";
        }

    }
}

Related

  1. getInsertarEmpleado()
  2. getInsertarEntrada()
  3. getIntervalDays(String sd, String ed)
  4. getLastDay()
  5. getMonthInt(String month)
  6. getNextDayStr(String curday)
  7. getNow()
  8. getNow()
  9. getNowHour()