Lines Matching defs:datetime
7 __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo",
574 """Represent the difference between two datetime objects.
583 In addition, datetime supports subtraction of two datetime objects
584 returning a timedelta, and addition or subtraction of a datetime
585 and a timedelta giving a datetime.
1005 >>> dt = datetime(2010, 1, 1)
1007 'datetime.datetime(2010, 1, 1, 0, 0)'
1009 >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)
1011 'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
1053 - http://www.w3.org/TR/NOTE-datetime
1231 "datetime -> string name of time zone."
1235 "datetime -> timedelta, positive for east of UTC, negative for west of UTC"
1239 """datetime -> DST offset as timedelta, positive for east of UTC.
1247 "datetime in UTC -> datetime in local time."
1249 if not isinstance(dt, datetime):
1250 raise TypeError("fromutc() requires a datetime argument")
1669 class datetime(date):
1670 """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
1689 "a datetime object. "
1744 """Construct a datetime from a POSIX timestamp (like time.time()).
1788 """Construct a datetime from a POSIX timestamp (like time.time()).
1798 """Construct a naive UTC datetime from a POSIX timestamp."""
1803 "Construct a datetime from time.time() and optional time zone info."
1809 "Construct a UTC datetime from time.time()."
1815 "Construct a datetime from a given date and a given time."
1828 """Construct a datetime from a string in one of the ISO 8601 formats."""
1872 epoch = datetime(1970, 1, 1)
1877 return (datetime(y, m, d, hh, mm, ss) - epoch) // timedelta(0, 1)
1938 """Return a new datetime with new values for the specified fields."""
1966 local = datetime(*localtm[:6])
2061 'string, format -> new datetime parsed from a string (like time.strptime()).'
2102 # Comparisons of datetime objects with other.
2105 if isinstance(other, datetime):
2113 if isinstance(other, datetime):
2121 if isinstance(other, datetime):
2129 if isinstance(other, datetime):
2137 if isinstance(other, datetime):
2145 assert isinstance(other, datetime)
2182 "Add a datetime and a timedelta."
2203 "Subtract two datetimes, or a datetime and a timedelta."
2204 if not isinstance(other, datetime):
2280 datetime.min = datetime(1, 1, 1)
2281 datetime.max = datetime(9999, 12, 31, 23, 59, 59, 999999)
2282 datetime.resolution = timedelta(microseconds=1)
2343 'datetime.timezone.utc'
2346 "datetime.timezone(datetime.timedelta(-1, 68400), 'EST')"
2349 return 'datetime.timezone.utc'
2362 if isinstance(dt, datetime) or dt is None:
2364 raise TypeError("utcoffset() argument must be a datetime instance"
2368 if isinstance(dt, datetime) or dt is None:
2372 raise TypeError("tzname() argument must be a datetime instance"
2376 if isinstance(dt, datetime) or dt is None:
2378 raise TypeError("dst() argument must be a datetime instance"
2382 if isinstance(dt, datetime):
2387 raise TypeError("fromutc() argument must be a datetime instance"
2420 _EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc)
2422 # Some time zone algebra. For a datetime x, let
2443 # This follows from #2, and that datetime.timetz+timedelta preserves tzinfo.
2452 # The function wants to return a datetime y with timezone tz, equivalent to x.