List of usage examples for org.apache.commons.lang.time FastDateFormat format
public String format(Calendar calendar)
Formats a Calendar
object.
From source file:com.nbp.nmp.benefit.common.CommonDataHandleUtil.java
/** * ? ? ? ? /*from w ww.ja v a 2 s . c om*/ * @param date * @param format * @return */ public static String dateFormatter(Date date, String format) { if (date == null) { return ""; } FastDateFormat toFormatter = FastDateFormat.getInstance(format); return toFormatter.format(date); }
From source file:info.magnolia.cms.util.DateUtil.java
/** * Uses the current locale (user) to format the date and time * @param val Date or Calendar/*w ww . j a v a 2 s. c o m*/ * @return the String */ public static String formatDateTime(Object val) { FastDateFormat format = FastDateFormat.getDateTimeInstance(FastDateFormat.SHORT, FastDateFormat.SHORT, MgnlContext.getLocale()); return format.format(val); }
From source file:com.nbp.nmp.benefit.common.CommonDataHandleUtil.java
/** * ? ? ? /*w ww .j a v a 2s . c om*/ * @param date * @param fromFormatString * @param toFormatString * @return */ public static String stringDateFormatter(String date, String fromFormatString, String toFormatString) { String[] fromParttern = { fromFormatString }; FastDateFormat toFormatter = FastDateFormat.getInstance(toFormatString); Date fromDate = null; try { fromDate = DateUtils.parseDate(date, fromParttern); } catch (Exception e) { return ""; } return toFormatter.format(fromDate); }
From source file:com.intuit.tank.converter.DateConverter.java
/** * @{inheritDoc// ww w .ja v a 2 s . c o m */ @Override public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object obj) { FastDateFormat fmt = DF; if (preferencesBean != null) { fmt = preferencesBean.getDateTimeFormat(); } return fmt.format(obj); }
From source file:io.cfp.dto.ApplicationSettings.java
public ApplicationSettings(Event event) { FastDateFormat format = FastDateFormat.getInstance("dd/MM/yyyy"); eventName = event.getName();//from ww w. j a v a2 s . c o m date = format.format(event.getDate()); releaseDate = format.format(event.getReleaseDate()); decisionDate = format.format(event.getDecisionDate()); shortDescription = event.getShortDescription(); website = event.getUrl(); this.logo = event.getLogoUrl() != null ? event.getLogoUrl() : "/images/logo.png"; open = event.isOpen(); }
From source file:com.hs.mail.imap.message.responder.AbstractImapResponder.java
protected String encodeDateTime(Date date) { FastDateFormat df = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss Z", TimeZone.getTimeZone("GMT"), Locale.US);// w ww . j a v a 2 s.c o m return df.format(date); }
From source file:com.discursive.jccook.lang.DateFormatExample.java
public void testRoundedDates() throws Exception { FastDateFormat sdf = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT; Date now = new Date(); Date nearestHour = DateUtils.round(now, Calendar.HOUR); Date nearestMonth = DateUtils.round(now, Calendar.MONTH); Date nearestYear = DateUtils.round(now, Calendar.YEAR); logger.debug("now: " + sdf.format(now)); logger.debug("round hour: " + sdf.format(nearestHour)); logger.debug("round month: " + sdf.format(nearestMonth)); logger.debug("round year: " + sdf.format(nearestYear)); }
From source file:net.joinedminds.tools.evet.TimeValueTable.java
protected void generateCsvResponse(StaplerResponse rsp) throws IOException { FastDateFormat fdf = resolution == Db.CountResolution.Day ? DATE_FORMAT : DATETIME_FORMAT; rsp.setContentType("text/csv"); PrintWriter out = rsp.getWriter(); SortedSet<Date> keys = new TreeSet<>(); keys.addAll(keySet());/* w w w . ja v a2 s.co m*/ for (Date key : keys) { out.print(fdf.format(key)); for (Integer value : get(key)) { out.print(','); out.print(value); } out.println(); } out.flush(); }
From source file:com.intuit.tank.job.ActJobNodeBean.java
public ActJobNodeBean(String jobId, CloudVmStatusContainer container, FastDateFormat fmt) { super();//w w w. j a va 2s . c o m this.setName(jobId); this.setJobId(jobId); this.setId(jobId); this.setReportMode(""); this.setStatus(container.getStatus().name()); this.setRegion(""); this.setActiveUsers(""); this.setTotalUsers(""); if (container.getStartTime() != null) { this.setStartTime(fmt.format(container.getStartTime())); } else { this.setStartTime(""); } if (container.getEndTime() != null) { this.setEndTime(fmt.format(container.getEndTime())); } else { this.setEndTime(""); } }
From source file:brainleg.app.intellij.ui.EForm.java
private void refreshDetailsText() { FastDateFormat formatter = FastDateFormat.getInstance("HH:mm:ss"); String desc = "num of occurrences: " + numOccurrences + " first: " + formatter.format(firstTime); if (lastTime != null) { desc = desc + " last: " + formatter.format(lastTime); }//w w w.j a v a 2s. c o m detailsLabel.setText(desc); }