Skip to main content

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

ParameterTypePurposeDefault State
timestampintegerA UNIX timestampCurrent 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