Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
class TimeUtil
import { TimeUtil } from "https://deno.land/x/sptaki@1.2.0/utils/TimeUtil.d.ts";

Utility class to handle time related operations.

Methods

protected
pad(number: number): string

Pads a number with a leading zero if it is less than 10.

formatDate(date: Date): string

Formats the date part of a date as a UTC string.

formatTime(date: Date): string

Formats the time part of a date as a UTC string.

getDate(): string

Gets the current date as a formatted UTC string.

Gets the current date in UTC in a format suitable for emails in EFT.

getHoursAsSeconds(hours: number): number

Converts a number of hours into seconds.

getTime(): string

Gets the current time as a formatted UTC string.

Gets the current time in UTC in a format suitable for mail in EFT.

getTimestamp(): number

Gets the current timestamp in seconds in UTC.

Static Properties

readonly
ONE_HOUR_AS_SECONDS: number