/* package whatever; // don't place package name! */
import java.util.* ;
import java.lang.* ;
import java.io.* ;
import java.time.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System .
out .
println ( "Java version: " + System .
getProperty ( "java.version" ) ) ;
// OffsetDateTime parses ISO 8601 format with offset that includes a colon.
OffsetDateTime odt1 = OffsetDateTime.parse ( "2017-05-16 06:24:36-07:00" .replace ( " " , "T" ) ) ;
System .
out .
println ( "odt1.toString(): " + odt1
) ;
// But OffsetDateTime fails to parse if the optional colon in offset is omitted.
// BUG in Java 8, fixed in Java 9.
OffsetDateTime odt2 = OffsetDateTime.parse ( "2017-05-16 06:24:36-0700" .replace ( " " , "T" ) ) ; // BUG: Throws DateTimeParseException.
System .
out .
println ( "odt2.toString(): " + odt2
) ;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgppbXBvcnQgamF2YS50aW1lLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCQpTeXN0ZW0ub3V0LnByaW50bG4oICJKYXZhIHZlcnNpb246ICIgKyBTeXN0ZW0uZ2V0UHJvcGVydHkoImphdmEudmVyc2lvbiIpICkgOyAKCi8vIE9mZnNldERhdGVUaW1lIHBhcnNlcyBJU08gODYwMSBmb3JtYXQgd2l0aCBvZmZzZXQgdGhhdCBpbmNsdWRlcyBhIGNvbG9uLgpPZmZzZXREYXRlVGltZSBvZHQxID0gT2Zmc2V0RGF0ZVRpbWUucGFyc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