DateHelper.java 560 Bytes
Newer Older
Yazawazi's avatar
Yazawazi committed
1
2
3
package emu.grasscutter.utils;

import java.util.Calendar;
4
import java.util.Date;
Yazawazi's avatar
Yazawazi committed
5
6

public final class DateHelper {
Yazawazi's avatar
Yazawazi committed
7
    public static Date onlyYearMonthDay(Date now) {
Yazawazi's avatar
Yazawazi committed
8
9
10
11
12
13
14
15
        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();
    }
16
17
18
19

	public static int getUnixTime(Date localDateTime){
		return (int)(localDateTime.getTime() / 1000L);
	}
Yazawazi's avatar
Yazawazi committed
20
}