export function parseCreateTime()

in src/static/encoding.ts [63:92]


export function parseCreateTime(createtime) {
    // Convert microseconds to milliseconds for JavaScript Date
    const milliseconds = Math.floor(createtime / 1000);

    // Create Date object from timestamp
    const date = new Date(milliseconds);

    // Get date components
    const day = date.getUTCDate();
    const month = date.getUTCMonth();
    const year = date.getUTCFullYear();
    const hours = date.getUTCHours();
    const minutes = date.getUTCMinutes();
    const seconds = date.getUTCSeconds();

    // Array of month abbreviations
    const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

    // Format day with leading zero if needed
    const dayStr = day < 10 ? `0${day}` : `${day}`;

    // Format time components with leading zeros if needed
    const hoursStr = hours < 10 ? `0${hours}` : `${hours}`;
    const minutesStr = minutes < 10 ? `0${minutes}` : `${minutes}`;
    const secondsStr = seconds < 10 ? `0${seconds}` : `${seconds}`;

    // Construct the formatted date string
    return `${dayStr} ${months[month]} ${year} ${hoursStr}:${minutesStr}:${secondsStr} GMT`;
}