package examples.utils;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;

public class DateTimeUtil {

    public static int getHourByTimestamp(long timestamp) {
        return LocalDateTime
                .ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.systemDefault())
                .getHour();
    }

    public static int getDayOrWeekByTimestamp(long timestamp) {
        return LocalDateTime
                .ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.systemDefault())
                .getDayOfWeek()
                .getValue();
    }
}

