-
Notifications
You must be signed in to change notification settings - Fork 0
Task Index
The same exports as API Index, grouped by the question you arrived with rather than by name. Two indexes for two ways of remembering things.
-
DateTime.to_unixThe Unix timestamp this DateTime denotes, using the offset it carries. -
DateTime.weekdayThe weekday of this date, computed from the calendar on every call. -
date_to_unixConvert a civil date-time to a Unix timestamp. -
date_to_weekdayDay of week for a civil date, derived from the same civil algorithm as every other function here. -
days_from_civilDays elapsed from 1970-01-01 to a civil date. -
days_in_monthNumber of days in a given month. -
days_in_yearNumber of days in a given year. -
is_leap_yearWhether a year is a leap year in the proleptic Gregorian calendar. -
is_valid_dateWhether a civil moment exists, without raising. -
new_datetimeBuild a DateTime from civil fields. -
unix_to_dateConvert a Unix timestamp to a civil date-time.
-
Weekday.to_intNumeric code for a weekday, 0 = Sunday through 6 = Saturday. -
Weekday.to_iso_dowISO-8601 numbering for this weekday, 1 = Monday through 7 = Sunday. -
weekday_from_intWeekday for a numeric code, 0 = Sunday through 6 = Saturday. -
Weekday.minusThe weekday n days earlier in the weekly cycle, wrapping. -
Weekday.plusThe weekday n days later in the weekly cycle, wrapping.
-
Weekday.days_untilForward distance in days from this weekday to another, never negative. -
nth_weekday_of_monthDay of month of the nth given weekday, following java.time's dayOfWeekInMonth semantics.
-
DateTime.day_of_yearDay of the year, 1 for 1 January. -
DateTime.iso_weekISO-8601 week number. -
DateTime.iso_week_yearISO-8601 week-based year, which is not always the calendar year: 2027-01-01 belongs to week-year 2026. -
DateTime.week_of_monthWhich week-row of its month this date falls in, where week 1 is the possibly-partial week containing the 1st. -
DateTime.weekday_ordinal_in_monthWhich occurrence of its own weekday this date is within its month: the 3rd Friday answers 3. -
date_from_day_of_yearCivil date for an ordinal day of the year. -
date_from_iso_weekCivil date for an ISO-8601 week date. -
quarterCalendar quarter containing a month, or the fiscal quarter, when the fiscal year begins in some other month.
-
DateTime.minus_daysSubtract whole calendar days, preserving wall-clock time of day. -
DateTime.minus_monthsSubtract whole calendar months, with plus_months' clamping rule: 31 March minus one month is 28 or 29 February. -
DateTime.minus_weeksSubtract whole calendar weeks, preserving wall-clock time of day. -
DateTime.minus_yearsSubtract whole calendar years, with the same clamping rule: 29 February minus one year is 28 February. -
DateTime.plus_daysAdd whole calendar days, preserving wall-clock time of day. -
DateTime.plus_monthsAdd whole calendar months, following java.time: the day of month is clamped to the length of the target month, so 31 January plus one month is 28 or 29 February. -
DateTime.plus_periodAdd a Period. -
DateTime.plus_weeksAdd whole calendar weeks, preserving wall-clock time of day. -
DateTime.plus_yearsAdd whole calendar years, with the same clamping rule as plus_months: 29 February plus one year is 28 February.
-
DateTime.minus_hoursSubtract hours from the instant. -
DateTime.minus_minutesSubtract minutes from the instant. -
DateTime.minus_msSubtract milliseconds from the instant. -
DateTime.minus_secondsSubtract seconds from the instant. -
DateTime.plus_hoursAdd hours to the instant. -
DateTime.plus_minutesAdd minutes to the instant. -
DateTime.plus_msAdd milliseconds to the instant. -
DateTime.plus_secondsAdd seconds to the instant.
-
DateTime.days_betweenWhole calendar days from this date to another, ignoring time of day. -
DateTime.months_betweenWhole calendar months from this date to another, in the sense of java.time's ChronoUnit.MONTHS.between: a partial month does not count. -
DateTime.period_betweenThe Period between two dates, following java.time's Period.between: whole months first, then the day remainder, with years and months truncated toward zero so every component carries the same sign.
-
DateTime.compareCompare two date-times as instants, so differing offsets compare correctly. -
DateTime.earlierThe earlier of two date-times, as instants. -
DateTime.is_afterWhether this date-time is strictly later than another, as instants. -
DateTime.is_beforeWhether this date-time is strictly earlier than another, as instants. -
DateTime.laterThe later of two date-times, as instants.
-
DateTime.end_ofThe last instant of the unit containing this date-time, i.e. one millisecond before the next unit begins. -
DateTime.round_toRound this date-time to a unit boundary. -
DateTime.start_ofThe first instant of the unit containing this date-time.
-
DateTime.next_or_same_weekdayThis date when it already falls on the given weekday, otherwise the nearest one after it that does, java.time's TemporalAdjusters.nextOrSame, and the natural spelling of "the coming Friday... -
DateTime.next_weekdayThe nearest date strictly after this one that falls on the given weekday, java.time's TemporalAdjusters.next. -
DateTime.previous_weekdayThe nearest date strictly before this one that falls on the given weekday, java.time's TemporalAdjusters.previous. -
DateTime.with_dateA copy with the date replaced and the time of day kept. -
DateTime.with_dayA copy with the day of month replaced. -
DateTime.with_day_of_yearA copy moved to a given ordinal day of the year, keeping the time of day. -
DateTime.with_hourA copy with the hour replaced. -
DateTime.with_minuteA copy with the minute replaced. -
DateTime.with_monthA copy with the month replaced, clamping the day into the new month. -
DateTime.with_msA copy with the millisecond replaced. -
DateTime.with_offsetA copy expressed in a different fixed offset, keeping the civil fields and therefore changing the instant. -
DateTime.with_secondA copy with the second replaced. -
DateTime.with_timeA copy with the time of day replaced and the date kept. -
DateTime.with_weekdayA copy moved to a given weekday within the same week, where the week begins on week_start. -
DateTime.with_yearA copy with the year replaced.
-
DateTime.clamp_toThis instant confined to a range: lo when earlier than lo, hi when later than hi, otherwise itself. -
DateTime.is_betweenWhether this instant falls in the half-open span [lo, hi). -
DateTime.is_leapWhether this date's year is a leap year. -
DateTime.is_month_endWhether this is the last day of its month. -
DateTime.is_month_startWhether this is the first day of its month. -
DateTime.is_quarter_endWhether this is the last day of its quarter. -
DateTime.is_quarter_startWhether this is the first day of its quarter. -
DateTime.is_weekdayWhether this date falls Monday to Friday. -
DateTime.is_weekendWhether this date falls on a Saturday or Sunday. -
DateTime.is_year_endWhether this is 31 December. -
DateTime.is_year_startWhether this is 1 January. -
DateTime.length_of_monthNumber of days in this date's month. -
DateTime.length_of_yearNumber of days in this date's year. -
DateTime.untilThe whole number of units from this date-time to another, the generic form of days_between and months_between, so a unit can be chosen at runtime.
-
epochThe Unix epoch, 1970-01-01T00:00:00Z. -
nowThe current moment, in a zone. -
todayThe current date at true local midnight in a zone, meaning the record's own to_unix() is the instant that midnight actually happened. -
try_new_datetimeBuild a DateTime, returning na instead of raising when the fields do not describe a real moment.
-
Zone.is_ambiguousWhether a local civil time happened twice, because a fall-back transition repeated it. -
Zone.is_gapWhether a local civil time never happened, because a spring-forward transition skipped over it. -
Zone.ruleThe daylight-saving rule in force for a zone in a given year. -
Zone.rules_fromThe first year from which a zone's rules are modelled exactly. -
Zone.std_offsetThe standard, i.e. winter, offset of a zone in hours. -
Zone.to_unixConvert a local civil time in this zone to an instant, resolving gaps and overlaps explicitly rather than silently. -
changedWhether a unit boundary in a zone falls between two instants: the "is this a new day?" test, answered against a real calendar instead of the chart's own session grid. -
dst_endThe instant daylight saving ends in a zone in a year. -
dst_startThe instant daylight saving begins in a zone in a year. -
is_dstWhether daylight saving is in force in a zone at an instant. -
offset_atOffset from UTC in force in a zone at an instant, daylight saving applied. -
offset_at_ruleOffset in force at an instant under an arbitrary rule. -
unix_to_date_zoneConvert an instant to civil time in a zone, daylight saving applied.
-
DateTime.to_zone_same_instantThe same moment expressed in another zone. -
DateTime.to_zone_same_localThe same wall clock reinterpreted in another zone, which denotes a different moment.
-
easter_sundayEaster Sunday, by the anonymous Gregorian computus (Meeus / Jones / Butcher). -
good_fridayGood Friday, the Friday before Easter Sunday.
-
DateTime.minus_periodSubtract a Period from a DateTime. -
Period.equalsWhether two periods have identical fields. -
Period.is_negativeWhether any field of this period is negative. -
Period.is_zeroWhether every field of this period is zero. -
Period.minusThe difference of two periods, field by field. -
Period.multiplied_byThis period with every field scaled. -
Period.negatedThis period with every field's sign flipped. -
Period.normalizedThis period with surplus months folded into years, as java.time's Period.normalized: 1 year 15 months becomes 2 years 3 months. -
Period.plusThe sum of two periods, field by field. -
Period.to_isoThis period in ISO-8601 form, e.g. "P1Y2M3D". -
Period.to_total_monthsThe years and months of this period expressed as a month count. -
parse_iso_periodParse an ISO-8601 period such as "P1Y2M3D", "P3M", "P1W", "-P10D" or "P-1Y-2M-3D".
-
Interval.containsWhether an instant falls inside this interval. -
Interval.overlapsWhether two intervals share any instant. -
Interval.abutsWhether two intervals meet exactly end to start without overlapping: the condition under which they can be joined into one without a hole or a double count. -
Interval.durationThe length of this interval in milliseconds. -
Interval.enclosesWhether this interval wholly contains another. -
Interval.equalsWhether two intervals have identical endpoints. -
Interval.gapThe empty span between two intervals that neither overlap nor touch. -
Interval.intersectionThe overlapping part of two intervals. -
Interval.is_emptyWhether this interval contains no instants at all. -
merge_intervalsThe union of a set of intervals: overlapping or exactly abutting spans are joined and empty ones are dropped, so the result is the instants the inputs cover... -
new_intervalBuild an interval from two instants, ordering them so the result is never reversed. -
sort_intervalsSort an array of intervals in place by start, ties by end, and return the same array so a call can chain.
-
DateTime.closed_for_holidayWhether an exchange is shut for a holiday, as a three-valued answer that says so when the question falls outside the calendar's range. -
DateTime.holiday_nameThe name of the holiday or closure shutting an exchange on a date. -
DateTime.is_holidayWhether an exchange is closed for a scheduled holiday. -
DateTime.is_trading_dayWhether an exchange holds a regular session on a date: not a weekend, not a scheduled holiday. -
Exchange.calendar_fromThe first year an exchange's calendar answers exactly. -
Exchange.calendar_throughThe last year an exchange's calendar answers exactly, or na when its rules extrapolate without a horizon. -
Exchange.zoneThe zone an exchange's local session times are quoted in. -
next_holiday_afterThe next date an exchange is closed for a holiday, strictly after the date an instant falls on in that exchange's zone.
-
DateTime.adjustedRoll a date onto a trading day using an ISDA business-day convention. -
DateTime.minus_trading_daysMove backward a number of trading days. -
DateTime.next_trading_dayThe next trading day strictly after a date, skipping weekends and scheduled holidays. -
DateTime.plus_trading_daysMove forward or backward a number of trading days, skipping weekends and holidays. -
DateTime.prev_trading_dayThe previous trading day strictly before a date. -
DateTime.trading_day_of_monthThe ordinal of a date among its month's trading days: 1 on the month's first trading day, trading_days_in_month on its last. -
DateTime.trading_days_betweenCount of trading days between two dates. -
DateTime.weekdays_betweenCount of weekdays (Monday through Friday) between two dates, closed form: no loop and no calendar. -
first_trading_day_of_monthThe first trading day of a month. -
last_trading_day_of_monthThe last trading day of a month. -
trading_days_in_monthHow many trading days a month holds.
-
day_count_daysThe whole-day count a convention measures between two instants: the numerator year_fraction divides, exposed because for the 30/360 family it is not recoverable from the fraction alone. -
year_fractionYear fraction between two instants under a day-count convention.
-
DateTime.is_expiry_dayWhether a date is an expiry of a given cycle. -
DateTime.is_triple_witchingWhether a date is a quarterly expiry, when index futures, index options and equity options all expire together. -
DateTime.weekly_expiryThe expiry of the weekly contract covering a date: that week's Friday, rolled back to the previous trading day when the Friday does not trade. -
ExpiryKindA listed expiry cycle. -
expiries_betweenEvery expiry of a cycle whose date falls in a span. -
next_expiry_afterThe next expiry of a close-settled cycle strictly after an instant. -
next_vix_settlement_afterThe instant of the next VIX final settlement strictly after a given one. -
parse_tenorParse a tenor string such as "1D", "2W", "3M" or "1Y" into a Period. -
quarterly_expiryUnix timestamp of a quarterly expiry. -
vix_settlementUnix timestamp of a VIX final settlement: the Special Opening Quotation moment, when Cboe's opening auction in the constituent SPX series prints the settlement value. -
vix_settlement_dayVIX final settlement day for a contract month: the Wednesday thirty days before the following month's third Friday...
-
SessionA recurring local-time window, resolved against a calendar. -
Session.bars_per_sessionHow many chart bars of a given timeframe this session holds on a date, counting a clipped final bar as a bar. -
Session.boundsThe instants this session occupies on a given start date, or na when it does not run that day. -
Session.break_boundsThe intraday break inside this session's window on a given start date. -
Session.crosses_midnightWhether this session's window crosses local midnight. -
Session.is_first_barWhether a bar is the first bar of this session. -
Session.is_last_barWhether a bar is the last bar of this session, answered on that bar, not one bar later. -
Session.is_openWhether this session is trading at an instant. -
Session.length_minutesThe nominal length of this session in minutes, before any half-day adjustment. -
Session.progressHow far through this session's envelope an instant sits. -
Session.time_to_closeMilliseconds until this session's envelope closes. -
Session.time_to_openMilliseconds until this session's next open, strictly after the given instant. -
Session.to_specThis session as a TradingView-style string, e.g. "0930-1600:23456", or "0900-1130,1230-1530:23456" when the session breaks for lunch. -
Session.window_afterThe next window of this session that opens strictly after an instant: the upcoming-next window. -
Session.window_atThe session window containing an instant, if any. -
Session.window_beforeThe most recent window of this session that has already ended at an instant: the completed-previous window. -
Session.window_of_barThe session window a bar touches, which is not the window that contains one of the bar's edges. -
Session.windows_betweenEvery window of this session that intersects a span, in ascending order. -
SessionIdStandard trading sessions, ready to use. -
day_maskThe weekday bitmask for a contiguous run of days, from one weekday through another inclusive, wrapping past Saturday if it has to. -
new_sessionBuild a custom session. -
parse_sessionParse a TradingView-style session string such as "0930-1600" or "0930-1600:23456", where the digits after the colon are weekdays with 1 meaning Sunday. -
session_ofOne of the built-in standard sessions.
-
DateTime.fomc_dayWhether a date falls on either day of a scheduled FOMC meeting. -
DateTime.fomc_decision_dayWhether a date is the second day of an FOMC meeting, when the statement is released. -
Known.is_yesCollapse a three-valued answer to a bool, treating UNKNOWN as false. -
fomc_known_fromThe first year for which the FOMC meeting table is known. -
fomc_known_throughThe last year for which the FOMC meeting table is known. -
next_fomc_afterThe instant of the next FOMC decision strictly after a given one. -
russell_rebalance_dayFTSE Russell annual reconstitution: the last Friday in June, one of the highest-volume closes of the year.
-
DateTime.to_isoFormat a DateTime as a full ISO-8601 date-time with its offset designator: the form that survives a round trip, so parse_iso(d.to_iso()) gives back d. -
DateTime.to_iso_dateFormat a DateTime as an ISO-8601 date only. -
DateTime.to_iso_localFormat a DateTime as an ISO-8601 date-time string without the offset designator, i.e. as a local wall-clock reading. -
DateTime.to_iso_ordinal_dateFormat a DateTime as an ISO-8601 ordinal date. -
DateTime.to_iso_timeFormat a DateTime as an ISO-8601 time only. -
DateTime.to_iso_week_dateFormat a DateTime as an ISO-8601 week date. -
Interval.to_isoThis interval in ISO-8601 interval form, "start/end", with both endpoints in UTC. -
Weekday.abbrThe three-letter English abbreviation of a weekday. -
Weekday.nameThe English name of a weekday. -
Zone.to_ianaThe IANA identifier for a zone, e.g. "America/New_York". -
format_iso_durationA span of milliseconds in ISO-8601 duration form, e.g. "P2DT4H13M9S". -
format_ixdtfFormat an instant in the RFC 9557 extended format, which appends the zone in brackets so the reader knows which rules produced the offset. -
format_yymmddFormat a timestamp as the six-character yyMMdd date fragment used by OPRA-style option symbols, resolved in a zone you name rather than in the chart's... -
month_abbrThe three-letter English abbreviation of a month. -
month_nameThe English name of a month. -
DateTime.formatFormat this date-time with a pattern. -
format_timeFormat an instant in a zone.
-
parse_isoParse an ISO-8601 date-time. -
parse_iso_durationParse an ISO-8601 duration such as "P2DT4H13M9S", "PT1.5S" or "-PT10M" (the form format_iso_duration emits) into exact milliseconds, round-tripping everything that formatter can produce.
-
Weekday.to_pine_dowThis weekday in Pine's own numbering, where Sunday is 1, the scale used by the dayofweek.* constants and returned by the dayofweek built-in. -
format_durationFormat a span of milliseconds as a human-readable duration, largest unit first. -
format_relativeAn instant described relative to another, the way a human says it: "3d 4h ago" for the past, "in 2h 15m" for the future, "now" within a second either way. -
month_from_nameThe month number for an English month name or three-letter abbreviation, case-insensitive. -
weekday_from_nameThe Weekday for an English day name or three-letter abbreviation, case-insensitive. -
weekday_from_pine_dowThe Weekday for a value from Pine's dayofweek built-in or the dayofweek.* constants, where Sunday is 1. -
zone_from_ianaThe Zone for an IANA identifier, so a string from syminfo.timezone or a user input can be turned into something the rule engine understands. -
zone_offset_stringThe offset in force in a zone at an instant, spelled the way Pine's timezone arguments accept it.
-
BusinessDayISDA business-day conventions: how to roll a date that lands on a non-trading day. -
DateTimeA civil date-time held together with the fixed UTC offset it is expressed in. -
DateTime.equalsWhether two date-times denote the same civil fields and the same offset. -
DateTime.is_early_closeWhether an exchange closes early on a date. -
DateTime.normalizedA copy of this DateTime with the day clamped into the length of its month. -
DateTime.same_instantWhether two date-times are the same instant, regardless of the offset each is expressed in. -
DateTime.session_closeThe instant an exchange's session closes on a date, accounting for early closes. -
DateTime.session_openThe instant an exchange's session opens on a date. -
DayCountDay-count conventions, per the ISDA 2006 Definitions. -
DstRuleA daylight-saving rule, expressed as data so that adding a zone to the Zone enum is a constant rather than a new code path. -
ExchangeAn exchange calendar. -
IntervalA half-open span of instants, [FromMS, ToMS). -
KnownA three-valued answer, for questions a dated table or a bounded calendar cannot answer outside its window. -
OverflowWhat to do when calendar arithmetic lands on a day that does not exist, e.g. 31 January plus one month. -
PeriodA calendar-flavoured amount of time, in the sense of java.time's Period. -
ResolverHow to resolve a local time that a daylight-saving transition made impossible or ambiguous. -
RoundModeHow to round a date-time to a unit boundary. -
TimeUnitA unit of time, used by the truncation and rounding helpers. -
WeekdayDay of the week. -
ZoneA time zone, meaning a standard offset plus a daylight-saving rule, not a fixed offset. -
holidays_betweenEvery date an exchange is closed for a holiday within a span. -
monthly_expiryUnix timestamp of a standard US equity monthly option expiry at a chosen local close time. -
monthly_expiry_dayStandard US equity monthly option expiry: the third Friday of the month, moved to the preceding Thursday when that Friday is a market holiday.
std_time v1 · API Index · Task Index · Scope and Limitations · Verification
Calendar data current to the horizons on Versioning and Data Currency. Shanghai, Bombay and Singapore answer exactly through 2026.
MPL-2.0 · Copyright (c) 2026 Jesse Sanford · published on TradingView as The_Peaceful_Lizard
Start here
The model
- Core Concepts
- Civil and Exact Arithmetic
- Value Semantics
- Error Model
- Time Zones
- Exchange Calendars
- Trading Days and Day Counts
- Expiries
- Sessions
- Formatting and Parsing
- Choosing the Right Tool
- Pitfalls
Recipes
Reference
- API Index · Task Index
- DateTime
- Session
- Zone
- Exchange
- Period · Interval
- Weekday · Enums
- Free functions
- Glossary
The fine print