Java Hour Format getHourFormat(String string)

Here you can find the source of getHourFormat(String string)

Description

get Hour Format

License

LGPL

Declaration

public static String getHourFormat(String string) 

Method Source Code


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

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

public class Main {
    public static SimpleDateFormat sdf_hour = new SimpleDateFormat("yyyy-MM-dd HH");

    public static String getHourFormat(String string) {
        try {//from  w w w .j a v a 2s . co m
            return sdf_hour.format(sdf_hour.parse(string));
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. getHHmm()
  2. getHHMM(Date date)
  3. getHHMMSS()
  4. getHHMMSS()
  5. getHHmmSS()
  6. getHourMinuteFormatter()
  7. getHoursNumberFormat()
  8. getOnehouragoFormatString(String format)
  9. hoursBetween(String from, String to, String format)