• Converts the passed in timestamp into formatted date and time strings that match the configured date and time formats or the passed in format string.

    Returns

    If no format string is provided an object with the date and time formatted strings, as set in the configuration, will be returned. If a format is provided then a formatted string will be returned.

    Examples

    // Assuming that the default date and time formats are in place
    // Date: Full Month Name Day, Year
    // Time: 24Hour:Minute:Second

    SimpleCalendar.api.formatTimestamp(1640434394);
    // Returns {date: 'December 25, 2021', time: '12:13:14'}

    SimpleCalendar.api.formatTimestamp(1640434394,"DD/MM/YYYY HH:mm:ss A");
    // Returns '25/12/2021 12:13:14 PM'

    Parameters

    • timestamp: number

      The timestamp (in seconds) of the date to format.

    • format: string = ''

      Optional format string to return custom formats for the passed in date and time.

    • calendarId: string = 'active'

      Optional parameter to specify the ID of the calendar to use when converting a date to a formatted string. If not provided the current active calendar will be used.

    Returns string | {
        date: string;
        time: string;
    }