Datetime
ℹ️
Page is being worked on.
Functions
Classes
Functions
now
datetime.now(): DateTime
Returns
DateTime
- The current date and time.
parse
datetime.parse(date: string): DateTime
️⚠️
Can Error
Parse a string
- Supports ISO8601 format,
YYYY-MM-DDTHH:MM:SSZ
- Supports RFC3339 format,
YYYY-MM-DDTHH:MM:SS+00:00
- Supports RFC2822 format,
Day, DD Mon YYYY HH:MM:SS GMT
Parameters
date: string
- The string to parse.
Returns
DateTime
- The parsed date and time.
Throws
- If the date is invalid, an error will be thrown.
fromIsoDate
datetime.fromIsoDate(date: string): DateTime
️⚠️
Can Error
Parse a string in ISO8601 format, YYYY-MM-DDTHH:MM:SSZ
Parameters
date: string
- The string to parse.
Returns
DateTime
- The parsed date and time.
Throws
- If the date is invalid, an error will be thrown.
fromUnixTimestamp
datetime.fromUnixTimestamp(timestamp: number): DateTime
Parameters
timestamp: number
- The timestamp to convert.
Returns
DateTime
- The converted date and time.
fromUnixTimestampMillis
datetime.fromUnixTimestampMillis(timestamp: number): DateTime
Parameters
timestamp: number
- The timestamp to convert.
Returns
DateTime
- The converted date and time.
fromLocalTime
datetime.fromLocalTime(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): DateTime
Parameters
year: number
- The year.month: number
- The month.day: number
- The day.hour: number
- The hour.minute: number
- The minute.second: number
- The second.millisecond: number
- The millisecond.
Returns
DateTime
- The converted date and time.
fromUniversalTime
datetime.fromUniversalTime(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): DateTime
Parameters
year: number
- The year.month: number
- The month.day: number
- The day.hour: number
- The hour.minute: number
- The minute.second: number
- The second.millisecond: number
- The millisecond.
Returns
DateTime
- The converted date and time.
Classes
DateTime
Properties
Functions
- toLocalTime | ToLocalTime
- toUniversalTime | ToUniversalTime
- toIsoDate | ToIsoDate
- formatLocalTime | FormatLocalTime
- formatUniversalTime | FormatUniversalTime
DateTime.unixTimestamp
datetime.DateTime.unixTimestamp: number
datetime.DateTime.UnixTimestamp: number
DateTime.unixTimestampMillis
datetime.DateTime.unixTimestampMillis: number
datetime.DateTime.UnixTimestampMillis: number
DateTime.toLocalTime
datetime.DateTime:toLocalTime(): TimeDictionary
datetime.DateTime:ToLocalTime(): TimeDictionary
️⚠️
Can Error
Convert to local time and return a table
Returns
TimeDictionary
- The converted time.
Throws
- If datetime fails to convert, an error will be thrown.
DateTime.toUniversalTime
datetime.DateTime:toUniversalTime(): TimeDictionary
datetime.DateTime:ToUniversalTime(): TimeDictionary
️⚠️
Can Error
Convert to universal time and return a table
Returns
TimeDictionary
- The converted time.
Throws
- If datetime fails to convert, an error will be thrown.
DateTime.toIsoDate
datetime.DateTime:toIsoDate(): string
datetime.DateTime:ToIsoDate(): string
Convert to ISO8601 format, YYYY-MM-DDTHH:MM:SSZ
Returns
string
- The converted date.
DateTime.formatLocalTime
datetime.DateTime:formatLocalTime(format: string): string
datetime.DateTime:FormatLocalTime(format: string): string
️⚠️
Can Error
Format the time in local time from a string
Parameters
format: string
- The format to use.
Returns
string
- The formatted time.
Throws
- If datetime fails to convert, an error will be thrown.
- If out of memory, an error will be thrown.
DateTime.formatUniversalTime
datetime.DateTime:formatUniversalTime(format: string): string
datetime.DateTime:FormatUniversalTime(format: string): string
️⚠️
Can Error
Format the time in universal time from a string
Parameters
format: string
- The format to use.
Returns
string
- The formatted time.
Throws
- If datetime fails to convert, an error will be thrown.
- If out of memory, an error will be thrown.
Types
TimeDictionary
export type TimeDictionary = {
year : number,
month : number,
day : number,
hour : number,
minute : number,
second : number,
millisecond : number,
}