package com.zjty.inspect.utils;

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

public class TimeUtil {
    public static String getNowDate(){
        StringBuilder stringBuilder = new StringBuilder();
        String uuid = UUIDUtil.getUUID();
        String[] split = uuid.split("-");
        LocalDateTime date = LocalDateTime.now();
        stringBuilder.append(date.getYear())
                .append(date.getMonth())
                .append(date.getDayOfMonth())
                .append(date.getHour() )
                .append(date.getMinute())
                .append(date.getSecond())
                .append(split[0]);

        return stringBuilder.toString();

    }
    public static String getTime(){
        Date d = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println("当前时间：" + sdf.format(d));
        return sdf.format(d);
    }
    public static void main(String[] args) {
        String nowDate = TimeUtil.getNowDate();
        System.out.println(getTime());
    }
}
