return value; return formatter.format(date); };
@Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) { return fIcuSdf.format(date, toAppendTo, pos); }
@Override public String toString() { return "Revision info [build date: " + new SimpleDateFormat().format(new Date(buildDate)) + ", level info: " + levelInfos + "]"; }
@Override public String apply(String dimValue) { Date date; try { date = timeFormatter.parse(dimValue); } catch (ParseException e) { return dimValue; } return resultFormatter.format(date); }
/** * Get current date for default time zone. * @return current date for default time zone. */ public static String getDate() { // Use GMT timezone dateFormat.setTimeZone(TimeZone.getDefault()); // Return date return dateFormat.format(new Date()); }
/** * Get current date and time as a timestamp. * @return urrent date and time as a timestamp. */ public static String getTimestamp() { // Use GMT timezone //timestampFormat.setTimeZone(TimeZone.getTimeZone("GMT")); timestampFormat.setTimeZone(TimeZone.getDefault()); // Return timestamp return timestampFormat.format(new Date()); }
/** * Get the given date and time as a timestamp. * @param date: a date object. * @return the given date and time as a timestamp. */ public static String getTimestamp(Date date) { timestampFormat.setTimeZone(TimeZone.getDefault()); return timestampFormat.format(date); } }
private void refreshHistory(boolean refetch) { if (Policy.DEBUG_HISTORY) { String time = new SimpleDateFormat("m:ss.SSS").format(new Date(System.currentTimeMillis())); //$NON-NLS-1$ System.out.println(time + ": LocalHistoryPage#refreshHistory, refetch = " + refetch); //$NON-NLS-1$ } if (refreshFileHistoryJob.getState() != Job.NONE){ refreshFileHistoryJob.cancel(); } IHistoryPageSite parentSite = getHistoryPageSite(); Utils.schedule(refreshFileHistoryJob, getWorkbenchSite(parentSite)); }
public IValue printTime(IDateTime inputTime) //@doc{Print an input time using a default format string} { SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss.SSSZ"); Calendar cal = getCalendarForTime(inputTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); }
public IValue printDate(IDateTime inputDate) //@doc{Print an input date using a default format string} { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = getCalendarForDate(inputDate); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); }
public IValue printDateTime(IDateTime inputDateTime) //@doc{Print an input datetime using a default format string} { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ"); Calendar cal = getCalendarForDateTime(inputDateTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); }
public IValue printDateTime(IDateTime inputDateTime, IString formatString) //@doc{Print an input datetime using the given format string} { try { SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue()); Calendar cal = getCalendarForDateTime(inputDateTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print datetime " + inputDateTime + " using format string: " + formatString.getValue(), null, null); } }
public IValue printDate(IDateTime inputDate, IString formatString) //@doc{Print an input date using the given format string} { try { SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue()); Calendar cal = getCalendarForDate(inputDate); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print date " + inputDate + " with format " + formatString.getValue(), null, null); } }
public IValue printTime(IDateTime inputTime, IString formatString) //@doc{Print an input time using the given format string} { try { SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue()); Calendar cal = getCalendarForTime(inputTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time " + inputTime + " with format: " + formatString.getValue(), null, null); } }
public IValue printTimeInLocale(IDateTime inputTime, IString locale) //@doc{Print an input time using a specific locale and a default format string} { try { SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss.SSSZ",new ULocale(locale.getValue())); Calendar cal = getCalendarForTime(inputTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time " + inputTime + " in locale: " + locale.getValue(), null, null); } }
public IValue printDateTimeInLocale(IDateTime inputDateTime, IString locale) //@doc{Print an input datetime using a specific locale and a default format string} { try { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ",new ULocale(locale.getValue())); Calendar cal = getCalendarForDateTime(inputDateTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print datetime " + inputDateTime + " in locale: " + locale.getValue(), null, null); } }
public IValue printDateInLocale(IDateTime inputDate, IString locale) //@doc{Print an input date using a specific locale and a default format string} { try { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd",new ULocale(locale.getValue())); Calendar cal = getCalendarForDate(inputDate); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time " + inputDate + " in locale: " + locale.getValue(), null, null); } }
public IValue printTimeInLocale(IDateTime inputTime, IString formatString, IString locale) //@doc{Print an input time using a specific locale and format string} { try { SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue())); Calendar cal = getCalendarForTime(inputTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time " + inputTime + " in locale: " + locale.getValue(), null, null); } }
public IValue printDateTimeInLocale(IDateTime inputDateTime, IString formatString, IString locale) //@doc{Print an input datetime using a specific locale and format string} { try { SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue())); Calendar cal = getCalendarForDateTime(inputDateTime); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print datetime " + inputDateTime + " using format string: " + formatString.getValue() + " in locale: " + locale.getValue(), null, null); } }
public IValue printDateInLocale(IDateTime inputDate, IString formatString, IString locale) //@doc{Print an input date using a specific locale and format string} { try { SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue())); Calendar cal = getCalendarForDate(inputDate); sd.setCalendar(cal); return values.string(sd.format(cal.getTime())); } catch (IllegalArgumentException iae) { throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print date " + inputDate + " with format " + formatString.getValue() + ", in locale: " + locale.getValue(), null, null); } }