Function getTimestamp

  • Parameters

    Returns string

    Default usage with current UTC date
    const formattedDate = getTimestamp(); // "2024-09-26-15-30-45"
    Custom separator
    const formattedDate = getTimestamp({ separator: '/' }); // "2024/09/26/15/30/45"
    Custom date with only year, month, and day
    const formattedDate = getTimestamp({ date: new Date('2023-12-01T08:22:33Z'), includeHours: false, includeMinutes: false, includeSeconds: false }); // "2023-12-01"
    Custom date with only hours, minutes, and seconds
    const formattedDate = getTimestamp({ date: new Date('2023-12-01T08:22:33Z'), includeYear: false, includeMonth: false, includeDay: false }); // "08-22-33"