Here you can find the source of getDayEndTime(int off, String timezone)
public static String getDayEndTime(int off, String timezone)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { public static String getDayEndTime(int off, String timezone) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(new Date().getTime()); calendar.add(5, off);//from w w w .j av a 2 s . c o m SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd 23:59:59"); dateFormatGmt.setTimeZone(TimeZone.getTimeZone(timezone)); return dateFormatGmt.format(calendar.getTime()); } }