Changeset 8565 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-07-04T18:31:20+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r8564 r8565 119 119 } 120 120 121 private static String toXmlFormat(GregorianCalendar cal) { 122 XMLGregorianCalendar xgc = XML_DATE.newXMLGregorianCalendar(cal); 123 if (cal.get(Calendar.MILLISECOND) == 0) { 124 xgc.setFractionalSecond(null); 125 } 126 return xgc.toXMLFormat(); 127 } 128 129 /** 130 * Formats a date to the XML UTC format regardless of current locale. 131 * @param timestamp number of seconds since the epoch 132 * @return The formatted date 133 */ 134 public static synchronized String fromTimestamp(int timestamp) { 135 calendar.setTimeInMillis(timestamp * 1000L); 136 return toXmlFormat(calendar); 137 } 138 121 139 /** 122 140 * Formats a date to the XML UTC format regardless of current locale. … … 126 144 public static synchronized String fromDate(Date date) { 127 145 calendar.setTime(date); 128 XMLGregorianCalendar xgc = XML_DATE.newXMLGregorianCalendar(calendar); 129 if (calendar.get(Calendar.MILLISECOND) == 0) xgc.setFractionalSecond(null); 130 return xgc.toXMLFormat(); 146 return toXmlFormat(calendar); 131 147 } 132 148
Note:
See TracChangeset
for help on using the changeset viewer.