package com.atmob.voiceai.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class DateUtil {

    private DateUtil() {

    }


    public static String formatDuration(long duration) {
        long seconds = duration / 1000;
        long minutes = seconds / 60;
        seconds = seconds % 60;
        return String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds);
    }

    public static String formatNormalDate(String format, long timestamp) {
        if (timestamp == 0) {
            return "";
        }
        Date date = new Date(timestamp);
        SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.getDefault());
        return dateFormat.format(date);
    }

    public static String getUSTime(long timestamp) {
        //Apr 12,2024 10:10 AM
        SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy hh:mm a", Locale.US);
        return sdf.format(new Date(timestamp));

    }
}
