Python datetime class ¶
Description ¶
A datetime object is a single object containing all the information from a date object and a time object.
Like a date object, datetime assumes the current Gregorian calendar extended in both directions; like a time object, datetime assumes there are exactly 3600*24 seconds in every day.
Constructor ¶
1 class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)
2 """
3
4 The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass.
5 The remaining arguments must be integers in the following ranges:
6
7 MINYEAR <= year <= MAXYEAR,
8
9 1 <= month <= 12,
10
11 1 <= day <= number of days in the given month and year,
12
13 0 <= hour < 24,
14
15 0 <= minute < 60,
16
17 0 <= second < 60,
18
19 0 <= microsecond < 1000000,
20
21 fold in [0, 1].
22
23 If an argument outside those ranges is given, ValueError is raised.
24
25 New in version 3.6: Added the fold argument.
26 """