Timestamps
Provides utility functions for working with date, time, and UNIX timestamps.
Accessing the Module
Server
get_timestamp()
Gets the current UNIX timestamp and its formatted string.
Returns
timestamp
number
Current UNIX timestamp
formatted
string
Formatted date-time string
Example
convert_timestamp(timestamp)
Converts a UNIX timestamp to a readable date and time.
Parameters
timestamp
number
UNIX timestamp to convert
Returns
date
string
Date in YYYY-MM-DD
time
string
Time in HH:MM:SS
both
string
Full datetime string
Example
get_current_date_time()
Gets the current full date and time information.
Returns
timestamp
number
UNIX timestamp
date
string
YYYY-MM-DD
time
string
HH:MM:SS
both
string
Full formatted string
Example
add_days_to_date(date, days)
Adds days to a given date.
Parameters
date
string
Base date in YYYY-MM-DD
days
number
Number of days to add
Returns
string
New date in YYYY-MM-DD
Example
date_difference(start_date, end_date)
Calculates the number of days between two dates.
Parameters
start_date
string
Start date YYYY-MM-DD
end_date
string
End date YYYY-MM-DD
Returns
days
number
Absolute difference in days
Example
convert_timestamp_ms(timestamp_ms)
Converts a millisecond-based UNIX timestamp to human-readable format.
Parameters
timestamp_ms
number
UNIX timestamp in milliseconds
Returns
date
string
YYYY-MM-DD
time
string
HH:MM:SS
both
string
Full formatted string
Example
Last updated