Java tutorial
//package com.java2s; public class Main { 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(); } }