date-vir - v8.5.0
    Preparing search index...

    Function toDatePartStrings

    Splits a FullDate up into multiple formatted string representations.

    CAUTION: this does not user locale setting. Prefer toLocaleString whenever possible.

    This uses numbers for everything.

    import {toDatePartStrings, utcTimezone} from 'date-vir';

    let result = toDatePartStrings(
    {
    year: 2024,
    month: 4,
    day: 24,
    hour: 6,
    minute: 4,
    second: 9,
    millisecond: 123,
    timezone: utcTimezone,
    },
    {includeSeconds: true},
    );
    // outputs:
    result = {
    date: '2024-04-24',
    time: '06:04:09',
    timezone: 'UTC',
    };
    • Splits a FullDate up into multiple formatted string representations.

      CAUTION: this does not user locale setting. Prefer toLocaleString whenever possible.

      This uses numbers for everything.

      Parameters

      • fullDate: {
            day: DayOfMonth;
            hour: Hour;
            millisecond?: number | null;
            minute: Minute;
            month: MonthNumber;
            second: Minute;
            timezone: string;
            year: number;
        }
        • day: DayOfMonth

          A day of the month: 1-31 depending on the month

        • hour: Hour

          Hour of the day in 24 time: 0-23

        • Optionalmillisecond?: number | null

          Millisecond of the second: 0-999

        • minute: Minute

          Minute of the hour: 0-59

        • month: MonthNumber

          A month of the year: 1-12

        • second: Minute
        • timezone: string
        • year: number

          The full, four digit year.

          2023;
          
      • options: { includeSeconds: true }

      Returns {
          date: `${number}-${number}-${number}`;
          time: `${number}:${number}:${number}`;
          timezone: string;
      }

      import {toDatePartStrings, utcTimezone} from 'date-vir';

      let result = toDatePartStrings(
      {
      year: 2024,
      month: 4,
      day: 24,
      hour: 6,
      minute: 4,
      second: 9,
      millisecond: 123,
      timezone: utcTimezone,
      },
      {includeSeconds: true},
      );
      // outputs:
      result = {
      date: '2024-04-24',
      time: '06:04:09',
      timezone: 'UTC',
      };
    • Splits a FullDate up into multiple formatted string representations.

      CAUTION: this does not user locale setting. Prefer toLocaleString whenever possible.

      This uses numbers for everything.

      Parameters

      • fullDate: {
            day: DayOfMonth;
            hour: Hour;
            millisecond?: number | null;
            minute: Minute;
            month: MonthNumber;
            second?: Minute | null;
            timezone: string;
            year: number;
        }
        • day: DayOfMonth

          A day of the month: 1-31 depending on the month

        • hour: Hour

          Hour of the day in 24 time: 0-23

        • Optionalmillisecond?: number | null

          Millisecond of the second: 0-999

        • minute: Minute

          Minute of the hour: 0-59

        • month: MonthNumber

          A month of the year: 1-12

        • Optionalsecond?: Minute | null
        • timezone: string
        • year: number

          The full, four digit year.

          2023;
          
      • options: { includeSeconds: false }

      Returns {
          date: `${number}-${number}-${number}`;
          time: `${number}:${number}`;
          timezone: string;
      }

      import {toDatePartStrings, utcTimezone} from 'date-vir';

      let result = toDatePartStrings(
      {
      year: 2024,
      month: 4,
      day: 24,
      hour: 6,
      minute: 4,
      second: 9,
      millisecond: 123,
      timezone: utcTimezone,
      },
      {includeSeconds: true},
      );
      // outputs:
      result = {
      date: '2024-04-24',
      time: '06:04:09',
      timezone: 'UTC',
      };
    • Splits a FullDate up into multiple formatted string representations.

      CAUTION: this does not user locale setting. Prefer toLocaleString whenever possible.

      This uses numbers for everything.

      Parameters

      • fullDate: {
            day: DayOfMonth;
            hour: Hour;
            millisecond?: number | null;
            minute: Minute;
            month: MonthNumber;
            second: Minute;
            timezone: string;
            year: number;
        }
        • day: DayOfMonth

          A day of the month: 1-31 depending on the month

        • hour: Hour

          Hour of the day in 24 time: 0-23

        • Optionalmillisecond?: number | null

          Millisecond of the second: 0-999

        • minute: Minute

          Minute of the hour: 0-59

        • month: MonthNumber

          A month of the year: 1-12

        • second: Minute
        • timezone: string
        • year: number

          The full, four digit year.

          2023;
          
      • options: { includeSeconds: boolean }

      Returns {
          date: `${number}-${number}-${number}`;
          time: `${number}:${number}:${number}` | `${number}:${number}`;
          timezone: string;
      }

      import {toDatePartStrings, utcTimezone} from 'date-vir';

      let result = toDatePartStrings(
      {
      year: 2024,
      month: 4,
      day: 24,
      hour: 6,
      minute: 4,
      second: 9,
      millisecond: 123,
      timezone: utcTimezone,
      },
      {includeSeconds: true},
      );
      // outputs:
      result = {
      date: '2024-04-24',
      time: '06:04:09',
      timezone: 'UTC',
      };