Created
April 20, 2016 13:23
-
-
Save benkn/c7bc90291662d3d9b2ee7280590d3574 to your computer and use it in GitHub Desktop.
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
public final class DateOperations { | |
/** | |
* Gets the Epoch seconds of the given LocalDateTime | |
* @return long of the seconds since the beginning of time (for Java) | |
*/ | |
public static long getLocalSeconds(LocalDateTime localDateTime) { | |
ZoneId zone = ZoneId.systemDefault(); | |
ZonedDateTime zdt = localDateTime.atZone(zone); | |
return zdt.toEpochSecond(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment