Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
fa91858c
Kaydet (Commit)
fa91858c
authored
Ara 30, 2002
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More markup additions
üst
63b482ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
264 additions
and
156 deletions
+264
-156
libdatetime.tex
Doc/lib/libdatetime.tex
+264
-156
No files found.
Doc/lib/libdatetime.tex
Dosyayı görüntüle @
fa91858c
...
@@ -147,9 +147,11 @@ between two dates or times.
...
@@ -147,9 +147,11 @@ between two dates or times.
and days, seconds and microseconds are then normalized so that the
and days, seconds and microseconds are then normalized so that the
representation is unique, with
representation is unique, with
0 <= microseconds < 1000000
\begin{itemize}
0 <= seconds < 3600*24 (the number of seconds in one day)
\item
\code
{
0 <=
\var
{
microseconds
}
< 1000000
}
-999999999 <= days <= 999999999
\item
\code
{
0 <=
\var
{
seconds
}
< 3600*24
}
(the number of seconds in one day)
\item
\code
{
-999999999 <=
\var
{
days
}
<= 999999999
}
\end{itemize}
If any argument is a float, and there are fractional microseconds,
If any argument is a float, and there are fractional microseconds,
the fractional microseconds left over from all arguments are combined
the fractional microseconds left over from all arguments are combined
...
@@ -174,11 +176,11 @@ between two dates or times.
...
@@ -174,11 +176,11 @@ between two dates or times.
Class attributes are:
Class attributes are:
\begin{memberdesc}
{
min
}
\begin{memberdesc}
{
min
}
The most negative
timedelta
object,
\code
{
timedelta(-999999999)
}
.
The most negative
\class
{
timedelta
}
object,
\code
{
timedelta(-999999999)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
max
}
\begin{memberdesc}
{
max
}
The most positive
timedelta
object,
The most positive
\class
{
timedelta
}
object,
timedelta(days=999999999, hours=23, minutes=59, seconds=59,
timedelta(days=999999999, hours=23, minutes=59, seconds=59,
microseconds=999999)
microseconds=999999)
\end{memberdesc}
\end{memberdesc}
...
@@ -189,7 +191,7 @@ Class attributes are:
...
@@ -189,7 +191,7 @@ Class attributes are:
\end{memberdesc}
\end{memberdesc}
Note that, because of normalization, timedelta.max > -timedelta.min.
Note that, because of normalization, timedelta.max > -timedelta.min.
-timedelta.max is not representable as a
timedelta
object.
-timedelta.max is not representable as a
\class
{
timedelta
}
object.
Instance attributes (read-only):
Instance attributes (read-only):
...
@@ -238,21 +240,21 @@ Supported operations:
...
@@ -238,21 +240,21 @@ Supported operations:
\item
\item
+timedelta -> timedelta
+timedelta -> timedelta
Returns a
timedelta
object with the same value.
Returns a
\class
{
timedelta
}
object with the same value.
\item
\item
-timedelta -> timedelta
-timedelta -> timedelta
-t is equivalent to timedelta(-t.days, -t.seconds, -t.microseconds),
-t is equivalent to timedelta(-t.days, -t.seconds, -t.microseconds),
and to t*-1. This is exact, but may overflow (for example,
and to t*-1. This is exact, but may overflow (for example,
-timedelta.max is not representable as a
timedelta
object).
-timedelta.max is not representable as a
\class
{
timedelta
}
object).
\item
\item
abs(timedelta) -> timedelta
\code
{
abs(timedelta) -> timedelta
}
:
abs(t) is equivalent to +t when t.days >= 0
, and to -t when
\code
{
abs(t)
}
is equivalent to +t when
\code
{
t.days >= 0
}
, and to -t when
t.days < 0
. This is exact, and cannot overflow.
\code
{
t.days < 0
}
. This is exact, and cannot overflow.
\item
\item
comparison of
timedelta to timedelta; the timedelta
representing
comparison of
\class
{
timedelta
}
to timedelta; the
\class
{
timedelta
}
representing
the smaller duration is considered to be the smaller timedelta
the smaller duration is considered to be the smaller timedelta
\item
\item
...
@@ -262,7 +264,7 @@ Supported operations:
...
@@ -262,7 +264,7 @@ Supported operations:
efficient pickling
efficient pickling
\item
\item
in Boolean contexts, a
timedelta object is consid
red to be true
in Boolean contexts, a
\class
{
timedelta
}
object is conside
red to be true
if and only if it isn't equal to
\code
{
timedelta(0)
}
if and only if it isn't equal to
\code
{
timedelta(0)
}
\end{itemize}
\end{itemize}
...
@@ -284,9 +286,9 @@ proleptic Gregorian ordinals and many other calendar systems.
...
@@ -284,9 +286,9 @@ proleptic Gregorian ordinals and many other calendar systems.
following ranges:
following ranges:
\begin{itemize}
\begin{itemize}
\item
MINYEAR <=
\var
{
year
}
<= MAXYEAR
\item
\code
{
MINYEAR <=
\var
{
year
}
<= MAXYEAR
}
\item
1 <=
\var
{
month
}
<= 12
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
1 <=
\var
{
day
}
<= number of days in the given month and year
\item
\code
{
1 <=
\var
{
day
}
<= number of days in the given month and year
}
\end{itemize}
\end{itemize}
If an argument outside those ranges is given,
\exception
{
ValueError
}
If an argument outside those ranges is given,
\exception
{
ValueError
}
...
@@ -312,7 +314,7 @@ Other constructors, all class methods:
...
@@ -312,7 +314,7 @@ Other constructors, all class methods:
\begin{methoddesc}
{
fromordinal
}{
ordinal
}
\begin{methoddesc}
{
fromordinal
}{
ordinal
}
Return the date corresponding to the proleptic Gregorian ordinal,
Return the date corresponding to the proleptic Gregorian ordinal,
where January 1 of year 1 has ordinal 1.
\exception
{
ValueError
}
where January 1 of year 1 has ordinal 1.
\exception
{
ValueError
}
is raised unless
1 <=
\var
{
ordinal
}
<=
\code
{
date.max.toordinal()
}
. For any
is raised unless
\code
{
1 <=
\var
{
ordinal
}
<=
date.max.toordinal()
}
. For any
date
\var
{
d
}
,
\code
{
date.fromordinal(
\var
{
d
}
.toordinal()) ==
\var
{
d
}}
.
date
\var
{
d
}
,
\code
{
date.fromordinal(
\var
{
d
}
.toordinal()) ==
\var
{
d
}}
.
\end{methoddesc}
\end{methoddesc}
...
@@ -484,13 +486,13 @@ The year, month and day arguments are required. Arguments may be ints
...
@@ -484,13 +486,13 @@ The year, month and day arguments are required. Arguments may be ints
or longs, in the following ranges:
or longs, in the following ranges:
\begin{itemize}
\begin{itemize}
\item
\member
{
MINYEAR
}
<=
\var
{
year
}
<=
\member
{
MAXYEAR
}
\item
\code
{
\member
{
MINYEAR
}
<=
\var
{
year
}
<=
\member
{
MAXYEAR
}
}
\item
1 <=
\var
{
month
}
<= 12
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
1 <=
\var
{
day
}
<= number of days in the given month and year
\item
\code
{
1 <=
\var
{
day
}
<= number of days in the given month and year
}
\item
0 <=
\var
{
hour
}
< 24
\item
\code
{
0 <=
\var
{
hour
}
< 24
}
\item
0 <=
\var
{
minute
}
< 60
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
\item
0 <=
\var
{
second
}
< 60
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
0 <=
\var
{
microsecond
}
< 1000000
\item
\code
{
0 <=
\var
{
microsecond
}
< 1000000
}
\end{itemize}
\end{itemize}
If an argument outside those ranges is given,
If an argument outside those ranges is given,
...
@@ -560,28 +562,51 @@ Other constructors, all class methods:
...
@@ -560,28 +562,51 @@ Other constructors, all class methods:
Class attributes:
Class attributes:
.min
\begin{memberdesc}
{
min
}
The earliest representable datetime,
The earliest representable
\class
{
datetime
}
,
datetime(MINYEAR, 1, 1).
\code
{
datetime(MINYEAR, 1, 1)
}
.
\end{memberdesc}
.max
\begin{memberdesc}
{
max
}
The latest representable datetime,
The latest representable
\class
{
datetime
}
,
datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999).
\code
{
datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999)
}
.
\end{memberdesc}
.resolution
\begin{memberdesc}
{
resolution
}
The smallest possible difference between non-equal datetime
The smallest possible difference between non-equal
\class
{
datetime
}
objects, timedelta(microseconds=1).
objects,
\code
{
timedelta(microseconds=1)
}
.
\end{memberdesc}
Instance attributes (read-only):
Instance attributes (read-only):
.year between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
inclusive
\begin{memberdesc}
{
year
}
.month between 1 and 12 inclusive
Between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
inclusive
.day between 1 and the number of days in the given month
\end{memberdesc}
of the given year
.hour in range(24)
\begin{memberdesc}
{
month
}
.minute in range(60)
Between 1 and 12 inclusive
.second in range(60)
\end{memberdesc}
.microsecond in range(1000000)
\begin{memberdesc}
{
day
}
Between 1 and the number of days in the given month
of the given year.
\end{memberdesc}
\begin{memberdesc}
{
hour
}
In
\code
{
range(24)
}
.
\end{memberdesc}
\begin{memberdesc}
{
minute
}
In
\code
{
range(60)
}
.
\end{memberdesc}
\begin{memberdesc}
{
second
}
In
\code
{
range(60)
}
.
\end{memberdesc}
\begin{memberdesc}
{
microsecond
}
In
\code
{
range(1000000)
}
.
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -625,22 +650,26 @@ Supported operations:
...
@@ -625,22 +650,26 @@ Supported operations:
Instance methods:
Instance methods:
- date()
\begin{methoddesc}
{
date
}{}
Return
\class
{
date
}
object with same year, month and day.
Return
\class
{
date
}
object with same year, month and day.
\end{methoddesc}
- time()
\begin{methoddesc}
{
time
}{}
Return time object with same hour, minute, second and microsecond.
Return time object with same hour, minute, second and microsecond.
\end{methoddesc}
- replace(year=, month=, day=, hour=, minute=, second=, microsecond=)
\begin{methoddesc}
{
replace
}{
year=, month=, day=, hour=, minute=, second=, microsecond=
}
Return a datetime with the same value, except for those fields given
Return a datetime with the same value, except for those fields given
new values by whichever keyword arguments are specified.
new values by whichever keyword arguments are specified.
\end{methoddesc}
- astimezone(tz)
\begin{methoddesc}
{
astimezone
}{
tz
}
Return a
\class
{
datetimetz
}
with the same date and time fields, and
Return a
\class
{
datetimetz
}
with the same date and time fields, and
with
\member
{
tzinfo
}
member
\var
{
tz
}
.
\var
{
tz
}
must be
\code
{
None
}
,
with
\member
{
tzinfo
}
member
\var
{
tz
}
.
\var
{
tz
}
must be
\code
{
None
}
,
or an instance of a
\class
{
tzinfo
}
subclass.
or an instance of a
\class
{
tzinfo
}
subclass.
\end{methoddesc}
- timetuple()
\begin{methoddesc}
{
timetuple
}{}
Return a 9-element tuple of the form returned by
Return a 9-element tuple of the form returned by
\function
{
time.localtime()
}
.
\function
{
time.localtime()
}
.
The DST flag is -1.
\code
{
d.timetuple()
}
is equivalent to
The DST flag is -1.
\code
{
d.timetuple()
}
is equivalent to
...
@@ -649,26 +678,31 @@ Instance methods:
...
@@ -649,26 +678,31 @@ Instance methods:
d.weekday(),
\#
0 is Monday
d.weekday(),
\#
0 is Monday
d.toordinal() - date(d.year, 1, 1).toordinal() + 1,
\#
day of year
d.toordinal() - date(d.year, 1, 1).toordinal() + 1,
\#
day of year
-1)
-1)
\end{methoddesc}
- toordinal()
\begin{methoddesc}
{
toordinal
}{}
Return the proleptic Gregorian ordinal of the date. The same as
Return the proleptic Gregorian ordinal of the date. The same as
\method
{
date.toordinal()
}
.
\method
{
date.toordinal()
}
.
\end{methoddesc}
- weekday()
\begin{methoddesc}
{
weekday
}{}
Return the day of the week as an integer, where Monday is 0 and
Return the day of the week as an integer, where Monday is 0 and
Sunday is 6. The same as
\method
{
date.weekday()
}
.
Sunday is 6. The same as
\method
{
date.weekday()
}
.
See also
\method
{
isoweekday()
}
.
See also
\method
{
isoweekday()
}
.
\end{methoddesc}
- isoweekday()
\begin{methoddesc}
{
isoweekday
}{}
Return the day of the week as an integer, where Monday is 1 and
Return the day of the week as an integer, where Monday is 1 and
Sunday is 7. The same as
\method
{
date.isoweekday()
}
.
Sunday is 7. The same as
\method
{
date.isoweekday()
}
.
See also
\method
{
weekday()
}
,
\method
{
isocalendar()
}
.
See also
\method
{
weekday()
}
,
\method
{
isocalendar()
}
.
\end{methoddesc}
- isocalendar()
\begin{methoddesc}
{
isocalendar
}{}
Return a 3-tuple, (ISO year, ISO week number, ISO weekday). The
Return a 3-tuple, (ISO year, ISO week number, ISO weekday). The
same as
\method
{
date.isocalendar()
}
.
same as
\method
{
date.isocalendar()
}
.
\end{methoddesc}
- isoformat(sep='T')
\begin{methoddesc}
{
isoformat
}{
sep='T'
}
Return a string representing the date and time in ISO 8601 format,
Return a string representing the date and time in ISO 8601 format,
YYYY-MM-DDTHH:MM:SS.mmmmmm
YYYY-MM-DDTHH:MM:SS.mmmmmm
or, if self.microsecond is 0,
or, if self.microsecond is 0,
...
@@ -678,12 +712,14 @@ Instance methods:
...
@@ -678,12 +712,14 @@ Instance methods:
of the result. For example,
of the result. For example,
datetime(2002, 12, 4, 1, 2, 3, 4).isoformat(' ') ==
datetime(2002, 12, 4, 1, 2, 3, 4).isoformat(' ') ==
'2002-12-04 01:02:03.000004'
'2002-12-04 01:02:03.000004'
\end{methoddesc}
-
__
str
__
()
\begin{methoddesc}
{__
str
__}{}
For a
\class
{
datetime
}
instance
\var
{
d
}
,
\code
{
str(
\var
{
d
}
)
}
is
For a
\class
{
datetime
}
instance
\var
{
d
}
,
\code
{
str(
\var
{
d
}
)
}
is
equivalent to
\code
{
\var
{
d
}
.isoformat(' ')
}
.
equivalent to
\code
{
\var
{
d
}
.isoformat(' ')
}
.
\end{methoddesc}
- ctime()
\begin{methoddesc}
{
ctime
}{}
Return a string representing the date, for example
Return a string representing the date, for example
datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'.
datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'.
\code
{
d.ctime()
}
is equivalent to
\code
{
d.ctime()
}
is equivalent to
...
@@ -692,11 +728,13 @@ Instance methods:
...
@@ -692,11 +728,13 @@ Instance methods:
\function
{
time.ctime()
}
invokes, but which
\function
{
time.ctime()
}
invokes, but which
\method
{
datetime.ctime()
}
does not invoke) conforms to the C
\method
{
datetime.ctime()
}
does not invoke) conforms to the C
standard.
standard.
\end{methoddesc}
- strftime(format)
\begin{methoddesc}
{
strftime
}{
format
}
Return a string representing the date and time, controlled by an
Return a string representing the date and time, controlled by an
explicit format string. See the section on
\method
{
strftime()
}
explicit format string. See the section on
\method
{
strftime()
}
behavior.
behavior.
\end{methoddesc}
\subsection
{
\class
{
time
}
\label
{
datetime-time
}}
\subsection
{
\class
{
time
}
\label
{
datetime-time
}}
...
@@ -721,23 +759,34 @@ Constructor:
...
@@ -721,23 +759,34 @@ Constructor:
Class attributes:
Class attributes:
.min
\begin{memberdesc}
{
min
}
The earliest representable time, time(0, 0, 0, 0).
The earliest representable
\class
{
time
}
,
\code
{
time(0, 0, 0, 0)
}
.
\end{memberdesc}
.max
\begin{memberdesc}
{
max
}
The latest representable time, time(23, 59, 59, 999999).
The latest representable
\class
{
time
}
,
\code
{
time(23, 59, 59, 999999)
}
.
\end{memberdesc}
.resolution
\begin{memberdesc}
{
resolution
}
The smallest possible difference between non-equal time
The smallest possible difference between non-equal
\class
{
time
}
objects, timedelta(microseconds=1), although note that
objects,
\code
{
timedelta(microseconds=1)
}
, although note that
arithmetic on time objects is not supported.
arithmetic on
\class
{
time
}
objects is not supported.
\end{memberdesc}
Instance attributes (read-only):
Instance attributes (read-only):
.hour in range(24)
\begin{memberdesc}
{
hour
}
.minute in range(60)
In
\code
{
range(24)
}
.
.second in range(60)
\end{memberdesc}
.microsecond in range(1000000)
\begin{memberdesc}
{
minute
}
In
\code
{
range(60)
}
.
\end{memberdesc}
\begin{memberdesc}
{
second
}
In
\code
{
range(60)
}
.
\end{memberdesc}
\begin{memberdesc}
{
microsecond
}
In
\code
{
range(1000000)
}
.
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -759,23 +808,27 @@ Supported operations:
...
@@ -759,23 +808,27 @@ Supported operations:
Instance methods:
Instance methods:
- replace(hour=, minute=, second=, microsecond=)
\begin{methoddesc}
{
replace
}{
hour=, minute=, second=, microsecond=
}
Return a time with the same value, except for those fields given
Return a time with the same value, except for those fields given
new values by whichever keyword arguments are specified.
new values by whichever keyword arguments are specified.
\end{methoddesc}
- isoformat()
\begin{methoddesc}
{
isoformat
}{}
Return a string representing the time in ISO 8601 format,
Return a string representing the time in ISO 8601 format,
HH:MM:SS.mmmmmm
HH:MM:SS.mmmmmm
or, if self.microsecond is 0
or, if self.microsecond is 0
HH:MM:SS
HH:MM:SS
\end{methoddesc}
-
__
str
__
()
\begin{methoddesc}
{__
str
__}{}
For a time
\var
{
t
}
,
\code
{
str(
\var
{
t
}
)
}
is equivalent to
For a time
\var
{
t
}
,
\code
{
str(
\var
{
t
}
)
}
is equivalent to
\code
{
\var
{
t
}
.isoformat()
}
.
\code
{
\var
{
t
}
.isoformat()
}
.
\end{methoddesc}
- strftime(format)
\begin{methoddesc}
{
strftime
}{
format
}
Return a string representing the time, controlled by an explicit
Return a string representing the time, controlled by an explicit
format string. See the section on
\method
{
strftime()
}
behavior.
format string. See the section on
\method
{
strftime()
}
behavior.
\end{methoddesc}
\subsection
{
\class
{
tzinfo
}
\label
{
datetime-tzinfo
}}
\subsection
{
\class
{
tzinfo
}
\label
{
datetime-tzinfo
}}
...
@@ -808,7 +861,7 @@ or \class{timetz} object, passing itself as the argument. A
...
@@ -808,7 +861,7 @@ or \class{timetz} object, passing itself as the argument. A
argument of
\code
{
None
}
or of type
\class
{
timetz
}
or
argument of
\code
{
None
}
or of type
\class
{
timetz
}
or
\class
{
datetimetz
}
.
\class
{
datetimetz
}
.
- utcoffset(dt)
\begin{methoddesc}
{
utcoffset
}{
dt
}
Return offset of local time from UTC, in minutes east of UTC. If
Return offset of local time from UTC, in minutes east of UTC. If
local time is west of UTC, this should be negative. Note that this
local time is west of UTC, this should be negative. Note that this
is intended to be the total offset from UTC; for example, if a
is intended to be the total offset from UTC; for example, if a
...
@@ -819,8 +872,9 @@ argument of \code{None} or of type \class{timetz} or
...
@@ -819,8 +872,9 @@ argument of \code{None} or of type \class{timetz} or
the magnitude of the offset must be less than one day), or a
the magnitude of the offset must be less than one day), or a
\class
{
timedelta
}
object representing a whole number of minutes
\class
{
timedelta
}
object representing a whole number of minutes
in the same range.
in the same range.
\end{methoddesc}
- tzname(dt)
\begin{methoddesc}
{
tzname
}{
dt
}
Return the timezone name corresponding to the
\class
{
datetime
}
represented
Return the timezone name corresponding to the
\class
{
datetime
}
represented
by dt, as a string. Nothing about string names is defined by the
by dt, as a string. Nothing about string names is defined by the
\module
{
datetime
}
module, and there's no requirement that it mean anything
\module
{
datetime
}
module, and there's no requirement that it mean anything
...
@@ -830,8 +884,9 @@ argument of \code{None} or of type \class{timetz} or
...
@@ -830,8 +884,9 @@ argument of \code{None} or of type \class{timetz} or
rather than a fixed string primarily because some
\class
{
tzinfo
}
objects
rather than a fixed string primarily because some
\class
{
tzinfo
}
objects
will wish to return different names depending on the specific value
will wish to return different names depending on the specific value
of dt passed, especially if the
\class
{
tzinfo
}
class is accounting for DST.
of dt passed, especially if the
\class
{
tzinfo
}
class is accounting for DST.
\end{methoddesc}
- dst(dt)
\begin{methoddesc}
{
dst
}{
dt
}
Return the DST offset, in minutes east of UTC, or
\code
{
None
}
if
Return the DST offset, in minutes east of UTC, or
\code
{
None
}
if
DST information isn't known. Return 0 if DST is not in effect.
DST information isn't known. Return 0 if DST is not in effect.
If DST is in effect, return the offset as an integer or
If DST is in effect, return the offset as an integer or
...
@@ -843,6 +898,7 @@ argument of \code{None} or of type \class{timetz} or
...
@@ -843,6 +898,7 @@ argument of \code{None} or of type \class{timetz} or
example,
\method
{
datetimetz.timetuple()
}
calls its
\member
{
tzinfo
}
example,
\method
{
datetimetz.timetuple()
}
calls its
\member
{
tzinfo
}
member's
\method
{
dst()
}
method to determine how the
member's
\method
{
dst()
}
method to determine how the
\member
{
tm
_
isdst
}
flag should be set.
\member
{
tm
_
isdst
}
flag should be set.
\end{methoddesc}
Example
\class
{
tzinfo
}
classes:
Example
\class
{
tzinfo
}
classes:
...
@@ -856,32 +912,38 @@ particular day, and subject to adjustment via a \class{tzinfo} object.
...
@@ -856,32 +912,38 @@ particular day, and subject to adjustment via a \class{tzinfo} object.
Constructor:
Constructor:
time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
\begin{funcdesc}
{
time
}{
hour=0, minute=0, second=0, microsecond=0, tzinfo=None
}
All arguments are optional.
\var
{
tzinfo
}
may be
\code
{
None
}
, or
All arguments are optional.
\var
{
tzinfo
}
may be
\code
{
None
}
, or
an instance of a
\class
{
tzinfo
}
subclass. The remaining arguments
an instance of a
\class
{
tzinfo
}
subclass. The remaining arguments
may be ints or longs, in the following ranges:
may be ints or longs, in the following ranges:
0 <= hour < 24
\begin{itemize}
0 <= minute < 60
\item
\code
{
0 <=
\var
{
hour
}
< 24
}
0 <= second < 60
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
0 <= microsecond < 1000000
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
\code
{
0 <=
\var
{
microsecond
}
< 1000000
}
.
\end{itemize}
If an argument outside those ranges is given,
If an argument outside those ranges is given,
\exception
{
ValueError
}
is raised.
\exception
{
ValueError
}
is raised.
\end{funcdesc}
Class attributes:
Class attributes:
.min
\begin{memberdesc}
{
min
}
The earliest representable time, timetz(0, 0, 0, 0).
The earliest representable time,
\code
{
timetz(0, 0, 0, 0)
}
.
\end{memberdesc}
.max
\begin{memberdesc}
{
max
}
The latest representable time, timetz(23, 59, 59, 999999).
The latest representable time,
\code
{
timetz(23, 59, 59, 999999)
}
.
\end{memberdesc}
.resolution
\begin{memberdesc}
{
resolution
}
The smallest possible difference between non-equal
timetz
The smallest possible difference between non-equal
\class
{
timetz
}
objects,
timedelta(microseconds=1)
, although note that
objects,
\code
{
timedelta(microseconds=1)
}
, although note that
arithmetic on
\class
{
timetz
}
objects is not supported.
arithmetic on
\class
{
timetz
}
objects is not supported.
\end{memberdesc}
Instance attributes (read-only):
Instance attributes (read-only):
...
@@ -899,7 +961,7 @@ Supported operations:
...
@@ -899,7 +961,7 @@ Supported operations:
\item
\item
comparison of
\class
{
timetz
}
to
\class
{
time
}
or
\class
{
timetz
}
,
comparison of
\class
{
timetz
}
to
\class
{
time
}
or
\class
{
timetz
}
,
where
\var
{
a
}
is considered less than
\var
{
b
}
when
\var
{
a
}
precedes
where
\var
{
a
}
is considered less than
\var
{
b
}
when
\var
{
a
}
precedes
\var
{
b
}
in time. If one comparand is
naive
and the other is aware,
\var
{
b
}
in time. If one comparand is
{
\naive
}
and the other is aware,
\exception
{
TypeError
}
is raised. If both comparands are aware, and
\exception
{
TypeError
}
is raised. If both comparands are aware, and
have the same
\member
{
tzinfo
}
member, the common
\member
{
tzinfo
}
have the same
\member
{
tzinfo
}
member, the common
\member
{
tzinfo
}
member is ignored and the base times are compared. If both
member is ignored and the base times are compared. If both
...
@@ -922,44 +984,51 @@ Supported operations:
...
@@ -922,44 +984,51 @@ Supported operations:
Instance methods:
Instance methods:
- replace
(hour=, minute=, second=, microsecond=, tzinfo=)
\begin{methoddesc}
{
replace
}
(hour=, minute=, second=, microsecond=, tzinfo=)
Return a
timetz
with the same value, except for those fields given
Return a
\class
{
timetz
}
with the same value, except for those fields given
new values by whichever keyword arguments are specified. Note that
new values by whichever keyword arguments are specified. Note that
\code
{
tzinfo=None
}
can be specified to create a naive timetz from an
\code
{
tzinfo=None
}
can be specified to create a
{
\naive
}
\class
{
timetz
}
from an
aware timetz.
aware
\class
{
timetz
}
.
\end{methoddesc}
- isoformat()
\begin{methoddesc}
{
isoformat
}{}
Return a string representing the time in ISO 8601 format,
Return a string representing the time in ISO 8601 format,
HH:MM:SS.mmmmmm
HH:MM:SS.mmmmmm
or, if self.microsecond is 0
or, if self.microsecond is 0
,
HH:MM:SS
HH:MM:SS
If
\method
{
utcoffset()
}
does not return
\code
{
None
}
, a 6-character
If
\method
{
utcoffset()
}
does not return
\code
{
None
}
, a 6-character
string is appended, giving the UTC offset in (signed) hours and
string is appended, giving the UTC offset in (signed) hours and
minutes:
minutes:
HH:MM:SS.mmmmmm+HH:MM
HH:MM:SS.mmmmmm+HH:MM
or, if self.microsecond is 0
or, if self.microsecond is 0
,
HH:MM:SS+HH:MM
HH:MM:SS+HH:MM
\end{methoddesc}
-
__
str
__
()
\begin{methoddesc}
{__
str
__}{}
For a
\class
{
timetz
}
\var
{
t
}
,
\code
{
str(
\var
{
t
}
)
}
is equivalent to
For a
\class
{
timetz
}
\var
{
t
}
,
\code
{
str(
\var
{
t
}
)
}
is equivalent to
\code
{
\var
{
t
}
.isoformat()
}
.
\code
{
\var
{
t
}
.isoformat()
}
.
\end{methoddesc}
- strftime(format)
\begin{methoddesc}
{
strftime
}{
format
}
Return a string representing the time, controlled by an explicit
Return a string representing the time, controlled by an explicit
format string. See the section on
\method
{
strftime()
}
behavior.
format string. See the section on
\method
{
strftime()
}
behavior.
\end{methoddesc}
- utcoffset()
\begin{methoddesc}
{
utcoffset
}{}
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
\code
{
tzinfo.utcoffset(self)
}
converted to a
\class
{
timedelta
}
\code
{
tzinfo.utcoffset(self)
}
converted to a
\class
{
timedelta
}
object.
object.
\end{methoddesc}
- tzname():
\begin{methoddesc}
{
tzname
}{}
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
\code
{
tzinfo.tzname(self)
}
.
\code
{
tzinfo.tzname(self)
}
.
\end{methoddesc}
- dst()
\begin{methoddesc}
{
dst
}{}
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
\code
{
tzinfo.dst(self)
}
converted to a
\class
{
timedelta
}
object.
\code
{
tzinfo.dst(self)
}
converted to a
\class
{
timedelta
}
object.
\end{methoddesc}
...
@@ -975,74 +1044,99 @@ from a \class{date} object and a \class{timetz} object.
...
@@ -975,74 +1044,99 @@ from a \class{date} object and a \class{timetz} object.
Constructor:
Constructor:
datetimetz(
year, month, day,
\begin{funcdesc}
{
datetimetz
}{
year, month, day,
hour=0, minute=0, second=0, microsecond=0, tzinfo=None
)
hour=0, minute=0, second=0, microsecond=0, tzinfo=None
}
The year, month and day arguments are required.
\var
{
tzinfo
}
may
The year, month and day arguments are required.
\var
{
tzinfo
}
may
be
\code
{
None
}
, or an instance of a
\class
{
tzinfo
}
subclass. The
be
\code
{
None
}
, or an instance of a
\class
{
tzinfo
}
subclass. The
remaining arguments may be ints or longs, in the following ranges:
remaining arguments may be ints or longs, in the following ranges:
MINYEAR <= year <= MAXYEAR
\begin{itemize}
1 <= month <= 12
\item
\code
{
MINYEAR <=
\var
{
year
}
<= MAXYEAR
}
1 <= day <= number of days in the given month and year
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
0 <= hour < 24
\item
\code
{
1 <=
\var
{
day
}
<= number of days in the given month and year
}
0 <= minute < 60
\item
\code
{
0 <=
\var
{
hour
}
< 24
}
0 <= second < 60
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
0 <= microsecond < 1000000
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
\code
{
0 <=
\var
{
microsecond
}
< 1000000
}
\end{itemize}
If an argument outside those ranges is given,
If an argument outside those ranges is given,
\exception
{
ValueError
}
is raised.
\exception
{
ValueError
}
is raised.
\end{funcdesc}
Other constructors (class methods):
Other constructors (class methods):
- today()
\begin{funcdesc}
{
today
}{}
utcnow()
\methodline
{
utcnow
}{}
utcfromtimestamp(timestamp)
\methodline
{
utcfromtimestamp
}{
timestamp
}
fromordinal(ordinal)
\methodline
{
fromordinal
}{
ordinal
}
These are the same as the
\class
{
datetime
}
class methods of the
These are the same as the
\class
{
datetime
}
class methods of the
same names, except that they construct a
\class
{
datetimetz
}
same names, except that they construct a
\class
{
datetimetz
}
object, with tzinfo
\code
{
None
}
.
object, with tzinfo
\code
{
None
}
.
\end{funcdesc}
- now([tzinfo=None])
\begin{funcdesc}
{
now
}{
\optional
{
tzinfo=None
}}
fromtimestamp(timestamp[, tzinfo=None])
\methodline
{
fromtimestamp
}{
timestamp
\optional
{
, tzinfo=None
}}
These are the same as the
\class
{
datetime
}
class methods of the same names,
These are the same as the
\class
{
datetime
}
class methods of the same names,
except that they accept an additional, optional tzinfo argument, and
except that they accept an additional, optional tzinfo argument, and
construct a
\class
{
datetimetz
}
object with that
\class
{
tzinfo
}
object attached.
construct a
\class
{
datetimetz
}
object with that
\class
{
tzinfo
}
object attached.
\end{funcdesc}
- combine(date, time)
\begin{funcdesc}
{
combine
}{
date, time
}
This is the same as
\method
{
datetime.combine()
}
, except that it constructs
This is the same as
\method
{
datetime.combine()
}
, except that it constructs
a
\class
{
datetimetz
}
object, and, if the time object is of type timetz,
a
\class
{
datetimetz
}
object, and, if the time object is of type timetz,
the
\class
{
datetimetz
}
object has the same
\class
{
tzinfo
}
object as the time object.
the
\class
{
datetimetz
}
object has the same
\class
{
tzinfo
}
object as the time object.
\end{funcdesc}
Class attributes:
Class attributes:
.min
\begin{memberdesc}
{
min
}
The earliest representable datetimetz,
The earliest representable
\class
{
datetimetz
}
,
datetimetz(MINYEAR, 1, 1).
\code
{
datetimetz(MINYEAR, 1, 1)
}
.
\end{memberdesc}
.max
\begin{memberdesc}
{
max
}
The latest representable datetime,
The latest representable
\class
{
datetime
}
,
datetimetz(MAXYEAR, 12, 31, 23, 59, 59, 999999).
\code
{
datetimetz(MAXYEAR, 12, 31, 23, 59, 59, 999999)
}
.
\end{memberdesc}
.resolution
\begin{memberdesc}
{
resolution
}
The smallest possible difference between non-equal datetimetz
The smallest possible difference between non-equal
\class
{
datetimetz
}
objects, timedelta(microseconds=1).
objects,
\code
{
timedelta(microseconds=1)
}
.
\end{memberdesc}
Instance attributes
(read-only)
:
Instance attributes
, all read-only
:
.year between MINYEAR and MAXYEAR inclusive
\begin{memberdesc}
{
year
}
.month between 1 and 12 inclusive
Between MINYEAR and MAXYEAR inclusive
.day between 1 and the number of days in the given month
\end{memberdesc}
\begin{memberdesc}
{
month
}
Between 1 and 12 inclusive
\end{memberdesc}
\begin{memberdesc}
{
day
}
Between 1 and the number of days in the given month
of the given year
of the given year
.hour in range(24)
\end{memberdesc}
.minute in range(60)
\begin{memberdesc}
{
hour
}
.second in range(60)
In
\code
{
range(24)
}
.
.microsecond in range(1000000)
\end{memberdesc}
.tzinfo the object passed as the
\var
{
tzinfo
}
argument to
\begin{memberdesc}
{
minute
}
In
\code
{
range(60)
}
.
\end{memberdesc}
\begin{memberdesc}
{
second
}
In
\code
{
range(60)
}
.
\end{memberdesc}
\begin{memberdesc}
{
microsecond
}
In
\code
{
range(1000000)
}
.
\end{memberdesc}
\begin{memberdesc}
{
tzinfo
}
The object passed as the
\var
{
tzinfo
}
argument to
the
\class
{
datetimetz
}
constructor, or
\code
{
None
}
the
\class
{
datetimetz
}
constructor, or
\code
{
None
}
if none was passed.
if none was passed.
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -1105,30 +1199,33 @@ Supported operations:
...
@@ -1105,30 +1199,33 @@ Supported operations:
Instance methods:
Instance methods:
- date()
\begin{methoddesc}
{
date
}{}
time()
\methodline
{
time
}{}
toordinal()
\methodline
{
toordinal
}{}
weekday()
\methodline
{
weekday
}{}
isoweekday()
\methodline
{
isoweekday
}{}
isocalendar()
\methodline
{
isocalendar
}{}
ctime()
\methodline
{
ctime
}{}
__
str
__
()
\methodline
{__
str
__}{}
strftime(format)
\methodline
{
strftime
}{
format
}
These are the same as the
\class
{
datetime
}
methods of the same names.
These are the same as the
\class
{
datetime
}
methods of the same names.
\end{methoddesc}
- timetz()
\begin{methoddesc}
{
timetz
}{}
Return
\class
{
timetz
}
object with same hour, minute, second, microsecond,
Return
\class
{
timetz
}
object with same hour, minute, second, microsecond,
and tzinfo.
and tzinfo.
\end{methoddesc}
- replace(
year=, month=, day=, hour=, minute=, second=, microsecond=,
\begin{methoddesc}
{
replace
}{
year=, month=, day=, hour=, minute=, second=, microsecond=,
tzinfo=
)
tzinfo=
}
Return a datetimetz with the same value, except for those fields given
Return a datetimetz with the same value, except for those fields given
new values by whichever keyword arguments are specified. Note that
new values by whichever keyword arguments are specified. Note that
\code
{
tzinfo=None
}
can be specified to create a naive datetimetz from
\code
{
tzinfo=None
}
can be specified to create a naive datetimetz from
an aware datetimetz.
an aware datetimetz.
\end{methoddesc}
- astimezone(tz)
\begin{methoddesc}
{
astimezone
}{
tz
}
Return a
\class
{
datetimetz
}
with new tzinfo member
\var
{
tz
}
.
\var
{
tz
}
Return a
\class
{
datetimetz
}
with new tzinfo member
\var
{
tz
}
.
\var
{
tz
}
must be
\code
{
None
}
, or an instance of a
\class
{
tzinfo
}
subclass. If
must be
\code
{
None
}
, or an instance of a
\class
{
tzinfo
}
subclass. If
\var
{
tz
}
is
\code
{
None
}
, self is naive, or
\var
{
tz
}
is
\code
{
None
}
, self is naive, or
...
@@ -1143,32 +1240,37 @@ Instance methods:
...
@@ -1143,32 +1240,37 @@ Instance methods:
\begin{verbatim}
\begin{verbatim}
(self - (self.utcoffset() - tz.utcoffset(self)).replace(tzinfo=tz)
(self - (self.utcoffset() - tz.utcoffset(self)).replace(tzinfo=tz)
\end{verbatim}
\end{verbatim}
where the result of
\code
{
tz.u
c
tcoffset(self)
}
is converted to a
where the result of
\code
{
tz.utcoffset(self)
}
is converted to a
\class
{
timedelta
}
if it's an integer.
\class
{
timedelta
}
if it's an integer.
\end{methoddesc}
- utcoffset()
\begin{methoddesc}
{
utcoffset
}{}
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
\code
{
tzinfo.utcoffset(self)
}
converted to a
\class
{
timedelta
}
\code
{
tzinfo.utcoffset(self)
}
converted to a
\class
{
timedelta
}
object.
object.
\end{methoddesc}
- tzname()
\begin{methoddesc}
{
tzname
}{}
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
\code
{
tzinfo.tzname(self)
}
.
returns
\code
{
tzinfo.tzname(self)
}
.
\end{methoddesc}
- dst()
\begin{methoddesc}
{
dst
}{}
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
If
\member
{
tzinfo
}
is
\code
{
None
}
, returns
\code
{
None
}
, else
\code
{
tzinfo.dst(self)
}
converted to a
\class
{
timedelta
}
\code
{
tzinfo.dst(self)
}
converted to a
\class
{
timedelta
}
object.
object.
\end{methoddesc}
- timetuple()
\begin{methoddesc}
{
timetuple
}{}
Like
\function
{
datetime.timetuple()
}
, but sets the
Like
\function
{
datetime.timetuple()
}
, but sets the
\member
{
tm
_
isdst
}
flag according to the
\method
{
dst()
}
method: if
\member
{
tm
_
isdst
}
flag according to the
\method
{
dst()
}
method: if
\method
{
dst()
}
returns
\code
{
None
}
,
\member
{
tm
_
isdst
}
is set to
\method
{
dst()
}
returns
\code
{
None
}
,
\member
{
tm
_
isdst
}
is set to
\code
{
-1
}
; else if
\method
{
dst()
}
returns a non-zero value,
\code
{
-1
}
; else if
\method
{
dst()
}
returns a non-zero value,
\member
{
tm
_
isdst
}
is set to
\code
{
1
}
; else
\code
{
tm
_
isdst
}
is set
\member
{
tm
_
isdst
}
is set to
\code
{
1
}
; else
\code
{
tm
_
isdst
}
is set
to
\code
{
0
}
.
to
\code
{
0
}
.
\end{methoddesc}
- utctimetuple()
\begin{methoddesc}
{
utctimetuple
}{}
If
\class
{
datetimetz
}
instance
\var
{
d
}
is
\naive
, this is the same as
If
\class
{
datetimetz
}
instance
\var
{
d
}
is
\naive
, this is the same as
\code
{
\var
{
d
}
.timetuple()
}
except that
\member
{
tm
_
isdst
}
is forced to 0
\code
{
\var
{
d
}
.timetuple()
}
except that
\member
{
tm
_
isdst
}
is forced to 0
regardless of what
\code
{
d.dst()
}
returns. DST is never in effect
regardless of what
\code
{
d.dst()
}
returns. DST is never in effect
...
@@ -1181,8 +1283,9 @@ Instance methods:
...
@@ -1181,8 +1283,9 @@ Instance methods:
\constant
{
MINYEAR
}
-1 or
\constant
{
MAXYEAR
}
+1, if
\var
{
d
}
.year was
\constant
{
MINYEAR
}
-1 or
\constant
{
MAXYEAR
}
+1, if
\var
{
d
}
.year was
\code
{
MINYEAR
}
or
\code
{
MAXYEAR
}
and UTC adjustment spills over a
\code
{
MINYEAR
}
or
\code
{
MAXYEAR
}
and UTC adjustment spills over a
year boundary.
year boundary.
\end{methoddesc}
- isoformat(sep='T')
\begin{methoddesc}
{
isoformat
}{
sep='T'
}
Return a string representing the date and time in ISO 8601 format,
Return a string representing the date and time in ISO 8601 format,
YYYY-MM-DDTHH:MM:SS.mmmmmm
YYYY-MM-DDTHH:MM:SS.mmmmmm
or, if
\member
{
microsecond
}
is 0,
or, if
\member
{
microsecond
}
is 0,
...
@@ -1207,6 +1310,7 @@ Instance methods:
...
@@ -1207,6 +1310,7 @@ Instance methods:
>>> datetimetz(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
>>> datetimetz(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
'2002-12-25 00:00:00-06:39'
'2002-12-25 00:00:00-06:39'
\end{verbatim}
\end{verbatim}
\end{methoddesc}
\code
{
str(
\var
{
d
}
)
}
is equivalent to
\code
{
\var
{
d
}
.isoformat(' ')
}
.
\code
{
str(
\var
{
d
}
)
}
is equivalent to
\code
{
\var
{
d
}
.isoformat(' ')
}
.
...
@@ -1247,7 +1351,7 @@ For an aware object:
...
@@ -1247,7 +1351,7 @@ For an aware object:
\item
[\code{\%Z}]
\item
[\code{\%Z}]
If
\method
{
tzname()
}
returns
\code
{
None
}
,
\code
{
\%
Z
}
is replaced
If
\method
{
tzname()
}
returns
\code
{
None
}
,
\code
{
\%
Z
}
is replaced
by an empty string.
El
se
\code
{
\%
Z
}
is replaced by the returned
by an empty string.
Otherwi
se
\code
{
\%
Z
}
is replaced by the returned
value, which must be a string.
value, which must be a string.
\end{itemize}
\end{itemize}
...
@@ -1264,6 +1368,8 @@ varies across platforms. Regardless of platform, years before 1900
...
@@ -1264,6 +1368,8 @@ varies across platforms. Regardless of platform, years before 1900
cannot be used.
cannot be used.
\begin{comment}
\subsection
{
C API
}
\subsection
{
C API
}
Struct typedefs:
Struct typedefs:
...
@@ -1320,3 +1426,5 @@ return ints:
...
@@ -1320,3 +1426,5 @@ return ints:
PyDateTime
_
TIME
_
GET
_
MINUTE(o)
PyDateTime
_
TIME
_
GET
_
MINUTE(o)
PyDateTime
_
TIME
_
GET
_
SECOND(o)
PyDateTime
_
TIME
_
GET
_
SECOND(o)
PyDateTime
_
TIME
_
GET
_
MICROSECOND(o)
PyDateTime
_
TIME
_
GET
_
MICROSECOND(o)
\end{comment}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment