/** * Create instance of ISO-8601 date time format using following pattern: * "yyyy-MM-dd'T'HH:mm:ss.SSSZ" Time zones in ISO-8601 are represented as * local time (with the location unspecified), as UTC, or as an offset from * UTC. If no UTC relation information is given with a time representation, * the time is assumed to be in local time. Examples, when local Time Zone * is +2: * * <pre> * 2016-12-31T22:00:00 corresponds to 2016-12-31T22:00:00+0200 in local Time Zone * 2016-12-31T22:00:00Z corresponds to 2017-01-01T00:00:00+0200 in local Time Zone * 2016-12-31T22:00:00+0200 corresponds to 2016-12-31T22:00:00+0200 in local Time Zone * 2016-12-31T22:00:00+0300 corresponds to 2016-12-31T21:00:00+0200 in local Time Zone * </pre> * * @see <a href= * "https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators">ISO-8601 * Time zone designators</a> * @return */ private static DateFormat getISO8601Format() { StdDateFormat iso8601Format = new StdDateFormat(); iso8601Format.setTimeZone(TimeZone.getDefault()); return iso8601Format; }