protected String expandDate(String date) throws ParseException { // date format is "month/day/year" Date humanDate = df.getPatternInstance("MM.dd.yyyy", ULocale.ENGLISH).parse(date); String[] dateParts = df.format(humanDate).replaceAll(",", "").split("\\s"); dateParts[1] = expandOrdinal(Double.parseDouble(dateParts[1])); dateParts[2] = expandYear(Double.parseDouble(dateParts[2])); return Arrays.toString(dateParts).replaceAll("[,\\]\\[]", ""); }
protected String format(Date date,int formatterIdx) { if (date == null) return null; if(formatterIdx>=0) { return formatters[formatterIdx].format(date); } return String.valueOf(date.getTime()); }
protected String format(Date date,int formatterIdx) { if (date == null) return null; if(formatterIdx>=0) { return formatters[formatterIdx].format(date); } return String.valueOf(date.getTime()); }
protected String format(Date date,int formatterIdx) { if (date == null) return null; if(formatterIdx>=0) { return formatters[formatterIdx].format(date); } return String.valueOf(date.getTime()); }
public DeltaSession(String description, IDelta delta, String baselineName) { this.delta = delta; this.baselineName = baselineName; this.timestamp = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date(System.currentTimeMillis())); this.description = description; }
public DeltaSession(String description, IDelta delta, String baselineName) { this.delta = delta; this.baselineName = baselineName; this.timestamp = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date(System.currentTimeMillis())); this.description = description; } public ITreeModel getModel() {
@Override public String formatDate(int style, Date value) { return getDateFormat(style).format(value); }
@Override protected String resolve(TemplateContext context) { return DateFormat.getDateInstance().format(new java.util.Date()); } }
@Override protected String resolve(TemplateContext context) { return DateFormat.getTimeInstance().format(new java.util.Date()); } }
private String formatTimestamp ( final Calendar timestamp ) { if ( timestamp == null ) { return null; } final Calendar c = (Calendar)timestamp.clone (); final TimeZone tz = Activator.getTimeZone (); if ( tz != null ) { c.setTimeZone ( tz ); } return TIMESTAMP_DATE_FORMAT.format ( c.getTime () ); }
@Override public String formatDateTime(Date date) { return getDateTimeFormat().format(date); }
@Override protected String resolve(TemplateContext context) { return DateFormat.getDateInstance().format(new java.util.Date()); } }
@Override protected String resolve(TemplateContext context) { return DateFormat.getTimeInstance().format(new java.util.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()); }
/** * Return the human readable timestamp of this element. * @return the human readable timestamp of this element */ public String getTimestamp() { long date = fileRevision.getTimestamp(); Date dateFromLong = new Date(date); return DateFormat.getDateTimeInstance().format(dateFromLong); }
@Override public String formatDate(String locale, Date date, String skeleton, String timezone) { ULocale closestLocale = localeService.getClosestULocale(locale); DateFormat formatter = DateFormat.getPatternInstance(skeleton, closestLocale); if (StringUtils.isNotEmpty(timezone)) { formatter.setTimeZone(TimeZone.getTimeZone(timezone)); } return formatter.format(date); }
/** * Get the time string the finished job * * @return String or <code>null</code> if this is not one of the finished * jobs. */ private String getTimeString() { Date date = FinishedJobs.getInstance().getFinishDate(info); if (date != null) { return DateFormat.getTimeInstance(DateFormat.SHORT).format(date); } return null; }
protected String getEditionLabel(HistoryInput input) { String format= Utilities.getString(fBundle, "historyEditionLabel", null); //$NON-NLS-1$ if (format == null) format= Utilities.getString(fBundle, "editionLabel"); //$NON-NLS-1$ if (format == null) format= "x{0}"; //$NON-NLS-1$ long modDate= input.getModificationDate(); String date= DateFormat.getDateTimeInstance().format(new Date(modDate)); return MessageFormat.format(format, new Object[] { date }); }
protected String getEditionLabel(HistoryInput input) { String format= Utilities.getString(fBundle, "historyEditionLabel", null); //$NON-NLS-1$ if (format == null) format= Utilities.getString(fBundle, "editionLabel"); //$NON-NLS-1$ if (format == null) format= "x{0}"; //$NON-NLS-1$ long modDate= input.getModificationDate(); String date= DateFormat.getDateTimeInstance().format(new Date(modDate)); return MessageFormat.format(format, date); }