Skip to content

dayofmonth() - PineScript Function

Calculates the day number of the month, in a specified time zone, from a UNIX timestamp.

dayofmonth(time, timezone) → series int
NameTypeDescription
timeseries intUNIX timestamp (ms) to evaluate. Usually time or timestamptz.
timezoneconst stringOptional IANA timezone (e.g., "America/New_York"). Defaults to exchange timezone.

The calculated day of the month, expressed in the specified time zone.

  • Timestamps are evaluated in the specified timezone; passing syminfo.timezone ensures alignment with the chart’s exchange.
//@version=5
indicator("Day of month filter", overlay=true)
dom = dayofmonth(time, syminfo.timezone)
isFirstDay = dom == 1
bgcolor(isFirstDay ? color.new(color.blue, 85) : na)
plot(close, "Close")