/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Constructs an instance from an Object that represents a datetime, * forcing the time zone to that specified. * <p> * If the object contains no chronology, <code>ISOChronology</code> is used. * If the specified time zone is null, the default zone is used. * Once the constructor is completed, the zone is no longer used. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadablePartial, ReadableInstant, String, Calendar and Date. * The String formats are described by {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * The default String converter ignores the zone and only parses the field values. * * @param instant the datetime object * @param zone the time zone * @throws IllegalArgumentException if the instant is invalid */ public LocalDateTime(Object instant, DateTimeZone zone) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); Chronology chronology = converter.getChronology(instant, zone); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localDateOptionalTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(values[0], values[1], values[2], values[3]); }
/** * Constructs an instance from an Object that represents a datetime, * using the specified chronology. * <p> * If the chronology is null, ISO in the default time zone is used. * Once the constructor is completed, the zone is no longer used. * If the instant contains a chronology, it will be ignored. * For example, passing a {@code LocalDate} and a different chronology * will return a date with the year/month/day from the date applied * unaltered to the specified chronology. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadablePartial, ReadableInstant, String, Calendar and Date. * The String formats are described by {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * The default String converter ignores the zone and only parses the field values. * * @param instant the datetime object * @param chronology the chronology * @throws IllegalArgumentException if the instant is invalid */ public LocalDateTime(Object instant, Chronology chronology) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localDateOptionalTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(values[0], values[1], values[2], values[3]); }
/** * Constructs an instance from an Object that represents a datetime, * forcing the time zone to that specified. * <p> * If the object contains no chronology, <code>ISOChronology</code> is used. * If the specified time zone is null, the default zone is used. * Once the constructor is completed, the zone is no longer used. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadablePartial, ReadableInstant, String, Calendar and Date. * The String formats are described by {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * The default String converter ignores the zone and only parses the field values. * * @param instant the datetime object * @param zone the time zone * @throws IllegalArgumentException if the instant is invalid */ public LocalDateTime(Object instant, DateTimeZone zone) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); Chronology chronology = converter.getChronology(instant, zone); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localDateOptionalTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(values[0], values[1], values[2], values[3]); }
/** * Constructs an instance from an Object that represents a datetime, * using the specified chronology. * <p> * If the chronology is null, ISO in the default time zone is used. * Once the constructor is completed, the zone is no longer used. * If the instant contains a chronology, it will be ignored. * For example, passing a {@code LocalDate} and a different chronology * will return a date with the year/month/day from the date applied * unaltered to the specified chronology. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadablePartial, ReadableInstant, String, Calendar and Date. * The String formats are described by {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * The default String converter ignores the zone and only parses the field values. * * @param instant the datetime object * @param chronology the chronology * @throws IllegalArgumentException if the instant is invalid */ public LocalDateTime(Object instant, Chronology chronology) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localDateOptionalTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(values[0], values[1], values[2], values[3]); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
static BaseLocalConverter<LocalDateTime> makeLocalDateTimeConverter(DateTimeFormatter formatter) { return new BaseLocalConverter<LocalDateTime>(formatter) { private final DateTimeFormatter localFormatter = ISODateTimeFormat.localDateOptionalTimeParser(); protected LocalDateTime fromString(String value) { return localFormatter.parseLocalDateTime(value); } protected LocalDateTime fromLong(long value) { return new LocalDateTime(value); } }; }
static BaseLocalConverter<LocalDateTime> makeLocalDateTimeConverter(DateTimeFormatter formatter) { return new BaseLocalConverter<LocalDateTime>(formatter) { private final DateTimeFormatter localFormatter = ISODateTimeFormat.localDateOptionalTimeParser(); protected LocalDateTime fromString(String value) { return localFormatter.parseLocalDateTime(value); } protected LocalDateTime fromLong(long value) { return new LocalDateTime(value); } }; }
/** * Constructs an instance from an Object that represents a datetime, * using the specified chronology. * <p> * If the chronology is null, ISO in the default time zone is used. * Once the constructor is completed, the zone is no longer used. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadablePartial, ReadableInstant, String, Calendar and Date. * The String formats are described by {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * The default String converter ignores the zone and only parses the field values. * * @param instant the datetime object * @param chronology the chronology * @throws IllegalArgumentException if the instant is invalid */ public LocalDateTime(Object instant, Chronology chronology) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localDateOptionalTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(values[0], values[1], values[2], values[3]); }
/** * Constructs an instance from an Object that represents a datetime, * forcing the time zone to that specified. * <p> * If the object contains no chronology, <code>ISOChronology</code> is used. * If the specified time zone is null, the default zone is used. * Once the constructor is completed, the zone is no longer used. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadablePartial, ReadableInstant, String, Calendar and Date. * The String formats are described by {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * The default String converter ignores the zone and only parses the field values. * * @param instant the datetime object * @param zone the time zone * @throws IllegalArgumentException if the instant is invalid */ public LocalDateTime(Object instant, DateTimeZone zone) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); Chronology chronology = converter.getChronology(instant, zone); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localDateOptionalTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(values[0], values[1], values[2], values[3]); }
private static DateTime parseDateTime(String input) { if (input.endsWith("Z")) { input = input.substring(0, input.length() - 1); } return DateTime.parse(input, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
/** * Parses a {@code LocalDateTime} from the specified string. * <p> * This uses {@link ISODateTimeFormat#localDateOptionalTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */ @FromString public static LocalDateTime parse(String str) { return parse(str, ISODateTimeFormat.localDateOptionalTimeParser()); }
@Override public void extractValues(T facet, TimeInterval timeInterval, GuestSettings settings) throws OutsideTimeBoundariesException { super.extractValues(facet, timeInterval, settings); this.date = facet.date; final DateTimeZone zone = DateTimeZone.forTimeZone(timeInterval.getTimeZone(facet.date)); if (facet.startTimeStorage!=null) { final DateTime startDateTime = ISODateTimeFormat.localDateOptionalTimeParser().parseLocalDateTime(facet.startTimeStorage).toDateTime(zone); this.eventStart = ISODateTimeFormat.dateTime().withZone(zone).print(startDateTime); } else { this.eventStart = ISODateTimeFormat.dateTime().withZone(zone).print(facet.start); } localTime = true; }