Here you can find the source of getDelayTime(int hour, String date)
public static String getDelayTime(int hour, String date) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static String getDelayTime(int hour, String date) throws ParseException { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(string2Date(date).getTime()); calendar.add(10, hour);/* w w w. j av a 2s. c o m*/ SimpleDateFormat dateFormatGmt = new SimpleDateFormat(DATE_FORMAT); return dateFormatGmt.format(calendar.getTime()); } public static Date string2Date(String dateString) throws ParseException { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateString); } }