dayofmonth() - PineScript Function
dayofmonth()
Section titled “dayofmonth()”Overview
Section titled “Overview”Calculates the day number of the month, in a specified time zone, from a UNIX timestamp.
Syntax
Section titled “Syntax”dayofmonth(time, timezone) → series intParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
time | series int | UNIX timestamp (ms) to evaluate. Usually time or timestamptz. |
timezone | const string | Optional IANA timezone (e.g., "America/New_York"). Defaults to exchange timezone. |
Returns
Section titled “Returns”The calculated day of the month, expressed in the specified time zone.
Remarks
Section titled “Remarks”- Timestamps are evaluated in the specified timezone; passing
syminfo.timezoneensures alignment with the chart’s exchange.
Examples
Section titled “Examples”//@version=5indicator("Day of month filter", overlay=true)
dom = dayofmonth(time, syminfo.timezone)
isFirstDay = dom == 1bgcolor(isFirstDay ? color.new(color.blue, 85) : na)plot(close, "Close")