codetrix - v1.5.0
    Preparing search index...

    Function formatDate

    • Formats a date as a string in YYYY-MM-DD format (or custom separator).

      Parameters

      • date: Date

        The Date object to format.

      • separator: string = '-'

        Optional separator to use between year, month, and day (default: -).

      Returns string

      A formatted date string.

      formatDate(new Date(2025, 6, 23)); // '2025-07-23'
      formatDate(new Date(2025, 6, 23), '/'); // '2025/07/23'