Date¶
- class Date(day=None, month=None, year=None, hours=None, minutes=None, seconds=None, Millisecond millisec=0, Microsecond microsec=0)¶
Bases:
objectConcrete 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:
dayThe day of the month of the date.
day_of_yearThe day of the year (one based - Jan 1st = 1).
fraction_of_dayThe fraction of the day, as a float.
fraction_of_secondThe fraction of the second, as a float.
hoursThe hour of the day.
microsecondsThe microsecond of the second.
millisecondsThe millisecond of the second.
minutesThe minute of the hour.
monthThe month of the date.
secondsThe second of the minute.
serialThe serial number of the date.
weekdayThe weekday of the date.
yearThe year of the date.
Methods
from_datetime(cls, dt)Creates a Date object from a Python
datetime.dateordatetime.datetimeobject.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.