List of usage examples for org.joda.time.format DateTimeFormat longTime
public static DateTimeFormatter longTime()
From source file:com.helger.datetime.format.PDTFormatter.java
License:Apache License
/** * Get the long time formatter for the passed locale. * * @param aDisplayLocale//from www . j a v a2s. c om * 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 getLongFormatterTime(@Nullable final Locale aDisplayLocale) { return getWithLocaleAndChrono(DateTimeFormat.longTime(), 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 ww w. j a v a2 s . c om 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://from w w w .j av a 2 s . c o m 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:net.sf.jasperreports.functions.standard.DateTimeFunctions.java
License:Open Source License
public static String TIME(Integer hours, Integer minutes, Integer seconds, String timePattern) { if (hours == null || minutes == null || seconds == null) { if (log.isDebugEnabled()) { log.debug("None of the arguments can be null."); }/*from www . j a v a2 s.co m*/ return null; } LocalTime lt = new LocalTime(hours, minutes, seconds); if (timePattern == null) { return lt.toString(DateTimeFormat.longTime()); } else { try { // Try to convert to a pattern DateTimeFormatter dtf = DateTimeFormat.forPattern(timePattern); return lt.toString(dtf); } catch (IllegalArgumentException ex) { // Fallback to the default solution return lt.toString(DateTimeFormat.longTime()); } } }
From source file:org.onosproject.ui.table.cell.TimeFormatter.java
License:Apache License
/** * Constructs a time formatter that uses the default locale and timezone. */ public TimeFormatter() { dtf = DateTimeFormat.longTime(); }
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 long time format * * @param dateTime/*from w w w .ja v a 2 s. c o m*/ * The datetime * @return The formatted date */ public String longTime(DateTime dateTime) { return format(dateTime, DateTimeFormat.longTime()); }
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()); }/*from w w w . j a v a2 s .co m*/ return null; }