• Overview

    A shorthand function-object for DataAPITime. May be used anywhere when creating new DataAPITimes.

    See DataAPITime and its methods for information about input parameters, formats, functions, etc.

    Parameters

    • Rest ...params: [string] | [Date] | [number, number, number?, number?]

    Returns DataAPITime

    Example

    // equiv. to `new DataAPITime('12:34:56')`
    time('12:34:56')

    // equiv. to `new DataAPITime(12, 34)
    time(12, 34)

    // equiv. to `DataAPITime.now()`
    time.now()

Properties

now: ((this) => DataAPITime) = DataAPITime.now

Type declaration

    • (this): DataAPITime
    • Overview

      Returns the current time in the local timezone.

      Equivalent to new DataAPITime(new Date()).

      Parameters

      • this: void

      Returns DataAPITime

      The current time in the local timezone

      Example

      const now = time.now();
      // or
      const now = DataAPITime.now()
ofNanoOfDay: ((this, nanoOfDay) => DataAPITime) = DataAPITime.ofNanoOfDay

Type declaration

    • (this, nanoOfDay): DataAPITime
    • Overview

      Creates a DataAPITime from the number of nanoseconds since the start of the day .

      The number must be a positive integer in the range [0, 86,399,999,999,999].

      Parameters

      • this: void
      • nanoOfDay: number

        The number of nanoseconds since the start of the day

      Returns DataAPITime

      The DataAPITime representing the given number of nanoseconds

      Example

      DataAPITime.ofNanoOfDay(0) // '00:00:00.000000000'

      date.ofNanoOfDay(12_345_678_912_345) // '03:25:45.678912345'
ofSecondOfDay: ((this, secondOfDay) => DataAPITime) = DataAPITime.ofSecondOfDay

Type declaration

    • (this, secondOfDay): DataAPITime
    • Overview

      Creates a DataAPITime from the number of seconds since the start of the day.

      The number must be a positive integer in the range [0, 86,399].

      Parameters

      • this: void
      • secondOfDay: number

        The number of seconds since the start of the day

      Returns DataAPITime

      The DataAPITime representing the given number of seconds

      Example

      DataAPITime.ofSecondOfDay(0) // '00:00:00.000000000'

      DataAPITime.ofSecondOfDay(12_345) // '03:25:45.000000000'
utcnow: ((this) => DataAPITime) = DataAPITime.utcnow

Type declaration

    • (this): DataAPITime
    • Overview

      Returns the current time in UTC.

      Uses Date.now() under the hood.

      Parameters

      • this: void

      Returns DataAPITime

      The current time in UTC

      Example

      const now = time.utcnow();
      // or
      const now = DataAPITime.utcnow()