date
Syntax Format
date([timestamp])
Overview
The date
function provides a parsed date and time as a Lua table in the OS timezone. This function can be useful in scripts where data synchronization is performed and/or the exact date of a certain bar is needed.
Parameters
Parameter | Type | Purpose | Default State |
---|---|---|---|
timestamp | integer | A UNIX timestamp | Current bar open time |
Returns: lua table
with the following values:
{
year = 1998,
month = 9,
day = 16,
yday = 259,
wday = 4,
hour = 23,
min = 48,
sec = 10
}
Example
bar_date_time = date(1740574860) -- Wed Feb 26 2025 15:01:00