timestamp

Assembles a time from its parts - the other direction from the eight functions that take a time apart. The parts are read as a wall-clock time in the exchange’s own timezone, and the result is milliseconds from the Unix epoch, matching time and timenow. Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero.

timestamp(series int year, series int month, series int day, series int hour, series int minute, series int second) → series int
timestamp(simple int year, simple int month, simple int day, simple int hour, simple int minute, simple int second) → simple int
ParameterTypeRequiredDescription
yearseries intyesThe year. Required.
monthseries intyesThe month. Required.
dayseries intyesThe day of the month. Required.
hourseries intnoThe hour. Optional.
minuteseries intnoThe minute. Optional.
secondseries intnoThe second. Optional.

Returns series int or simple int — An int in the form the arguments were passed in - series int for the series form, simple int for the simple form - counting milliseconds from the Unix epoch.

indicator("A time built from its parts")
plot(timestamp(2024, 1, 1))

See also sessions and intervals

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade