Changeset 14434 in josm for trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
- Timestamp:
- 2018-11-20T01:13:10+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r14159 r14434 153 153 * @since 14055 154 154 */ 155 public static synchronized String fromTimestamp(long timestamp) { 156 final ZonedDateTime temporal = Instant.ofEpochMilli(TimeUnit.SECONDS.toMillis(timestamp)).atZone(ZoneOffset.UTC); 155 public static String fromTimestamp(long timestamp) { 156 return fromTimestampInMillis(TimeUnit.SECONDS.toMillis(timestamp)); 157 } 158 159 /** 160 * Formats a date to the XML UTC format regardless of current locale. 161 * @param timestamp number of milliseconds since the epoch 162 * @return The formatted date 163 * @since 14434 164 */ 165 public static synchronized String fromTimestampInMillis(long timestamp) { 166 final ZonedDateTime temporal = Instant.ofEpochMilli(timestamp).atZone(ZoneOffset.UTC); 157 167 return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(temporal); 158 168 } … … 164 174 */ 165 175 public static synchronized String fromTimestamp(int timestamp) { 166 return fromTimestamp( (long) timestamp);176 return fromTimestamp(Integer.toUnsignedLong(timestamp)); 167 177 } 168 178
Note:
See TracChangeset
for help on using the changeset viewer.