Last active
August 29, 2015 13:57
-
-
Save sscovil/9642930 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 class DateTimeUtils { | |
public static final int SECONDS_IN_DAY = 86400; | |
public static long currentTimeInSecondsGMT() { | |
return System.currentTimeMillis()/1000; | |
} | |
public static long lastMidnightTimeInSecondsGMT() { | |
return (currentTimeInSecondsGMT() / SECONDS_IN_DAY) * SECONDS_IN_DAY; | |
} | |
public static long secondsSinceLastMidnightGMT() { | |
return currentTimeInSecondsGMT() % SECONDS_IN_DAY; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment