lia.date
Date and time handling.
All of Lua's time functions are dependent on the Unix epoch, which means we can't have dates that go further than 1970. This
library remedies this problem. Time/date is represented by a date
object that is queried, instead of relying on the seconds
since the epoch.
Functions
GetFormattedDate(StartingMessage, includeWeekDay, includeDay, includeMonth, includeYear, includeTime)
Generates a formatted date string based on the current system time.
Parameters
-
StartingMessage
String
optional
A message to prepend to the formatted date.
-
includeWeekDay
Boolean
optional
Whether to include the day of the week in the formatted date.
-
includeDay
Boolean
optional
Whether to include the day of the month in the formatted date.
-
includeMonth
Boolean
optional
Whether to include the month in the formatted date.
-
includeYear
Boolean
optional
Whether to include the year in the formatted date.
-
includeTime
Boolean
optional
Whether to include the time in the formatted date.
Returns
-
any
string The formatted date string.
GetFormattedDateInGame(StartingMessage, includeWeekDay, includeDay, includeMonth, includeYear, includeTime)
Generates a formatted date string based on the current system time for in-game usage.
Parameters
-
StartingMessage
String
optional
A message to prepend to the formatted date.
-
includeWeekDay
Boolean
optional
Whether to include the day of the week in the formatted date.
-
includeDay
Boolean
optional
Whether to include the day of the month in the formatted date.
-
includeMonth
Boolean
optional
Whether to include the month in the formatted date.
-
includeYear
Boolean
optional
Whether to include the year in the formatted date.
-
includeTime
Boolean
optional
Whether to include the time in the formatted date.
Returns
-
any
string The formatted date string.
GetPreFormattedDate(StartingMessage, timeToFormat, includeWeekDay, includeDay, includeMonth, includeYear, includeTime)
Generates a pre-formatted date string based on the provided time.
Parameters
-
StartingMessage
String
optional
A message to prepend to the formatted date.
-
timeToFormat
Table
The time to format.
-
includeWeekDay
Boolean
optional
Whether to include the day of the week in the formatted date.
-
includeDay
Boolean
optional
Whether to include the day of the month in the formatted date.
-
includeMonth
Boolean
optional
Whether to include the month in the formatted date.
-
includeYear
Boolean
optional
Whether to include the year in the formatted date.
-
includeTime
Boolean
optional
Whether to include the time in the formatted date.
Returns
-
any
string The formatted date string.
GetPreFormattedDateInGame(StartingMessage, timeToFormat, includeWeekDay, includeDay, includeMonth, includeYear, includeTime)
Generates a pre-formatted date string based on the provided time for in-game usage.
Parameters
-
StartingMessage
String
optional
A message to prepend to the formatted date.
-
timeToFormat
Table
The time to format.
-
includeWeekDay
Boolean
optional
Whether to include the day of the week in the formatted date.
-
includeDay
Boolean
optional
Whether to include the day of the month in the formatted date.
-
includeMonth
Boolean
optional
Whether to include the month in the formatted date.
-
includeYear
Boolean
optional
Whether to include the year in the formatted date.
-
includeTime
Boolean
optional
Whether to include the time in the formatted date.
Returns
-
any
string The formatted date string.
toNumber(str)
Converts a date string to a table containing date and time components.
Parameters
-
str
String
The date string in the format "YYYY-MM-DD HH:MM:SS"
Returns
-
table
Table containing date and time components