Here you can find the source of getBeforeOneHour()
public static String getBeforeOneHour()
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static String getBeforeOneHour() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); return String.valueOf(cal.get(Calendar.HOUR_OF_DAY) == 0 ? 23 : cal.get(Calendar.HOUR_OF_DAY) - 1); }// ww w . j a va 2s .co m }