Java Utililty Methods TimeZone Add

List of utility methods to do TimeZone Add

Description

The list of methods to do TimeZone Add are organized into topic(s).

Method

CalendarstringToCal(String s, TimeZone tz)
string To Cal
Calendar cal = Calendar.getInstance(tz);
cal.set(Calendar.MONTH, Integer.parseInt(s.substring(0, 2)) - 1);
cal.set(Calendar.DATE, Integer.parseInt(s.substring(3, 5)));
cal.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10)));
return cal;
CalendarstringToCalendar(String strDate, TimeZone timezone)
String to calendar.
String FORMAT_DATETIME = "yyyy-MM-dd'T'HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATETIME, Locale.ENGLISH);
sdf.setTimeZone(timezone);
Date date = sdf.parse(strDate);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
longtoMidnight(long time, TimeZone tz)
to Midnight
return toMidnight(time, 0, tz);
Datetomorrow(TimeZone zone)
tomorrow
Calendar ca = truncate(Calendar.getInstance(zone));
ca.add(DATE, 1);
return ca.getTime();