date helper

This commit is contained in:
Yazawazi 2022-04-27 06:12:35 +08:00 committed by GitHub
parent 383356deb0
commit 3ed20338ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}
}