List of utility methods to do TimeZone Format
SimpleDateFormat | getDefaultDateFormatWithoutTimeZone(TimeZone zone) get Default Date Format Without Time Zone SimpleDateFormat simpleDateFormat = DATE_FORMAT_WITHOUT_TIME_ZONE_MAP.get(zone); if (simpleDateFormat == null) { simpleDateFormat = DATE_FORMAT_WITHOUT_TIME_ZONE_MAP.get(null); SimpleDateFormat clone = (SimpleDateFormat) simpleDateFormat.clone(); clone.setTimeZone(zone); DATE_FORMAT_WITHOUT_TIME_ZONE_MAP.put(zone, clone); return simpleDateFormat; ... |
SimpleDateFormat | getDefaultDateFormatWithTimeZone() get Default Date Format With Time Zone return DATE_FORMAT_WITH_TIME_ZONE;
|
String | getFormattedTime(Date time, String formatTime, String timezone) get Formatted Time if (time == null) { return ""; SimpleDateFormat sdf = new SimpleDateFormat(formatTime); TimeZone tz = TimeZone.getTimeZone(timezone); sdf.setTimeZone(tz); return sdf.format(time); |
SimpleDateFormat | getSimpleDateFormat(TimeZone timeZone, String pattern) Returns a SimpleDateFormat for the specified time zone and formatting pattern (as specified by SimpleDateFormat). SimpleDateFormat formatter = new SimpleDateFormat(pattern); formatter.setLenient(false); formatter.setTimeZone(timeZone); return formatter; |
String | getString(Date dt, DateFormat df, TimeZone to) Get the timezone specific string. df.setTimeZone(to);
return df.format(dt);
|
String | getTimeByZoneAndFormat(Date date, TimeZone zone, String format) get Time By Zone And Format final DateFormat formatter = new SimpleDateFormat(format, LOCALE_US); formatter.setTimeZone(zone); return formatter.format(date); |
DateTime | getTimeWithFormat(String stringDate, String dateFormat, DateTimeZone timeZone, Locale locale) e.g. locale = locale != null ? locale : Locale.ENGLISH; timeZone = timeZone != null ? timeZone : getServerDateTimeZone(); try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat, locale); simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone.getID())); Date parsedDate = simpleDateFormat.parse(stringDate); return new DateTime(parsedDate, timeZone); } catch (ParseException e) { ... |
String | getTimezoneFormattedString(Date date, String timezone) get Timezone Formatted String TimeZone tz = null; if (timezone == null) { tz = NEW_YORK; } else { tz = TimeZone.getTimeZone(timezone); Calendar cal = Calendar.getInstance(tz, Locale.US); cal.setTime(date); ... |
String | getUserToServerDateTimeString(TimeZone timeZone, int dateFormat, int timeFormat, String date) Gets the dateString attribute of the DateUtils object return getUserToServerDateTimeString(timeZone, dateFormat, timeFormat, date, Locale.getDefault());
|
SimpleDateFormat | getZfgcTimeZoneDateFormat(String timezone) get Zfgc Time Zone Date Format SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy z"); sdf.setTimeZone(TimeZone.getTimeZone(timezone)); return sdf; |