codetrix - v1.5.0
    Preparing search index...

    Function setTime

    • Sets the time (hour, minute, second, millisecond) of the given date and returns a new Date instance.

      Parameters

      • date: Date

        The original date.

      • hours: number = 0

        The hour to set (default: 0).

      • minutes: number = 0

        The minutes to set (default: 0).

      • seconds: number = 0

        The seconds to set (default: 0).

      • milliseconds: number = 0

        The milliseconds to set (default: 0).

      Returns Date

      A new Date with the updated time.

      setTime(new Date(), 10, 30); // → today at 10:30 AM