List of utility methods to do TimeZone Add
Calendar | stringToCal(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;
|
Calendar | stringToCalendar(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; |
long | toMidnight(long time, TimeZone tz) to Midnight return toMidnight(time, 0, tz);
|
Date | tomorrow(TimeZone zone) tomorrow Calendar ca = truncate(Calendar.getInstance(zone));
ca.add(DATE, 1);
return ca.getTime();
|