Skip to main content
Version: Python

calendar

The calendar method returns the calendar with the given name. If no name is given, the default calendar is returned. To set the default calendar, use set_calendar.

Syntax

calendar(name: str = None) -> BusinessCalendar

Parameters

ParameterTypeDescription
namestr

The name of the calendar. If not specified, the default calendar is returned.

Returns

A BusinessCalendar. Note that the returned type is an io.deephaven.time.calendar.BusinessCalendar Java object that can be used in Python.

Examples

The following example gets the default calendar.

from deephaven.calendar import calendar

cal = calendar()

The following example gets the USBANK_EXAMPLE calendar.

from deephaven.calendar import calendar_names, calendar

print(calendar_names())

usbank_cal = calendar("USBANK_EXAMPLE")

The following example uses the USNYSE_EXAMPLE calendar in a table operation to see if given dates are business days or not.

from deephaven.calendar import calendar
from deephaven import empty_table

nyse_cal = calendar("USNYSE_EXAMPLE")

source = empty_table(10).update("Timestamp = '2024-01-05T00:08:00 ET' + i * 24 * HOUR")
result = source.update(["IsBizDay = nyse_cal.isBusinessDay(Timestamp)"])