Java Day dayEnd(Date date)

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

Description

day End

License

Apache License

Declaration

public static Date dayEnd(Date date) 

Method Source Code


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

import java.text.DateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date dayEnd(Date date) {
        if (date == null)
            return null;

        DateFormat dayGranularity = new SimpleDateFormat("ddMMyyyy");
        DateFormat secondGranularity = new SimpleDateFormat("ddMMyyyy:HHmmss");
        String today = dayGranularity.format(date);

        try {/*  w ww. j  a  v  a  2  s.c  om*/
            return secondGranularity.parse(today + ":235959");
        } catch (ParseException e) {
            // short of a coding error this should never happen
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. dateValue(Date d)
  2. day2Day(String startDate, String endDate, String format)
  3. day2ThuesDay(Date date)
  4. dayDiff(Date date1, String date2)
  5. dayFillter(String text, String type)
  6. dayFillter(String text, String type)
  7. dayFilter(Date date)
  8. dayForAMorPM(String date)