Java Day of getLateInTheDay(Date date)

Here you can find the source of getLateInTheDay(Date date)

Description

get Late In The Day

License

Open Source License

Parameter

Parameter Description
date a parameter

Exception

Parameter Description
ParseException an exception

Return

Date

Declaration

public static Date getLateInTheDay(Date date) throws ParseException 

Method Source Code


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

import java.util.Date;

public class Main {
    public static final String SHORT_DATE_FORMAT_STR = "yyyy-MM-dd";
    public static final String LONG_DATE_FORMAT_STR = "yyyy-MM-dd HH:mm:ss";
    public static final String LATE_TIME = "23:59:59";

    /**//from  w w w.j  a  v a 2s  .c  om
     * @param date
     * @return Date
     * @throws ParseException
     */
    public static Date getLateInTheDay(Date date) throws ParseException {
        String dateString = new SimpleDateFormat(SHORT_DATE_FORMAT_STR).format(date) + " " + LATE_TIME;
        return new SimpleDateFormat(LONG_DATE_FORMAT_STR).parse(dateString);
    }

    /**
     * @param dateString
     * @param format
     * @return Date
     */
    public static Date parse(String dateString, String format) {
        Date date = null;
        try {
            date = parserStringToDate(dateString, format);
        } catch (Exception e) {
        }
        return date;
    }

    /**
     * @param dateString
     * @param format
     * @return Date
     * @throws ParseException
     */
    public static Date parserStringToDate(String dateString, String format) throws ParseException {
        DateFormat dateFormat = new SimpleDateFormat(format);
        return dateFormat.parse(dateString);
    }
}

Related

  1. getIncrementDaysSecond(String strDate, int sec)
  2. getInsertDayDate(int days)
  3. getIntervalDate(String date, int intervalDays)
  4. getIntervalDays(Date fDate, Date oDate)
  5. getIntevalDays(String startDate, String endDate)
  6. getLatest7Day()
  7. getNDayAfterCurrentDate(String dateStr, String dateFormat, int n)
  8. getOtherDayLastUpdateTimeFormat()
  9. getPaxBirthday()