package com.fzm.mall.server.front.util;

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//


import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;

public class TimeUtil {
    private static final DateTimeFormatter YMD_HMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    private static final DateTimeFormatter YMDHMS = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
    private static final DateTimeFormatter YMD = DateTimeFormatter.ofPattern("yyyy-MM-dd");

    public TimeUtil() {
    }

    public static long timestamp() {
        return LocalDateTime.now(ZoneOffset.UTC).toEpochSecond(ZoneOffset.UTC);
    }

    public static String formatTime() {
        return LocalDateTime.now(ZoneId.of((String)ZoneId.SHORT_IDS.get("CTT"))).format(YMD_HMS);
    }

    public static String formatTime2() {
        return LocalDateTime.now(ZoneId.of((String)ZoneId.SHORT_IDS.get("CTT"))).format(YMDHMS);
    }

    public static String formatTime3() {
        return LocalDateTime.now(ZoneId.of((String)ZoneId.SHORT_IDS.get("CTT"))).format(YMD);
    }

    public static long date2TimeStamp(String targetTime) {
        try {
            LocalDateTime target = LocalDateTime.parse(targetTime, YMD_HMS);
            return target.toEpochSecond(ZoneOffset.of("+8"));
        } catch (Exception var3) {
            return 0L;
        }
    }

    public static long date2TimeStamp2(String targetTime) {
        try {
            LocalDate target = LocalDate.parse(targetTime, YMDHMS);
            return target.atStartOfDay().toEpochSecond(ZoneOffset.of("+8"));
        } catch (Exception var3) {
            return 0L;
        }
    }

    public static long date2TimeStamp3(String targetTime) {
        try {
            LocalDate target = LocalDate.parse(targetTime, YMD);
            return target.atStartOfDay().toEpochSecond(ZoneOffset.of("+8"));
        } catch (Exception var3) {
            return 0L;
        }
    }

    public static String timeStamp2date(Long targetTime) {
        return YMD_HMS.format(LocalDateTime.ofInstant(Instant.ofEpochSecond(targetTime), ZoneId.of((String)ZoneId.SHORT_IDS.get("CTT"))));
    }

    public static String timeStamp2date2(Long targetTime) {
        return YMDHMS.format(LocalDateTime.ofInstant(Instant.ofEpochSecond(targetTime), ZoneId.of((String)ZoneId.SHORT_IDS.get("CTT"))));
    }

    public static String timeStamp2date3(Long targetTime) {
        return YMD.format(LocalDateTime.ofInstant(Instant.ofEpochSecond(targetTime), ZoneId.of((String)ZoneId.SHORT_IDS.get("CTT"))));
    }
}
