function today
today(): number

Gets the current date as a Unix timestamp.

Returns the Unix timestamp for the start of the current day (00:00:00).

Examples

Get the Unix timestamp for today's date

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

const todayTimestamp = today();
assertEquals(typeof todayTimestamp, 'number');
// Should match the start of today
assertEquals(todayTimestamp, dayjs().startOf('day').unix());

Return Type

number

The Unix timestamp for the current date.

Usage

import today from "datatype/today.ts";