round Millis To Date - Java java.util

Java examples for java.util:Millisecond

Description

round Millis To Date

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        double aMillis = 2.45678;
        System.out.println(roundMillisToDate(aMillis));
    }/* www. j  a v  a  2 s . co m*/

    public static final int MILLIS_IN_DAY = 86400000;

    public static long roundMillisToDate(double aMillis) {
        Double dateInMillis = Math.floor(aMillis / 86400000)
                * MILLIS_IN_DAY;
        return dateInMillis.longValue();
    }
}

Related Tutorials