List of usage examples for java.text DateFormat setTimeZone
public void setTimeZone(TimeZone zone)
From source file:org.apache.oozie.extensions.OozieELExtensions.java
private static DateFormat getISO8601DateFormat(TimeZone tz) { DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); // Stricter parsing to prevent dates such as 2011-12-50T01:00Z (December 50th) from matching dateFormat.setLenient(false);/*w w w . j a v a 2 s . c om*/ dateFormat.setTimeZone(tz); return dateFormat; }
From source file:org.wso2.carbon.identity.mgt.endpoint.client.ApiClient.java
public static DateFormat buildDefaultDateFormat() { // Use RFC3339 format for date and datetime. // See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); // Use UTC as the default time zone. dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat; }
From source file:org.zoumbox.mh_dla_notifier.MhDlaNotifierUtils.java
public static Date parseSpDate(String input) { Date result = null;/*from w w w . jav a2 s . c o m*/ if (input != null) { DateFormat inputDF = new SimpleDateFormat(INTPUT_DATE_FORMAT); inputDF.setTimeZone(getSpTimeZone()); try { result = inputDF.parse(input); } catch (ParseException pe) { Log.e(TAG, "Date mal formate ", pe); } } return result; }
From source file:org.dasein.cloud.terremark.Terremark.java
public static Date parseIsoDate(String isoDateString) { java.text.DateFormat df = new SimpleDateFormat(ISO8601_PATTERN); df.setTimeZone(TimeZone.getTimeZone("UTC")); Date result = null;//from w w w.j a v a 2s .c om try { result = df.parse(isoDateString); } catch (ParseException e) { df = new SimpleDateFormat(ISO8601_NO_MS_PATTERN); df.setTimeZone(TimeZone.getTimeZone("UTC")); result = null; try { result = df.parse(isoDateString); } catch (ParseException e2) { e2.printStackTrace(); } } return result; }
From source file:org.zoumbox.mh_dla_notifier.MhDlaNotifierUtils.java
public static String formatDLAForDisplay(Context context, Date input) { String result = N_C;/* ww w . j a va 2s .co m*/ if (input != null) { CharSequence format = context.getText(R.string.dla_format); DateFormat outputDF = new SimpleDateFormat(format.toString(), Locale.FRENCH); outputDF.setTimeZone(getDisplayTimeZone(context)); result = outputDF.format(input); } return result; }
From source file:org.zoumbox.mh_dla_notifier.MhDlaNotifierUtils.java
public static String formatDLAForDisplayShort(Context context, Date input) { String result = N_C;/*w w w . j a v a 2 s . c o m*/ if (input != null) { CharSequence format = context.getText(R.string.dla_format_short); DateFormat outputDF = new SimpleDateFormat(format.toString(), Locale.FRENCH); outputDF.setTimeZone(getDisplayTimeZone(context)); result = outputDF.format(input); } return result; }
From source file:org.zoumbox.mh_dla_notifier.MhDlaNotifierUtils.java
public static String formatHourNoSecondsForDisplay(Context context, Date input) { String result = N_C;//from ww w . j a v a 2 s. co m if (input != null) { DateFormat outputDF = new SimpleDateFormat(HOUR_NO_SEC_DATE_FORMAT, Locale.FRENCH); outputDF.setTimeZone(getDisplayTimeZone(context)); result = outputDF.format(input); } return result; }
From source file:org.kalypso.ogc.sensor.timeseries.TimeseriesUtils.java
/** * It is currently fix and is: "dd.MM.yy HH:mm" * * @return the date format to use when displaying dates for observations/timeseries *//* www. jav a2s. co m*/ public static DateFormat getDateFormat() { final DateFormat sdf = new SimpleDateFormat("dd.MM.yy HH:mm"); //$NON-NLS-1$ final TimeZone timeZone = KalypsoCorePlugin.getDefault().getTimeZone(); sdf.setTimeZone(timeZone); return sdf; }
From source file:org.mxupdate.update.util.StringUtil_mxJPO.java
/** * Formats given date with time (normally from the last modification time * of a file) to the related string representation in MX. The convert is * done in time zone {@link #TIMEZONE} so that always the same time zone * is used (e.g. summer and winter time...). * * @param _paramCache parameter cache/*w w w .ja va 2 s . c om*/ * @param _date last modification date of a file to convert to a * string * @return string representation of the date in time zone {@link #TIMEZONE} * @see #PARAM_FILEDATEFORMAT */ public static String formatFileDate(final ParameterCache_mxJPO _paramCache, final Date _date) { final DateFormat fileFormat = new SimpleDateFormat( _paramCache.getValueString(StringUtil_mxJPO.PARAM_FILEDATEFORMAT)); fileFormat.setTimeZone(StringUtil_mxJPO.TIMEZONE); return fileFormat.format(_date); }
From source file:org.mxupdate.update.util.StringUtil_mxJPO.java
/** * Parses given string with date and time in time zone {@link #TIMEZONE} * and returns related date./*from www . j av a 2 s. c o m*/ * * @param _paramCache parameter cache * @param _date string with the last modified date in time zone * {@link #TIMEZONE} * @return parsed date instance * @throws ParseException if date string could not be parsed * @see #PARAM_FILEDATEFORMAT */ public static Date parseFileDate(final ParameterCache_mxJPO _paramCache, final String _date) throws ParseException { final DateFormat fileFormat = new SimpleDateFormat( _paramCache.getValueString(StringUtil_mxJPO.PARAM_FILEDATEFORMAT)); fileFormat.setTimeZone(StringUtil_mxJPO.TIMEZONE); return fileFormat.parse(_date); }