datetime

The datetime module provides a variety of classes for representing and manipulating dates and times. Date manipulation is a complex subject, and readers would be strongly advised to consult Python’s online documentation for an introductory background concerning the design of this module.

date Objects

date(year, month, day)

Creates a new date object. year is an integer in the range datetime.MINYEAR to datetime.MAXYEAR. month is an integer in the range 1 to 12, and day is an integer in the range 1 to the number of days in the given month. The returned date object is immutable and has the attributes year, month, and day corresponding to the values of the supplied arguments.

date.today()

A class method that returns a date object corresponding ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.