Skip to content

Latest commit

 

History

History
239 lines (130 loc) · 4.94 KB

_time_.time.md

File metadata and controls

239 lines (130 loc) · 4.94 KB

stimeGlobals"Time"Time

Class: Time

A representation of time

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Time(root: Date): Time

Defined in Time.ts:10

Create a new Time instance

Parameters:

Name Type Description
root Date Native date to base the time on

Returns: Time

Properties

Private Readonly root

root: Date

Defined in Time.ts:10

var {Date} root Native date

Methods

format

format(format: string): string

Inherited from Formattable.format

Defined in Formattable.ts:32

Format the date into a string

example

time.format(':leadingDay:/:leadingMonth:/:fullYear:'); // 01/01/2020

Parameters:

Name Type Description
format string Format to turn the date into.

Returns: string

Formatted date


getDay

getDay(): number

Overrides Formattable.getDay

Defined in Time.ts:35

Get the day of the month

Returns: number

Day of the month


getDayOfWeek

getDayOfWeek(): number

Overrides Formattable.getDayOfWeek

Defined in Time.ts:83

Get day of week

Returns: number

0-6 / Sunday-Saturday


getHours

getHours(): number

Overrides Formattable.getHours

Defined in Time.ts:75

Get hours

Returns: number

Hours


getMinutes

getMinutes(): number

Overrides Formattable.getMinutes

Defined in Time.ts:67

Get minutes

Returns: number

Minutes


getMonth

getMonth(): number

Overrides Formattable.getMonth

Defined in Time.ts:43

Get the month number

Returns: number

Month number from 1 to 12


getSeconds

getSeconds(): number

Overrides Formattable.getSeconds

Defined in Time.ts:59

Get the seconds

Returns: number

Seconds


getYear

getYear(): number

Overrides Formattable.getYear

Defined in Time.ts:51

Get the year

Returns: number

4-digit representation of the year


toLocaleString

toLocaleString(locales: string, options: any): string

Overrides Formattable.toLocaleString

Defined in Time.ts:92

Get the time as a locale string

Parameters:

Name Type Description
locales string Locales to get the string for
options any

Returns: string


toTimestamp

toTimestamp(): number

Defined in Time.ts:27

Get unix timestamp representation

example const unixTimestamp = time.toTimestamp();

Returns: number

Unix timetamp