Here you can find the source of getYYYYMMDDHH(Date date)
public static String getYYYYMMDDHH(Date date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat DATE_FORMAT2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat DATE_FORMAT3 = new SimpleDateFormat("yyyy-MM-dd HH"); public static String getYYYYMMDDHH(Date date) { return DATE_FORMAT3.format(date); }//from w w w . ja v a2 s . c o m public static String format(Date date) { return DATE_FORMAT2.format(date); } }