get Current Hour End Time - Android java.util

Android examples for java.util:Hour

Description

get Current Hour End Time

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private final static SimpleDateFormat longHourSdf = new SimpleDateFormat(
            "yyyy-MM-dd HH");
    private final static SimpleDateFormat longSdf = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");

    public static Date getCurrentHourEndTime() {
        Date now = new Date();
        try {/*from   w  w w  .  j  ava  2  s.c  o m*/
            now = longSdf.parse(longHourSdf.format(now) + ":59:59");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return now;
    }
}

Related Tutorials