function clock
clock(): array

Retrieves the current date and time as a date vector.

Returns the current date and time as an array with the following elements: [year, month, day, hour, minute, seconds, milliseconds]. Note that the month is adjusted to be 1-based (January is 1, December is 12).

Examples

Example 1

import { assert } from "jsr:@std/assert";

// Example: Get the current date and time as a array
const currentTime = clock();

// The result should be an array
assert(Array.isArray(currentTime));

// The array should have 7 elements
assert(currentTime.length === 7);

Return Type

An array representing the current date and time: [year, month, day, hour, minute, seconds, milliseconds].

Usage

import clock from "datatype/clock.ts";