package com.ms.biz.tool;

import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TimeTool {
    public static String getDateTimeBySeconds(int seconds) {
        String currentTime = DateUtil.now();
        // 将当前时间转换为Date类型
        java.util.Date date = DateUtil.parseDateTime(currentTime);
        // 将当前时间减去x秒
        java.util.Date newDate = DateUtil.offsetSecond(date, seconds);
        return DateUtil.formatDateTime(newDate);
    }
}
