convnum
    Preparing search index...

    Function formatDayString

    • Formats a day number (days since 1970-01-01) according to the specified format string. This function only works with date formats that include day components.

      Parameters

      • days: number

        Number of days since 1970-01-01 (1970-01-01 = 0, 1970-01-02 = 1, etc.)

      • format: string

        Format string for dates with day components (e.g., "Y-M1-D1", "D2.M2.Y", "Ms D1, Y")

      Returns string

      Formatted date string containing year, month, and day

      Error if the format string contains only year-month components or is invalid

      formatDayString(0, 'Y-M1-D1') // '1970-1-1'
      formatDayString(0, 'D2/M2/Y') // '01/01/1970'
      formatDayString(1, 'Y-M2-D2') // '1970-01-02'
      formatDayString(31, 'D1.M1.Y') // '1.2.1970'
      formatDayString(358, 'Ms D1, Y') // 'Dec 25, 1970'
      formatDayString(19723, 'Mf D1, Y') // 'December 25, 2023'