Datetime
ℹ️
Page is being worked on.
Functions
Classes
Functions
now
datetime.now(): DateTimeReturns
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): DateTimeParameters
timestamp: number- The timestamp to convert.
Returns
DateTime- The converted date and time.
fromUnixTimestampMillis
datetime.fromUnixTimestampMillis(timestamp: number): DateTimeParameters
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): DateTimeParameters
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): DateTimeParameters
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: numberDateTime.unixTimestampMillis
datetime.DateTime.unixTimestampMillis: number
datetime.DateTime.UnixTimestampMillis: numberDateTime.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(): stringConvert 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,
}Last updated on