Created
February 27, 2020 16:30
-
-
Save arielsrv/d6a7844002f12a46ad816f2cca7e2067 to your computer and use it in GitHub Desktop.
timezone overlap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.ZonedDateTime; | |
import static java.lang.System.out; | |
class Program { | |
public static void main(String[] args) { | |
ZonedDateTime thisStart = ZonedDateTime.now().plusHours(-4); | |
ZonedDateTime thisEnd = ZonedDateTime.now().plusHours(-2); | |
ZonedDateTime otherStart = ZonedDateTime.now().plusHours(-3); | |
ZonedDateTime otherEnd = ZonedDateTime.now(); | |
out.print(thisStart + " "); | |
out.println(thisEnd); | |
out.print(otherStart + " "); | |
out.println(otherEnd); | |
if (thisStart.isBefore(otherEnd) && otherStart.isBefore(thisEnd)) { | |
out.println("Overlapping ..."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment