Java Hour getPreHourText(String pattern)

Here you can find the source of getPreHourText(String pattern)

Description

get Pre Hour Text

License

Apache License

Declaration

public static String getPreHourText(String pattern) 

Method Source Code


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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getPreHourText(String pattern) {
        Calendar c = Calendar.getInstance();
        return getPreHourText(c.getTime(), pattern);
    }//ww w  . j  a  v  a2 s .c  om

    public static String getPreHourText(Date date, String pattern) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.HOUR_OF_DAY, -1);
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(c.getTime());
    }
}

Related

  1. getHoursOfTowDiffDate(String p_startDate, String p_endDate)
  2. getLastHour()
  3. getLasthour()
  4. getMinOfHour(long l1)
  5. getPreHour()
  6. getPrevHour(Date date)
  7. getSecondsPassedInHour()
  8. getTaskTrigger(int taskTriggerHour, boolean tomorrow)
  9. getTicksTill(int hour)