Java Today getTodayLastSecond()

Here you can find the source of getTodayLastSecond()

Description

get Today Last Second

License

Open Source License

Declaration

public static Date getTodayLastSecond() 

Method Source Code


//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {

    public static Date getTodayLastSecond() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH);
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        calendar.set(year, month, day, 23, 59, 59);
        return calendar.getTime();
    }//from  w  w  w  .  j  av  a  2  s  . com

    public static String getTodayLastSecond(String format) {
        return getFormat(format).format(getTodayLastSecond());
    }

    public static final String format(Date date, String formate) {
        if (date == null) {
            return "";
        }
        return getFormat(formate).format(date);
    }

    public static final String format(Long dateTmie, String formate) {
        Date date = new Date(dateTmie);
        return getFormat(formate).format(date);
    }

    public static final DateFormat getFormat(String format) {
        return new SimpleDateFormat(format);
    }
}

Related

  1. getTodayFormatted(String pattern)
  2. getTodayHHmmss(String HHmmss)
  3. getTodayInFormat(String format)
  4. getTodayIntevalDays(String date)
  5. getTodayLast()
  6. getTodayLastSecond()
  7. getTodayLastUpdateTimeFormat()
  8. getTodayLimit()
  9. getTodayMidnight()