Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Locale; public class Main { private static long calcTimeBettwenZeroAndNow() { Calendar calendar = Calendar.getInstance(Locale.CHINA); calendar.setTimeInMillis(System.currentTimeMillis()); int currentHour = calendar.get(calendar.HOUR); calendar.add(Calendar.HOUR, 24 - currentHour); return calendar.getTimeInMillis(); } }