List of usage examples for org.joda.time.format DateTimeFormat longDateTime
public static DateTimeFormatter longDateTime()
From source file:com.helger.datetime.format.PDTFormatter.java
License:Apache License
/** * Get the long date time formatter for the passed locale. * * @param aDisplayLocale// w ww. ja v a 2 s. co 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 getLongFormatterDateTime(@Nullable final Locale aDisplayLocale) { return getWithLocaleAndChrono(DateTimeFormat.longDateTime(), aDisplayLocale); }
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:/* www . j a v a2 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:jiajiechen.countdown.CountDownGUI.java
License:Open Source License
private void doRefresh() { DateTime d = new DateTime(); time.setText(DateTimeFormat.longDateTime().print(d)); // TableRowModel<String> lm = new DefaultListModel<String>(); DefaultTableModel tableModel = (DefaultTableModel) table.getModel(); while (tableModel.getRowCount() < countdown.size()) { final Object rows[][] = { { "", "" } }; tableModel.addRow(rows);//from w w w . j a v a 2s . c o m } Integer row = 0; for (Entry<String, DateTime> e : countdown.entrySet()) { DateTime itemdate = e.getValue(); Period period = new Period(d, itemdate); PeriodFormatter pf = new PeriodFormatterBuilder().appendYears().appendSuffix("y ").appendMonths() .appendSuffix("m ").appendWeeks().appendSuffix("w ").appendDays().appendSuffix("d ") .appendHours().appendSuffix("h ").appendMinutes().appendSuffix("m ").appendSeconds() .appendSuffix("s ").toFormatter(); tableModel.setValueAt(e.getKey(), row, 0); tableModel.setValueAt(pf.print(period), row, 1); row++; } }
From source file:org.grouplens.lenskit.eval.traintest.JobStatusWriter.java
License:Open Source License
private void writeStatus() { try {//from w w w .ja va 2s . c o m DateTimeFormatter format = DateTimeFormat.longDateTime(); DateTime now = DateTime.now(); Files.createParentDirs(outputFile); PrintWriter writer = new PrintWriter(outputFile); try { writer.println("status_time: " + format.print(now)); writer.println("summary:"); writer.println(" total: " + allJobs.size()); writer.println(" active: " + activeJobs.size()); writer.println(" completed: " + finishedJobs.size()); writer.println("running_tasks:"); for (TrainTestJob job : activeJobs) { writer.print("- task: "); writer.println(job); DateTime start = startTime.get(job); writer.format(" started: %s\n", format.print(start)); writer.println(" thread: " + threads.get(job).getName()); } } finally { writer.close(); } } catch (Exception ex) { logger.error("failed to write status", ex); } }
From source file:org.nodel.reflection.Serialisation.java
License:Mozilla Public License
private static DateTime tryParseLongDateTime(String value) { try {//from ww w. j a v a 2s. c o m return DateTime.parse(value, DateTimeFormat.longDateTime()); } catch (Exception exc) { return null; } }
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 date time format * * @param dateTime// ww w .j a v a 2s. co m * The datetime * @return The formatted date */ public String longDateTime(DateTime dateTime) { return format(dateTime, DateTimeFormat.longDateTime()); }
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 www.j a v a 2 s.co m*/ return null; }