List of usage examples for org.joda.time.format DateTimeFormat fullTime
public static DateTimeFormatter fullTime()
From source file:com.helger.datetime.format.PDTFormatter.java
License:Apache License
/** * Get the full time formatter for the passed locale. * * @param aDisplayLocale//from w w w . ja va 2 s . c o m * The display locale to be used. May be <code>null</code>. * @return The created date time formatter. Never <code>null</code>. */ @Nonnull public static DateTimeFormatter getFullFormatterTime(@Nullable final Locale aDisplayLocale) { return getWithLocaleAndChrono(DateTimeFormat.fullTime(), aDisplayLocale); }
From source file:com.hmsinc.epicenter.velocity.DateTimeFormatTool.java
License:Open Source License
/** * Checks a string to see if it matches one of the standard DateTimeFormat * style patterns: full, long, medium, short, or default. *///from w w w .ja v a2s. com private static DateTimeFormatter getTimeStyle(String style, Locale locale, DateTimeZone zone) { final DateTimeFormatter ret; if (style.equalsIgnoreCase("full")) { ret = DateTimeFormat.fullTime(); } else if (style.equalsIgnoreCase("long")) { ret = DateTimeFormat.longTime(); } else if (style.equalsIgnoreCase("medium")) { ret = DateTimeFormat.mediumTime(); } else if (style.equalsIgnoreCase("short")) { ret = DateTimeFormat.shortTime(); } else if (style.equalsIgnoreCase("none")) { ret = null; } else { ret = DateTimeFormat.forPattern(style); } return ret == null ? null : ret; }
From source file:com.vityuk.ginger.provider.format.JodaTimeUtils.java
License:Apache License
private static DateTimeFormatter createJodaDateFormatter(FormatType formatType, DateFormatStyle formatStyle) { switch (formatType) { case TIME://w ww.j a v a 2 s. c om switch (formatStyle) { case SHORT: return DateTimeFormat.shortTime(); case MEDIUM: return DateTimeFormat.mediumTime(); case LONG: return DateTimeFormat.longTime(); case FULL: return DateTimeFormat.fullTime(); case DEFAULT: return ISODateTimeFormat.time(); } case DATE: switch (formatStyle) { case SHORT: return DateTimeFormat.shortDate(); case MEDIUM: return DateTimeFormat.mediumDate(); case LONG: return DateTimeFormat.longDate(); case FULL: return DateTimeFormat.fullDate(); case DEFAULT: return ISODateTimeFormat.date(); } case DATETIME: switch (formatStyle) { case SHORT: return DateTimeFormat.shortDateTime(); case MEDIUM: return DateTimeFormat.mediumDateTime(); case LONG: return DateTimeFormat.longDateTime(); case FULL: return DateTimeFormat.fullDateTime(); case DEFAULT: return ISODateTimeFormat.dateTime(); } } throw new IllegalArgumentException(); }
From source file:org.sakaiproject.tool.assessment.ui.bean.delivery.SectionContentsBean.java
License:Educational Community License
public void setMetaData(SectionDataIfc section) { if (section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) != null) { Integer authortype = new Integer(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE)); setSectionAuthorType(authortype); if (section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) .equals(SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL.toString())) { if (section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN) != null) { Integer numberdrawn = new Integer( section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN)); setNumberToBeDrawn(numberdrawn); }/*ww w . j av a 2 s . com*/ if (section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW) != null) { Long poolid = new Long( section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW)); setPoolIdToBeDrawn(poolid); } if (section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW) != null) { String poolname = section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW); setPoolNameToBeDrawn(poolname); String randomDrawDate = section .getSectionMetaDataByLabel(SectionDataIfc.QUESTIONS_RANDOM_DRAW_DATE); if (randomDrawDate != null && !"".equals(randomDrawDate)) { try { // bjones86 - SAM-1604 DateTime drawDate; DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); //The Date Time is in ISO format try { drawDate = fmt.parseDateTime(randomDrawDate); } catch (Exception ex) { Date date = null; try { // Old code produced dates that appeard like java.util.Date.toString() in the database // This means it's possible that the database contains dates in multiple formats // We'll try parsing Date.toString()'s format first. // Date.toString is locale independent. So this SimpleDateFormat using Locale.US should guarantee that this works on all machines: DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); // parse can either throw an exception or return null date = df.parse(randomDrawDate); } catch (Exception e) { // failed to parse. Not worth logging yet because we will try again with another format } if (date == null) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZ"); // If this throws an exception, it's caught below. This is appropriate. date = df.parse(randomDrawDate); } if (date == null) { // Nothing has worked throw new IllegalArgumentException("Unable to parse date " + randomDrawDate); } else { drawDate = new DateTime(date); } } //We need the locale to localize the output string Locale loc = new ResourceLoader().getLocale(); String drawDateString = DateTimeFormat.fullDate().withLocale(loc).print(drawDate); String drawTimeString = DateTimeFormat.fullTime().withLocale(loc).print(drawDate); setRandomQuestionsDrawDate(drawDateString); setRandomQuestionsDrawTime(drawTimeString); } catch (Exception e) { log.error("Unable to parse date text: " + randomDrawDate, e); } } } } } else { setSectionAuthorType(SectionDataIfc.QUESTIONS_AUTHORED_ONE_BY_ONE); } if (section.getSectionMetaDataByLabel(SectionDataIfc.QUESTIONS_ORDERING) != null) { Integer questionorder = new Integer( section.getSectionMetaDataByLabel(SectionDataIfc.QUESTIONS_ORDERING)); setQuestionOrdering(questionorder); } else { setQuestionOrdering(SectionDataIfc.AS_LISTED_ON_ASSESSMENT_PAGE); } }
From source file:ro.activemall.photoxserver.utils.thymeleafJoda.JodaTimeDialect.java
License:Open Source License
@Override public Set<IProcessor> getProcessors() { Set<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new JodaTimeFormatProcessor("fullDate", DateTimeFormat.fullDate())); processors.add(new JodaTimeFormatProcessor("fullDateTime", DateTimeFormat.fullDateTime())); processors.add(new JodaTimeFormatProcessor("fullTime", DateTimeFormat.fullTime())); processors.add(new JodaTimeFormatProcessor("longDate", DateTimeFormat.longDate())); processors.add(new JodaTimeFormatProcessor("longDateTime", DateTimeFormat.longDateTime())); processors.add(new JodaTimeFormatProcessor("longTime", DateTimeFormat.longTime())); processors.add(new JodaTimeFormatProcessor("mediumDate", DateTimeFormat.mediumDate())); processors.add(new JodaTimeFormatProcessor("mediumDateTime", DateTimeFormat.mediumDateTime())); processors.add(new JodaTimeFormatProcessor("mediumTime", DateTimeFormat.mediumTime())); processors.add(new JodaTimeFormatProcessor("shortDate", DateTimeFormat.shortDate())); processors.add(new JodaTimeFormatProcessor("shortDateTime", DateTimeFormat.shortDateTime())); processors.add(new JodaTimeFormatProcessor("shortTime", DateTimeFormat.shortTime())); processors.add(new JodaTimeFormatProcessor("isoDateTime", ISODateTimeFormat.dateTime())); return processors; }
From source file:ro.activemall.photoxserver.utils.thymeleafJoda.JodaTimeExpressionObject.java
License:Open Source License
/** * Formats the datetime with a JodaTime full time format * * @param dateTime//w ww . ja v a2 s. c o m * The datetime * @return The formatted date */ public String fullTime(DateTime dateTime) { return format(dateTime, DateTimeFormat.fullTime()); }
From source file:ru.caramel.juniperbot.core.message.resolver.DateTimePlaceholderResolver.java
License:Open Source License
@Override public Object getChild(String name) { switch (name) { case "shortTime": return format(DateTimeFormat.shortTime()); case "mediumTime": return format(DateTimeFormat.mediumTime()); case "longTime": return format(DateTimeFormat.longTime()); case "fullTime": return format(DateTimeFormat.fullTime()); case "shortDate": return format(DateTimeFormat.shortDate()); case "mediumDate": return format(DateTimeFormat.mediumDate()); case "longDate": return format(DateTimeFormat.longDate()); // The same as medium case "fullDate": return format(DateTimeFormat.fullDate()); case "shortDateTime": return format(DateTimeFormat.shortDateTime()); case "mediumDateTime": return format(DateTimeFormat.mediumDateTime()); case "longDateTime": return format(DateTimeFormat.longDateTime()); case "fullDateTime": return format(DateTimeFormat.fullDateTime()); }// w w w . j av a2s .c o m return null; }