/* 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
{
{
OffsetDateTime odt = OffsetDateTime.now ( ZoneId.systemDefault ( ) ) ;
ZoneOffset zoneOffsetOfOdt = odt.getOffset ( ) ;
System .
out .
println ( "ZoneId.systemDefault().toString(): " + ZoneId.
systemDefault ( ) .
toString ( ) ) ; System .
out .
println ( "odt: " + odt
) ; System .
out .
println ( "zoneOffsetOfOdt: " + zoneOffsetOfOdt
) ; System .
out .
println ( "-------------------- " ) ;
ZoneId z = ZoneId.of ( "America/Montreal" ) ;
LocalDate ld = LocalDate.of ( 2017 , 12 , 25 ) ;
ZonedDateTime zdtXmas = ld.atStartOfDay ( z ) ;
ZoneOffset zoneOffsetXmas = zdtXmas.getOffset ( ) ;
System .
out .
println ( "zdtXmas.toString(): " + zdtXmas
) ; System .
out .
println ( "zoneOffsetXmas.toString(): " + zoneOffsetXmas
) ; System .
out .
println ( "zoneOffsetXmas.getTotalSeconds(): " + zoneOffsetXmas.
getTotalSeconds ( ) ) ; System .
out .
println ( "-------------------- " ) ;
Instant instant = zdtXmas.toInstant ( ) ;
ZoneOffset zo = z.getRules ( ) .getOffset ( instant ) ;
System .
out .
println ( "For ZoneId: " + z
+ " at instant: " + instant
+ " the ZoneOffset is: " + zo
) ;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgppbXBvcnQgamF2YS50aW1lLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdb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