Java Hour getPrevHour(Date date)

Here you can find the source of getPrevHour(Date date)

Description

get Prev Hour

License

Apache License

Declaration

public static Date getPrevHour(Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static long MINUTE_MILLISECONDS = 1000 * 60;

    public static Date getPrevHour(Date date) {
        return new Date(date.getTime() - 60 * MINUTE_MILLISECONDS);
    }/*w  w w. jav a  2s  . c  o  m*/

    public static long getTime(String s) {
        return parseMysql(s).getTime();
    }

    public static Date parseMysql(String s) {
        try {
            DateFormat fmtTemp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return fmtTemp.parse(s);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. getLastHour()
  2. getLasthour()
  3. getMinOfHour(long l1)
  4. getPreHour()
  5. getPreHourText(String pattern)
  6. getSecondsPassedInHour()
  7. getTaskTrigger(int taskTriggerHour, boolean tomorrow)
  8. getTicksTill(int hour)
  9. getTicksTillHour()