All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fartherp.shiro.LocalDateTimeUtilies Maven / Gradle / Ivy

/*
 * Copyright (c) 2019. CK. All rights reserved.
 */

package com.github.fartherp.shiro;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.function.Function;

/**
 * Created by IntelliJ IDEA.
 * Author: CK
 * Date: 2019/1/25
 */
public class LocalDateTimeUtilies {

    public static long getTimestamp(Function function) {
        return getTimestamp(LocalDateTime.now(), function);
    }

    public static long getTimestamp(LocalDateTime localDateTime, Function function) {
        return function.apply(localDateTime).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy