List of usage examples for org.apache.commons.lang3.time DateFormatUtils SMTP_DATETIME_FORMAT
FastDateFormat SMTP_DATETIME_FORMAT
To view the source code for org.apache.commons.lang3.time DateFormatUtils SMTP_DATETIME_FORMAT.
Click Source Link
From source file:net.larry1123.elec.util.logger.FileManager.java
public static long getSplitTime() { long set = System.currentTimeMillis(); try {// w w w . j ava2 s.co m Date currentTime = DateUtils.parseDate(getDateFormatFromMilli(System.currentTimeMillis()), DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern()); Date currentSplit = DateUtils.parseDate(getDateFormatFromMilli(getConfig().getCurrentSplit()), DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern()); Date test; switch (getConfig().getSplit()) { case HOUR: test = DateUtils.addHours(currentTime, 1); test = DateUtils.setMinutes(test, 0); test = DateUtils.setSeconds(test, 0); test = DateUtils.setMilliseconds(test, 0); if (test.after(currentSplit)) { set = getConfig().getCurrentSplit(); } break; case DAY: if (!DateUtils.isSameDay(currentTime, currentSplit)) { set = getConfig().getCurrentSplit(); } break; case WEEK: test = DateUtils.ceiling(currentTime, Calendar.WEEK_OF_MONTH); if (test.after(currentSplit)) { set = getConfig().getCurrentSplit(); } break; case MONTH: test = DateUtils.ceiling(currentTime, Calendar.MONTH); if (test.after(currentSplit)) { set = getConfig().getCurrentSplit(); } break; case NONE: default: set = 0; break; } } catch (ParseException e) { set = 0; } return set; }
From source file:net.larry1123.elec.util.logger.FileManager.java
/** * Makes a formatted String/*from w ww. j a va 2 s .c o m*/ * * @param milli What milli time to use * * @return The formatted String */ public static String getDateFormatFromMilli(long milli) { return DateFormatUtils.SMTP_DATETIME_FORMAT.format(milli); }
From source file:ch.tkuhn.nanobrowser.NanopubElement.java
public String getCreateDateString() { if (nanopub == null) return null; Calendar c = nanopub.getCreationTime(); if (c == null) return null; return DateFormatUtils.format(c, DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern()); }