Java Utililty Methods Date ISO Parse

List of utility methods to do Date ISO Parse

Description

The list of methods to do Date ISO Parse are organized into topic(s).

Method

Stringtime2StringISO(Date date)
Erzeugt einen String der Form HH:MM:SS
return new SimpleDateFormat("HH:mm:ss").format(date);
StringtimestampAsIsoString(long timestamp)
timestamp As Iso String
return dateAsIsoString(new Date(timestamp));
CalendartoCalendar(final String iso8601string)
Transform ISO 8601 string to Calendar.
Calendar calendar = GregorianCalendar.getInstance();
String s = iso8601string.replace("Z", "+00:00");
try {
    s = s.substring(0, 22) + s.substring(23);
} catch (IndexOutOfBoundsException e) {
    throw new ParseException("Invalid length", 0);
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse(s);
...
DatetoDate(String isoDate)
Convert ISO-8601 UTC Date/Time to Date.
SimpleDateFormat fmtr;
try {
    fmtr = sPool.pop();
} catch (EmptyStackException e) {
    fmtr = newInstance();
try {
    return fmtr.parse(isoDate);
...
StringtoIsoString(Calendar value)
to Iso String
return (value == null) ? "" : toIsoString(value.getTime());
StringtoIsoString(Date date)
Returns the given Date as a String in ISO 8601 format.
synchronized (ISO_8601) {
    return ISO_8601.format(date);
StringtoStringForComparison(Date date)
to String For Comparison
if (date == null) {
    return "";
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault());
return formatter.format(date);
DatetryParse(String isoDateTime)
try Parse
return ISO_SDF_DATETIME.parse(isoDateTime);