get Current Day End Time - Android java.util

Android examples for java.util:Day

Description

get Current Day End Time

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    private final static SimpleDateFormat shortSdf = new SimpleDateFormat(
            "yyyy-MM-dd");
    private final static SimpleDateFormat longSdf = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");

    public static Date getCurrentDayEndTime() {
        Date now = new Date();
        try {/*w ww. jav  a  2 s. c  om*/
            now = longSdf.parse(shortSdf.format(now) + " 23:59:59");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return now;
    }
}

Related Tutorials