datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints or longs.
x.__init__(...) initializes x; see help(type(x)) for signature
Methods
| astimezone | tz -> convert to local time in new timezone tz |
| combine | date, time -> datetime with same date and time fields |
| ctime | Return ctime() style string. |
| date | Return date object with same year, month and day. |
| dst | Return self.tzinfo.dst(self). |
| fromordinal | int -> date corresponding to a proleptic Gregorian ordinal. |
| fromtimestamp | timestamp[, tz] -> tz’s local time from POSIX timestamp. |
| isocalendar | Return a 3-tuple containing ISO year, week number, and weekday. |
| isoformat | [sep] -> string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM]. |
| isoweekday | Return the day of the week represented by the date. |
| now | [tz] -> new datetime with tz’s local day and time. |
| replace | Return datetime with new specified fields. |
| strftime | format -> strftime() style string. |
| strptime | string, format -> new datetime parsed from a string (like time.strptime()). |
| time | Return time object with same time but with tzinfo=None. |
| timetuple | Return time tuple, compatible with time.localtime(). |
| timetz | Return time object with same time and tzinfo. |
| today | Current date or datetime: same as self.__class__.fromtimestamp(time.time()). |
| toordinal | Return proleptic Gregorian ordinal. |
| tzname | Return self.tzinfo.tzname(self). |
| utcfromtimestamp | timestamp -> UTC datetime from a POSIX timestamp (like time.time()). |
| utcnow | Return a new datetime representing UTC day and time. |
| utcoffset | Return self.tzinfo.utcoffset(self). |
| utctimetuple | Return UTC time tuple, compatible with time.localtime(). |
| weekday | Return the day of the week represented by the date. |
Attributes
| day | |
| hour | |
| max | |
| microsecond | |
| min | |
| minute | |
| month | |
| resolution | |
| second | |
| tzinfo | |
| year |
tz -> convert to local time in new timezone tz
date, time -> datetime with same date and time fields
Return ctime() style string.
Return date object with same year, month and day.
Return self.tzinfo.dst(self).
int -> date corresponding to a proleptic Gregorian ordinal.
timestamp[, tz] -> tz’s local time from POSIX timestamp.
Return a 3-tuple containing ISO year, week number, and weekday.
[sep] -> string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM].
sep is used to separate the year from the time, and defaults to ‘T’.
Return the day of the week represented by the date. Monday == 1 ... Sunday == 7
[tz] -> new datetime with tz’s local day and time.
Return datetime with new specified fields.
format -> strftime() style string.
string, format -> new datetime parsed from a string (like time.strptime()).
Return time object with same time but with tzinfo=None.
Return time tuple, compatible with time.localtime().
Return time object with same time and tzinfo.
Current date or datetime: same as self.__class__.fromtimestamp(time.time()).
Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.
Return self.tzinfo.tzname(self).
timestamp -> UTC datetime from a POSIX timestamp (like time.time()).
Return a new datetime representing UTC day and time.
Return self.tzinfo.utcoffset(self).
Return UTC time tuple, compatible with time.localtime().
Return the day of the week represented by the date. Monday == 0 ... Sunday == 6