/** * This constructor replace the constructor with further DateTime object which will be included * in the futur version of jdk (jdk7). example of datetime argument: format specified by the * ISO8601 yyyy-mm-DDTHH:MM:SSZ - example : 2003-02-13T12:28:00.000GMT-08:00. * * @param dateTime * @throws java.text.ParseException */ public DefaultPosition(final InternationalString datetime) throws ParseException { this.position = Utils.getDateFromString(datetime.toString()); }
final String timezone = getTimeZone(dateString); sdf.setTimeZone(TimeZone.getTimeZone(timezone));
/** * May be used for describing temporal positions in ISO8601 format referenced to the Gregorian * calendar and UTC. * * @return {@linkplain InternationalString} @TODO all subtypes of TemporalPosition must be * implemented. */ public Date getDate() { if (this.position instanceof Date) { return (Date) position; } if (this.position instanceof TemporalPosition) { if (this.position instanceof JulianDate) { return Utils.JulianToDate((DefaultJulianDate) position); } if (this.position instanceof DateAndTime) { return Utils.dateAndTimeToDate((DateAndTime) position); } if (this.position instanceof CalendarDate) { return Utils.calendarDateToDate((CalendarDate) position); } if (this.position instanceof TemporalCoordinate) { return Utils.temporalCoordToDate((TemporalCoordinate) position); } if (this.position instanceof OrdinalPosition) { return Utils.ordinalToDate((OrdinalPosition) position); } } return null; }
/** * Gets the zoned date time. * * @param dateString the date string * @return the zoned date time */ public static ZonedDateTime getZonedDateTime(String dateString) { ZonedDateTime zonedDateTime = null; if (dateString != null) { try { String updatedString = dateString.replace("Z", "+00:00"); Date iso8601 = Utils.getDateFromString(updatedString); if (iso8601 != null) { String zoneId = Utils.getTimeZone(updatedString); zonedDateTime = ZonedDateTime.ofInstant(iso8601.toInstant(), ZoneId.of(zoneId)); } } catch (ParseException e) { ConsoleManager.getInstance().exception(DateUtils.class, e); } } return zonedDateTime; }
/** * May be used for describing temporal positions in ISO8601 format referenced to the * Gregorian calendar and UTC. * @return {@linkplain InternationalString} * * @TODO all subtypes of TemporalPosition must be implemented. */ public Date getDate() { if (this.position instanceof Date) { return (Date) position; } if (this.position instanceof TemporalPosition) { if (this.position instanceof JulianDate) { return Utils.JulianToDate((DefaultJulianDate) position); } if (this.position instanceof DateAndTime) { return Utils.dateAndTimeToDate((DateAndTime) position); } if (this.position instanceof CalendarDate) { return Utils.calendarDateToDate((CalendarDate) position); } if (this.position instanceof TemporalCoordinate) { return Utils.temporalCoordToDate((TemporalCoordinate) position); } if (this.position instanceof OrdinalPosition) { return Utils.ordinalToDate((OrdinalPosition) position); } } return null; }
/** * This constructor replace the constructor with further DateTime object which will be included in the futur version of jdk (jdk7). * example of datetime argument: format specified by the ISO8601 yyyy-mm-DDTHH:MM:SSZ - example : 2003-02-13T12:28:00.000GMT-08:00. * @param dateTime * @throws java.text.ParseException */ public DefaultPosition(final InternationalString datetime) throws ParseException { this.position = Utils.getDateFromString(datetime.toString()); }
final String timezone = getTimeZone(dateString); sdf.setTimeZone(TimeZone.getTimeZone(timezone));
/** * May be used for describing temporal positions in ISO8601 format referenced to the * Gregorian calendar and UTC. * @return {@linkplain InternationalString} * * @TODO all subtypes of TemporalPosition must be implemented. */ public Date getDate() { if (this.position instanceof Date) { return (Date) position; } if (this.position instanceof TemporalPosition) { if (this.position instanceof JulianDate) { return Utils.JulianToDate((DefaultJulianDate) position); } if (this.position instanceof DateAndTime) { return Utils.dateAndTimeToDate((DateAndTime) position); } if (this.position instanceof CalendarDate) { return Utils.calendarDateToDate((CalendarDate) position); } if (this.position instanceof TemporalCoordinate) { return Utils.temporalCoordToDate((TemporalCoordinate) position); } if (this.position instanceof OrdinalPosition) { return Utils.ordinalToDate((OrdinalPosition) position); } } return null; }
/** * This constructor replace the constructor with further DateTime object which will be included in the futur version of jdk (jdk7). * example of datetime argument: format specified by the ISO8601 yyyy-mm-DDTHH:MM:SSZ - example : 2003-02-13T12:28:00.000GMT-08:00. * @param dateTime * @throws java.text.ParseException */ public DefaultPosition(final InternationalString datetime) throws ParseException { this.position = Utils.getDateFromString(datetime.toString()); }
final String timezone = getTimeZone(dateString); sdf.setTimeZone(TimeZone.getTimeZone(timezone));