MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / isSameDay

Method isSameDay

Utils/src/eu/the5zig/util/Utils.java:311–319  ·  view source on GitHub ↗

Checks if both times are still the same day. @param millis1 The first time in milliseconds. @param millis2 The second time in milliseconds. @return if both times are still the same day.

(long millis1, long millis2)

Source from the content-addressed store, hash-verified

309 * @return if both times are still the same day.
310 */
311 public static boolean isSameDay(long millis1, long millis2) {
312 Date dateTime1 = new Date(millis1);
313 Date dateTime2 = new Date(millis2);
314 Calendar calendar1 = Calendar.getInstance();
315 calendar1.setTime(dateTime1);
316 Calendar calendar2 = Calendar.getInstance();
317 calendar2.setTime(dateTime2);
318 return calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar1.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR);
319 }
320
321 /**
322 * Creates a String in HH:MM:SS-Format for showing time.

Callers 2

checkNewDayMethod · 0.95
checkNewDayMethod · 0.95

Calls 3

setTimeMethod · 0.80
getMethod · 0.65
getInstanceMethod · 0.45

Tested by

no test coverage detected