DateTime
Classluxon 的日期时间类,覆盖创建 / 格式化 / 加减 / 比较等绝大部分日期时间需求
Signature
class DateTime {
static now(): void
static local(): void
static utc(): void
static fromJSDate(): void
static fromMillis(): void
static fromSeconds(): void
static fromObject(): void
static fromISO(): void
static fromRFC2822(): void
static fromHTTP(): void
static fromFormat(): void
static fromString(): void
static fromSQL(): void
static invalid(): void
static isDateTime(): void
static parseFormatForOpts(): void
static expandFormat(): void
static min(): void
static max(): void
static fromFormatExplain(): void
static fromStringExplain(): void
static buildFormatParser(): void
static fromFormatParser(): void
get(): void
getPossibleOffsets(): void
resolvedLocaleOptions(): void
toUTC(): void
toLocal(): void
setZone(): void
reconfigure(): void
setLocale(): void
set(): void
plus(): void
minus(): void
startOf(): void
endOf(): void
toFormat(): void
toLocaleString(): void
toLocaleParts(): void
toISO(): void
toISODate(): void
toISOWeekDate(): void
toISOTime(): void
toRFC2822(): void
toHTTP(): void
toSQLDate(): void
toSQLTime(): void
toSQL(): void
toString(): void
valueOf(): void
toMillis(): void
toSeconds(): void
toUnixInteger(): void
toJSON(): void
toBSON(): void
toObject(): void
toJSDate(): void
diff(): void
diffNow(): void
until(): void
hasSame(): void
equals(): void
toRelative(): void
toRelativeCalendar(): void
}Methods
- get()
- getPossibleOffsets()
- resolvedLocaleOptions()
- toUTC()
- toLocal()
- setZone()
- reconfigure()
- setLocale()
- set()
- plus()
- minus()
- startOf()
- endOf()
- toFormat()
- toLocaleString()
- toLocaleParts()
- toISO()
- toISODate()
- toISOWeekDate()
- toISOTime()
- toRFC2822()
- toHTTP()
- toSQLDate()
- toSQLTime()
- toSQL()
- toString()
- valueOf()
- toMillis()
- toSeconds()
- toUnixInteger()
- toJSON()
- toBSON()
- toObject()
- toJSDate()
- diff()
- diffNow()
- until()
- hasSame()
- equals()
- toRelative()
- toRelativeCalendar()
- now() — static
- local() — static
- utc() — static
- fromJSDate() — static
- fromMillis() — static
- fromSeconds() — static
- fromObject() — static
- fromISO() — static
- fromRFC2822() — static
- fromHTTP() — static
- fromFormat() — static
- fromString() — static
- fromSQL() — static
- invalid() — static
- isDateTime() — static
- parseFormatForOpts() — static
- expandFormat() — static
- min() — static
- max() — static
- fromFormatExplain() — static
- fromStringExplain() — static
- buildFormatParser() — static
- fromFormatParser() — static
Examples
DateTime.now().toISO()
DateTime.fromISO('2024-01-01').plus({ days: 1 }).toFormat('yyyy-MM-dd')Source
node_modules/.pnpm/@types+luxon@3.7.5/node_modules/@types/luxon/src/datetime.d.ts:552