From 3ed20338ed411a2a3a4e0d8fe114ce4e32fd6e74 Mon Sep 17 00:00:00 2001 From: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Date: Wed, 27 Apr 2022 06:12:35 +0800 Subject: [PATCH] date helper --- .../java/emu/grasscutter/utils/DateHelper.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/java/emu/grasscutter/utils/DateHelper.java diff --git a/src/main/java/emu/grasscutter/utils/DateHelper.java b/src/main/java/emu/grasscutter/utils/DateHelper.java new file mode 100644 index 000000000..5e5e4df03 --- /dev/null +++ b/src/main/java/emu/grasscutter/utils/DateHelper.java @@ -0,0 +1,16 @@ +package emu.grasscutter.utils; + +import java.util.Date; +import java.util.Calendar; + +public final class DateHelper { + public static Date onlyYDM(Date now) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(now); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } +}