package com.corewing.app.util;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtils {

    // 格式化LocalDateTime为字符串
    public static String format(Date time, String pattern) {
        if (time == null || pattern == null || pattern.isEmpty()) {
            return "";
        }
        // 创建SimpleDateFormat实例
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        // 格式化日期为字符串
        return sdf.format(time);
    }

}
