O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required