Created
March 9, 2020 05:08
-
-
Save canyon289/74b44877789a41e938237df54654600a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/*A test to see if I can understand java programs*/ | |
import java.time.LocalDateTime; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.time.Instant; | |
import java.time.LocalTime; | |
public class DateTest { | |
private static final String DATE_FORMAT = "YYYY-MM-DD"; | |
// private static final String PST = "Test"; | |
private static final ZoneId PST = ZoneId.of("America/Los_Angeles"); | |
private static final Instant nowUtc = Instant.now(); | |
private static final ZonedDateTime nowPST = ZonedDateTime.ofInstant(nowUtc, PST); | |
private static final LocalTime FlushCutoff = LocalTime.parse("23:30"); | |
public static void main(String[] args) { | |
// Test Date functionality | |
System.out.println(PST); | |
System.out.println(nowUtc); | |
System.out.println(nowPST); | |
System.out.println(LocalTime.now(PST)); | |
System.out.println(FlushCutoff); | |
if (LocalTime.now(PST).isAfter(FlushCutoff)) { | |
System.out.println("Met Cutoff"); | |
} | |
else { | |
System.out.println("Failed Cutoff"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment