List of usage examples for org.apache.commons.lang3.time FastDateFormat getDateInstance
public static FastDateFormat getDateInstance(final int style)
Gets a date formatter instance using the specified style in the default time zone and locale.
From source file:storybook.toolkit.Period.java
public String getString(int dateFormat) { if (!isValid()) { return I18N.getMsg("msg.common.invalid.period"); }//from w w w .j ava 2 s . c om String startStr = FastDateFormat.getDateInstance(dateFormat).format(startDate); if (startDate.equals(endDate)) { return startStr; } String endStr = FastDateFormat.getDateInstance(dateFormat).format(endDate); return startStr + " - " + endStr; }
From source file:storybook.toolkit.swing.SwingUtil.java
public static JLabel createTimestampLabel() { Date date = new Date(); String dateStr = FastDateFormat.getDateInstance(FastDateFormat.MEDIUM).format(date); String timeStr = FastDateFormat.getTimeInstance(FastDateFormat.MEDIUM).format(date); return new JLabel(dateStr + " - " + timeStr); }
From source file:storybook.ui.panel.chrono.DateDiffLabel.java
public DateDiffLabel(Date date1, Date date2, boolean isVertical) { super("", JLabel.CENTER); this.date1 = date1; this.date2 = date2; String text = I18N.getMsgColon("msg.pref.datediff") + " " + getDays(); FastDateFormat fdf = FastDateFormat.getDateInstance(FastDateFormat.SHORT); String dateStr1 = fdf.format(date1); String dateStr2 = fdf.format(date2); String text2 = "(" + dateStr1 + " - " + dateStr2 + ")"; setText(getDays() + " " + text2); setToolTipText("<html>" + text + "<br>" + text2); setIcon(I18N.getIcon("icon.small.datediff")); }