List of usage examples for org.joda.time LocalDateTime fromDateFields
@SuppressWarnings("deprecation") public static LocalDateTime fromDateFields(Date date)
java.util.Date
using exactly the same field values. From source file:org.jtwig.functions.builtin.DateFunctions.java
License:Apache License
@JtwigFunction(name = "date") public String format(@Parameter Date input, @Parameter String format) { if (input == null) return ""; String jodaFormat = PHPDateFormatConverter.convertDateFormat(format); DateTimeFormatter formatter = DateTimeFormat.forPattern(jodaFormat); return LocalDateTime.fromDateFields(input).toString(formatter); }
From source file:org.jtwig.functions.builtin.DateFunctions.java
License:Apache License
@JtwigFunction(name = "date") public String format(@Parameter Date input) { if (input == null) return ""; return LocalDateTime.fromDateFields(input).toString(ISODateTimeFormat.dateHourMinuteSecond()); }
From source file:org.vraptor.impl.converter.jodatime.LocalDateTimeConverter.java
License:Open Source License
public LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle) { try {// w w w.ja va2 s. co m Date datetime = new LocaleBasedJodaTimeConverter(localization.get()).convert(value, type); if (datetime == null) { return null; } return LocalDateTime.fromDateFields(datetime); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value)); } }