List of usage examples for org.joda.time.format DateTimeFormat mediumTime
public static DateTimeFormatter mediumTime()
From source file:com.helger.datetime.format.PDTFormatter.java
License:Apache License
/** * Get the medium time formatter for the passed locale. * * @param aDisplayLocale/* www . j a v a 2 s . com*/ * 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 getMediumFormatterTime(@Nullable final Locale aDisplayLocale) { return getWithLocaleAndChrono(DateTimeFormat.mediumTime(), 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. */// w ww .j a va2s . 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 w w . j a v a 2 s . co 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:name.martingeisse.admin.application.converter.LocalTimeConverter.java
License:Open Source License
/** * Obtains the formatter to use for the specified locale. *//*from w w w. j a va 2s . c o m*/ private static DateTimeFormatter getFormatter(Locale locale) { return DateTimeFormat.mediumTime().withLocale(locale); }
From source file:org.openhat.androPDI.ports.editors.DialPortDateTimeEditor.java
License:Open Source License
protected void setEventTime(int selectedPosition) { LocalDateTime dateTime = null; switch (selectedPosition) { /*/*from w w w . jav a 2s. c o m*/ <item>Select…</item> <item>In 30 seconds</item> <item>In one minute</item> <item>In five minutes</item> <item>In 15 minutes</item> <item>In one hour</item> <item>In two hours</item> <item>In six hours</item> <item>In one day</item> */ case 1: // 30 seconds dateTime = new LocalDateTime().plusSeconds(30); break; case 2: // one minute dateTime = new LocalDateTime().plusMinutes(1); break; case 3: // five minutes dateTime = new LocalDateTime().plusMinutes(5); break; case 4: // 15 minutes dateTime = new LocalDateTime().plusMinutes(15); break; case 5: // 30 minutes dateTime = new LocalDateTime().plusMinutes(30); break; case 6: // one hour dateTime = new LocalDateTime().plusHours(1); break; case 7: // two hours dateTime = new LocalDateTime().plusHours(2); break; case 8: // six hours dateTime = new LocalDateTime().plusHours(6); break; case 9: // one day dateTime = new LocalDateTime().plusDays(1); break; default: return; } tvDate.setText(DateTimeFormat.mediumDate().print(dateTime)); tvTime.setText(DateTimeFormat.mediumTime().print(dateTime)); currentDate = dateTime; }
From source file:org.openhat.androPDI.ports.editors.DialPortDateTimeEditor.java
License:Open Source License
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.date_time_editor, container); tvDate = (TextView) view.findViewById(R.id.date_time_editor_date); tvDate.setText(DateTimeFormat.mediumDate().print(currentDate)); tvTime = (TextView) view.findViewById(R.id.date_time_editor_time); tvTime.setText(DateTimeFormat.mediumTime().print(currentDate)); btnDate = (Button) view.findViewById(R.id.date_time_editor_select_date_button); btnTime = (Button) view.findViewById(R.id.date_time_editor_select_time_button); spSelect = (Spinner) view.findViewById(R.id.date_time_editor_spinner); btnOk = (Button) view.findViewById(R.id.date_time_editor_ok_button); btnCancel = (Button) view.findViewById(R.id.date_time_editor_cancel_button); getDialog().setTitle("Select date and time"); btnTime.setOnClickListener(new View.OnClickListener() { @Override// w w w. ja va 2s . c o m public void onClick(View v) { timePicker = new TimePickerDialogFragment(currentDate, tvTime); timePicker.show(getFragmentManager(), "timePicker"); } }); btnDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { datePicker = new DatePickerDialogFragment(currentDate, tvDate); datePicker.show(getFragmentManager(), "datePicker"); } }); spSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setEventTime(position); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); btnOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // parse date LocalDate date = null; LocalTime time = null; date = DateTimeFormat.mediumDate().parseLocalDate(tvDate.getText().toString()); String t = tvTime.getText().toString(); /* // add seconds to time if they're missing if (t.split(":").length <= 2) t += ":00"; */ time = DateTimeFormat.mediumTime().parseLocalTime(t); LocalDateTime result = date.toLocalDateTime(time); dismiss(); dismissedListener.dismissed(result); } }); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); return view; }
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 medium time format * * @param dateTime//from w w w. j a va 2 s. c o m * The datetime * @return The formatted date */ public String mediumTime(DateTime dateTime) { return format(dateTime, DateTimeFormat.mediumTime()); }
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 ww.j av a 2s . c om*/ return null; }