Skip to content

Instantly share code, notes, and snippets.

@seunggabi
Created November 26, 2019 06:01
Show Gist options
  • Save seunggabi/64ff2b076a1ef3df47c49011b965514c to your computer and use it in GitHub Desktop.
Save seunggabi/64ff2b076a1ef3df47c49011b965514c to your computer and use it in GitHub Desktop.
isNowBetweenTime.java
// if(DateUtils.isNowBetweenTime("2019-11-26 15:20:00.0", "2019-12-25 23:59:59.0")) {
public static boolean isNowBetweenTime(String start, String end) {
long now = System.currentTimeMillis();
long startTime = (start == null) ? now : Timestamp.valueOf(start).getTime();
long endTime = (end == null) ? now : Timestamp.valueOf(end).getTime();
return startTime <= now && now <= endTime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment