Java Day of endOfTheDay(Date date)

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

Description

end Of The Day

License

Apache License

Declaration

public static Date endOfTheDay(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.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date endOfTheDay(Date date) {
        Calendar c = new GregorianCalendar();
        c.setTime(date);//  w  w  w .java 2s .c  o m
        c.set(Calendar.HOUR_OF_DAY, 23);
        c.set(Calendar.MINUTE, 59);
        c.set(Calendar.SECOND, 59);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }

    public static long getTime(String s) {
        return parseMysql(s).getTime();
    }

    public static Date parseMysql(String s) {
        try {
            DateFormat fmtTemp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return fmtTemp.parse(s);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. calcDay(String date1, String date2, String format)
  2. calcSunday(String queryDate)
  3. CountCmpHolidays(Date stdate, Date enddate, String[] CmpHoliDays)
  4. countDay(String begin, String end)
  5. formatDate(String day)
  6. formatDay(final Date time)
  7. formatDayTime(String day)
  8. formatShortNameOfDay(final Date date)