package com.ecep.contract.util;

import javafx.beans.property.SimpleObjectProperty;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

public class MyDateTimePropertyUtils {
    /**
     * 本地日期时间转换为时间戳
     * 
     * @param property
     * @return
     */
    public static Instant localDateTimeToInstant(SimpleObjectProperty<LocalDateTime> property) {
        LocalDateTime dateTime = property.get();
        if (dateTime != null) {
            return dateTime.toInstant(ZoneOffset.ofHours(8));
        }
        return null;
    }
}
