Android Day Get getStartNextDay(Date d2)

Here you can find the source of getStartNextDay(Date d2)

Description

get Start Next Day

Declaration

public static Date getStartNextDay(Date d2) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    public static final String VN_DATE_FORMAT = "dd/MM/yyyy";

    public static Date getStartNextDay(Date d2) {
        Date d = getNextDay(d2);//from w w  w  . j a v  a2s .  co  m
        String dStr = dateToString(d, null);
        return stringToDate(dStr, null);
    }

    public static Date getNextDay(Date d2) {
        if (d2 == null)
            d2 = new Date();
        Calendar c1 = Calendar.getInstance();
        c1.setTimeInMillis(d2.getTime() + 24 * 60 * 60 * 1000);
        return c1.getTime();

    }

    public static String dateToString(Date date, String format) {
        if (format == null)
            format = VN_DATE_FORMAT;
        SimpleDateFormat ts = new SimpleDateFormat(format);
        return ts.format(date);
    }

    public static java.util.Date stringToDate(String src, String format) {

        try {
            src = src.trim();
            if (format == null)
                format = VN_DATE_FORMAT;
            SimpleDateFormat ts = new SimpleDateFormat(format);

            return ts.parse(src);
        } catch (Exception e) {
            return null;
        }
    }

    public static java.util.Date parse(String src) {
        try {
            return DateFormat.getDateInstance().parse(src);
        } catch (ParseException e) {
            return DateFormat.getInstance().getCalendar().getTime();
        }
    }
}

Related

  1. getSmartDateString(long time, String extString, String zeroDayString)
  2. getWeatherDateStr(int day)
  3. getArrayDiffDays(String startDate, String endDate)
  4. getIndexDay(Date origin, int index)
  5. getDateOfLastSunday(Date d)
  6. getNextDay(Date d2)
  7. getNextDateForDay(int calendarDay)
  8. getHashByDay(String date)
  9. getJulianDay(Calendar cal)