quantlib.time.date.

Date

class Date(day=None, month=None, year=None, hours=None, minutes=None, seconds=None, Millisecond millisec=0, Microsecond microsec=0)

Bases: object

Concrete date class.

This class provides methods to inspect dates as well as methods and operators which implement a limited date algebra (increasing and decreasing dates, and calculating their difference).

Parameters:
dayint, optional

The day of the month.

monthint, optional

The month of the year.

yearint, optional

The year.

hoursint, optional

The hour of the day.

minutesint, optional

The minute of the hour.

secondsint, optional

The second of the minute.

millisecint, optional

The millisecond of the second.

microsecint, optional

The microsecond of the second.

Attributes:
day

The day of the month of the date.

day_of_year

The day of the year (one based - Jan 1st = 1).

fraction_of_day

The fraction of the day, as a float.

fraction_of_second

The fraction of the second, as a float.

hours

The hour of the day.

microseconds

The microsecond of the second.

milliseconds

The millisecond of the second.

minutes

The minute of the hour.

month

The month of the date.

seconds

The second of the minute.

serial

The serial number of the date.

weekday

The weekday of the date.

year

The year of the date.

Methods

from_datetime(cls, dt)

Creates a Date object from a Python datetime.date or datetime.datetime object.

from_serial(cls, serial_type serial)

Creates a Date object from a serial number (e.g., from Excel).

from_string(cls, str s, str fmt=None)

Creates a Date object from a string representation.