Module datetime :: Class datetime
[hide private]
[frames] | no frames]

type datetime

object --+    
         |    
      date --+
             |
            datetime

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.

Instance Methods [hide private]
 
__add__(x, y)
x+y
 
__eq__(x, y)
x==y
 
__ge__(x, y)
x>=y
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__gt__(x, y)
x>y
 
__hash__(x)
hash(x)
 
__le__(x, y)
x<=y
 
__lt__(x, y)
x<y
 
__ne__(x, y)
x!=y
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__radd__(x, y)
y+x
(cls, state)
__reduce__()
 
__repr__(x)
repr(x)
 
__rsub__(x, y)
y-x
 
__str__(x)
str(x)
 
__sub__(x, y)
x-y
 
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).
 
fromtimestamp(...)
timestamp[, tz] -> tz's local time from POSIX timestamp.
 
isoformat(...)
[sep] -> string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM].
 
now(...)
[tz] -> new datetime with tz's local day and time.
 
replace(...)
Return datetime with new specified fields.
 
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.
 
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().

Inherited from date: fromordinal, isocalendar, isoweekday, strftime, today, toordinal, weekday

Class Variables [hide private]
  max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
  min = datetime.datetime(1, 1, 1, 0, 0)
  resolution = datetime.timedelta(0, 0, 1)
Properties [hide private]
  hour
  microsecond
  minute
  second
  tzinfo

Inherited from date: day, month, year

Method Details [hide private]

__add__(x, y)
(Addition operator)

 

x+y

Overrides: date.__add__

__eq__(x, y)
(Equality operator)

 

x==y

Overrides: date.__eq__

__ge__(x, y)
(Greater-than-or-equals operator)

 

x>=y

Overrides: date.__ge__

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: date.__getattribute__

__gt__(x, y)
(Greater-than operator)

 

x>y

Overrides: date.__gt__

__hash__(x)
(Hashing function)

 

hash(x)

Overrides: date.__hash__

__le__(x, y)
(Less-than-or-equals operator)

 

x<=y

Overrides: date.__le__

__lt__(x, y)
(Less-than operator)

 

x<y

Overrides: date.__lt__

__ne__(x, y)

 

x!=y

Overrides: date.__ne__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: date.__new__

__radd__(x, y)
(Right-side addition operator)

 

y+x

Overrides: date.__radd__

__reduce__()

 
Returns: (cls, state)
Overrides: date.__reduce__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: date.__repr__

__rsub__(x, y)

 

y-x

Overrides: date.__rsub__

__str__(x)
(Informal representation operator)

 

str(x)

Overrides: date.__str__

__sub__(x, y)
(Subtraction operator)

 

x-y

Overrides: date.__sub__

ctime(...)

 

Return ctime() style string.

Overrides: date.ctime

fromtimestamp(...)

 

timestamp[, tz] -> tz's local time from POSIX timestamp.

Overrides: date.fromtimestamp

isoformat(...)

 

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

Overrides: date.isoformat

replace(...)

 

Return datetime with new specified fields.

Overrides: date.replace

timetuple(...)

 

Return time tuple, compatible with time.localtime().

Overrides: date.timetuple