Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
436eadd4
Commit
436eadd4
authored
Dec 31, 2002
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General style conformance. Markup some unmarked constructs.
parent
2cb54025
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
478 additions
and
449 deletions
+478
-449
Doc/lib/libdatetime.tex
Doc/lib/libdatetime.tex
+478
-449
No files found.
Doc/lib/libdatetime.tex
View file @
436eadd4
...
@@ -146,10 +146,10 @@ between two dates or times.
...
@@ -146,10 +146,10 @@ between two dates or times.
internally. Arguments are converted to those units:
internally. Arguments are converted to those units:
\begin{verbatim}
\begin{verbatim}
A millisecond is converted to 1000 microseconds.
A millisecond is converted to 1000 microseconds.
A minute is converted to 60 seconds.
A minute is converted to 60 seconds.
An hour is converted to 3600 seconds.
An hour is converted to 3600 seconds.
A week is converted to 7 days.
A week is converted to 7 days.
\end{verbatim}
\end{verbatim}
and days, seconds and microseconds are then normalized so that the
and days, seconds and microseconds are then normalized so that the
...
@@ -219,7 +219,8 @@ Supported operations:
...
@@ -219,7 +219,8 @@ Supported operations:
{
(1)
}
{
(1)
}
\lineiii
{
\var
{
t1
}
=
\var
{
t2
}
*
\var
{
i
}
or
\var
{
t1
}
=
\var
{
i
}
*
\var
{
t2
}}
\lineiii
{
\var
{
t1
}
=
\var
{
t2
}
*
\var
{
i
}
or
\var
{
t1
}
=
\var
{
i
}
*
\var
{
t2
}}
{
Delta multiplied by an integer or long.
{
Delta multiplied by an integer or long.
Afterwards
\var
{
t1
}
// i ==
\var
{
t2
}
is true, provided
\code
{
i != 0
}
.
Afterwards
\var
{
t1
}
// i ==
\var
{
t2
}
is true,
provided
\code
{
i != 0
}
.
In general,
\var
{
t1
}
* i ==
\var
{
t1
}
* (i-1) +
\var
{
t1
}
is true.
}
In general,
\var
{
t1
}
* i ==
\var
{
t1
}
* (i-1) +
\var
{
t1
}
is true.
}
{
(1)
}
{
(1)
}
\lineiii
{
\var
{
t1
}
=
\var
{
t2
}
//
\var
{
i
}}
\lineiii
{
\var
{
t1
}
=
\var
{
t2
}
//
\var
{
i
}}
...
@@ -233,25 +234,22 @@ Supported operations:
...
@@ -233,25 +234,22 @@ Supported operations:
-
\var
{
t1.microseconds
}
),and to
\var
{
t1
}
* -1.
}
-
\var
{
t1.microseconds
}
),and to
\var
{
t1
}
* -1.
}
{
(1)(3)
}
{
(1)(3)
}
\lineiii
{
abs(
\var
{
t
}
)
}
\lineiii
{
abs(
\var
{
t
}
)
}
{
equivalent to +
\var
{
t
}
when
\code
{
t.days >= 0
}
, and to
-
\var
{
t
}
when
{
equivalent to +
\var
{
t
}
when
\code
{
t.days >= 0
}
, and to
\code
{
t.days < 0
}
.
}
-
\var
{
t
}
when
\code
{
t.days < 0
}
.
}
{
(1)
}
{
(1)
}
\end{tableiii}
\end{tableiii}
\noindent
\noindent
Notes:
Notes:
\begin{description}
\begin{description}
\item
[(1)]
\item
[(1)]
This is exact, but may overflow.
This is exact, but may overflow.
\item
[(2)]
\item
[(2)]
Division by 0 raises
\exception
{
ZeroDivisionError
}
.
Division by 0 raises
\exception
{
ZeroDivisionError
}
.
\item
[(3)]
\item
[(3)]
-
\var
{
timedelta.max
}
is not representable as a
\class
{
timedelta
}
object.
-
\var
{
timedelta.max
}
is not representable as a
\class
{
timedelta
}
object.
\end{description}
\end{description}
In addition to the operations listed above
\class
{
timedelta
}
objects
In addition to the operations listed above
\class
{
timedelta
}
objects
...
@@ -280,18 +278,17 @@ computations. See the book for algorithms for converting between
...
@@ -280,18 +278,17 @@ computations. See the book for algorithms for converting between
proleptic Gregorian ordinals and many other calendar systems.
proleptic Gregorian ordinals and many other calendar systems.
\begin{funcdesc}
{
date
}{
year, month, day
}
\begin{funcdesc}
{
date
}{
year, month, day
}
All arguments are required. Arguments may be ints or longs, in the
All arguments are required. Arguments may be ints or longs, in the
following ranges:
following ranges:
\begin{itemize}
\begin{itemize}
\item
\code
{
MINYEAR <=
\var
{
year
}
<= MAXYEAR
}
\item
\code
{
MINYEAR <=
\var
{
year
}
<= MAXYEAR
}
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
\code
{
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
}
is raised.
is raised.
\end{funcdesc}
\end{funcdesc}
Other constructors, all class methods:
Other constructors, all class methods:
...
@@ -312,9 +309,10 @@ Other constructors, all class methods:
...
@@ -312,9 +309,10 @@ 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
is raised unless
\code
{
1 <=
\var
{
ordinal
}
<= date.max.toordinal()
}
. For any
raised unless
\code
{
1 <=
\var
{
ordinal
}
<= date.max.toordinal()
}
.
date
\var
{
d
}
,
\code
{
date.fromordinal(
\var
{
d
}
.toordinal()) ==
\var
{
d
}}
.
For any date
\var
{
d
}
,
\code
{
date.fromordinal(
\var
{
d
}
.toordinal()) ==
\var
{
d
}}
.
\end{methoddesc}
\end{methoddesc}
Class attributes:
Class attributes:
...
@@ -335,16 +333,16 @@ Class attributes:
...
@@ -335,16 +333,16 @@ Class attributes:
Instance attributes (read-only):
Instance attributes (read-only):
\begin{memberdesc}
{
year
}
\begin{memberdesc}
{
year
}
Between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
inclusive
Between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
inclusive
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
month
}
\begin{memberdesc}
{
month
}
Between 1 and 12 inclusive.
Between 1 and 12 inclusive.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
day
}
\begin{memberdesc}
{
day
}
Between 1 and the number of days in the given month
Between 1 and the number of days in the given month of the given
of the given
year.
year.
\end{memberdesc}
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -409,23 +407,27 @@ Instance methods:
...
@@ -409,23 +407,27 @@ Instance methods:
\#
day of year
\#
day of year
-1)
}
-1)
}
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
toordinal
}{}
\begin{methoddesc}
{
toordinal
}{}
Return the proleptic Gregorian ordinal of the date, where January 1
Return the proleptic Gregorian ordinal of the date, where January 1
of year 1 has ordinal 1. For any
\class
{
date
}
object
\var
{
d
}
,
of year 1 has ordinal 1. For any
\class
{
date
}
object
\var
{
d
}
,
\code
{
date.fromordinal(
\var
{
d
}
.toordinal()) ==
\var
{
d
}}
.
\code
{
date.fromordinal(
\var
{
d
}
.toordinal()) ==
\var
{
d
}}
.
\end{methoddesc}
\end{methoddesc}
\begin{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. For example, date(2002, 12, 4).weekday() == 2, a
Sunday is 6. For example, date(2002, 12, 4).weekday() == 2, a
Wednesday.
Wednesday.
See also
\method
{
isoweekday()
}
.
See also
\method
{
isoweekday()
}
.
\end{methoddesc}
\end{methoddesc}
\begin{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. For example, date(2002, 12, 4).isoweekday() == 3, a
Sunday is 7. For example, date(2002, 12, 4).isoweekday() == 3, a
Wednesday.
Wednesday.
See also
\method
{
weekday()
}
,
\method
{
isocalendar()
}
.
See also
\method
{
weekday()
}
,
\method
{
isocalendar()
}
.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
isocalendar
}{}
\begin{methoddesc}
{
isocalendar
}{}
Return a 3-tuple, (ISO year, ISO week number, ISO weekday).
Return a 3-tuple, (ISO year, ISO week number, ISO weekday).
...
@@ -446,15 +448,18 @@ Instance methods:
...
@@ -446,15 +448,18 @@ Instance methods:
date(2003, 12, 29).isocalendar() == (2004, 1, 1)
date(2003, 12, 29).isocalendar() == (2004, 1, 1)
date(2004, 1, 4).isocalendar() == (2004, 1, 7)
date(2004, 1, 4).isocalendar() == (2004, 1, 7)
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
isoformat
}{}
\begin{methoddesc}
{
isoformat
}{}
Return a string representing the date in ISO 8601 format,
Return a string representing the date in ISO 8601 format,
'YYYY-MM-DD'. For example,
'YYYY-MM-DD'. For example,
date(2002, 12, 4).isoformat() == '2002-12-04'.
date(2002, 12, 4).isoformat() == '2002-12-04'.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{__
str
__}{}
\begin{methoddesc}
{__
str
__}{}
For a date
\var
{
d
}
,
\code
{
str(
\var
{
d
}
)
}
is equivalent to
For a date
\var
{
d
}
,
\code
{
str(
\var
{
d
}
)
}
is equivalent to
\code
{
\var
{
d
}
.isoformat()
}
.
\code
{
\var
{
d
}
.isoformat()
}
.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
ctime
}{}
\begin{methoddesc}
{
ctime
}{}
Return a string representing the date, for example
Return a string representing the date, for example
date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
...
@@ -464,6 +469,7 @@ Instance methods:
...
@@ -464,6 +469,7 @@ Instance methods:
(which
\function
{
time.ctime()
}
invokes, but which
(which
\function
{
time.ctime()
}
invokes, but which
\method
{
date.ctime()
}
does not invoke) conforms to the C standard.
\method
{
date.ctime()
}
does not invoke) conforms to the C standard.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
strftime
}{
format
}
\begin{methoddesc}
{
strftime
}{
format
}
Return a string representing the date, controlled by an explicit
Return a string representing the date, controlled by an explicit
format string. Format codes referring to hours, minutes or seconds
format string. Format codes referring to hours, minutes or seconds
...
@@ -483,10 +489,10 @@ day.
...
@@ -483,10 +489,10 @@ day.
\begin{funcdesc}
{
datetime
}{
year, month, day,
\begin{funcdesc}
{
datetime
}{
year, month, day,
hour=0, minute=0, second=0, microsecond=0
}
hour=0, minute=0, second=0, microsecond=0
}
The year, month and day arguments are required. Arguments may be ints
The year, month and day arguments are required. Arguments may be
or longs, in the following ranges:
ints
or longs, in the following ranges:
\begin{itemize}
\begin{itemize}
\item
\code
{
\member
{
MINYEAR
}
<=
\var
{
year
}
<=
\member
{
MAXYEAR
}}
\item
\code
{
\member
{
MINYEAR
}
<=
\var
{
year
}
<=
\member
{
MAXYEAR
}}
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
\code
{
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
}
...
@@ -494,10 +500,10 @@ or longs, in the following ranges:
...
@@ -494,10 +500,10 @@ or longs, in the following ranges:
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
\code
{
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,
\exception
{
ValueError
}
\exception
{
ValueError
}
is raised.
is raised.
\end{funcdesc}
\end{funcdesc}
Other constructors, all class methods:
Other constructors, all class methods:
...
@@ -582,31 +588,32 @@ Class attributes:
...
@@ -582,31 +588,32 @@ Class attributes:
Instance attributes (read-only):
Instance attributes (read-only):
\begin{memberdesc}
{
year
}
\begin{memberdesc}
{
year
}
Between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
inclusive
Between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
inclusive
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
month
}
\begin{memberdesc}
{
month
}
Between 1 and 12 inclusive
Between 1 and 12 inclusive
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
day
}
\begin{memberdesc}
{
day
}
Between 1 and the number of days in the given month of the given year.
Between 1 and the number of days in the given month of the given
year.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
hour
}
\begin{memberdesc}
{
hour
}
In
\code
{
range(24)
}
.
In
\code
{
range(24)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
minute
}
\begin{memberdesc}
{
minute
}
In
\code
{
range(60)
}
.
In
\code
{
range(60)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
second
}
\begin{memberdesc}
{
second
}
In
\code
{
range(60)
}
.
In
\code
{
range(60)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
microsecond
}
\begin{memberdesc}
{
microsecond
}
In
\code
{
range(1000000)
}
.
In
\code
{
range(1000000)
}
.
\end{memberdesc}
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -659,7 +666,8 @@ Instance methods:
...
@@ -659,7 +666,8 @@ Instance methods:
Return time object with same hour, minute, second and microsecond.
Return time object with same hour, minute, second and microsecond.
\end{methoddesc}
\end{methoddesc}
\begin{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}
\end{methoddesc}
...
@@ -744,8 +752,7 @@ Instance methods:
...
@@ -744,8 +752,7 @@ Instance methods:
A
\class
{
time
}
object represents an idealized time of day, independent
A
\class
{
time
}
object represents an idealized time of day, independent
of day and timezone.
of day and timezone.
\begin{funcdesc}
{
hour=0, minute=0, second=0, microsecond=0
}
\begin{funcdesc}
{
time
}{
hour=0, minute=0, second=0, microsecond=0
}
All arguments are optional. They may be ints or longs, in the
All arguments are optional. They may be ints or longs, in the
following ranges:
following ranges:
...
@@ -779,16 +786,19 @@ Class attributes:
...
@@ -779,16 +786,19 @@ Class attributes:
Instance attributes (read-only):
Instance attributes (read-only):
\begin{memberdesc}
{
hour
}
\begin{memberdesc}
{
hour
}
In
\code
{
range(24)
}
.
In
\code
{
range(24)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
minute
}
\begin{memberdesc}
{
minute
}
In
\code
{
range(60)
}
.
In
\code
{
range(60)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
second
}
\begin{memberdesc}
{
second
}
In
\code
{
range(60)
}
.
In
\code
{
range(60)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
microsecond
}
\begin{memberdesc}
{
microsecond
}
In
\code
{
range(1000000)
}
.
In
\code
{
range(1000000)
}
.
\end{memberdesc}
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -872,6 +882,7 @@ implement all of them.
...
@@ -872,6 +882,7 @@ implement all of them.
\class
{
timedelta
}
object representing a whole number of minutes
\class
{
timedelta
}
object representing a whole number of minutes
in the same range. Most implementations of
\method
{
utcoffset()
}
in the same range. Most implementations of
\method
{
utcoffset()
}
will probably look like:
will probably look like:
\begin{verbatim}
\begin{verbatim}
return CONSTANT # fixed-offset class
return CONSTANT # fixed-offset class
return CONSTANT + self.dst(dt) # daylight-aware class
return CONSTANT + self.dst(dt) # daylight-aware class
...
@@ -880,19 +891,20 @@ implement all of them.
...
@@ -880,19 +891,20 @@ implement all of them.
\begin{methoddesc}
{
tzname
}{
self, dt
}
\begin{methoddesc}
{
tzname
}{
self, 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
\var
{
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
in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT",
in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT",
"US/Eastern", "America/New York" are all valid replies. Return
"US/Eastern", "America/New York" are all valid replies. Return
\code
{
None
}
if a string name isn't known. Note that this is a method
\code
{
None
}
if a string name isn't known. Note that this is a method
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
\var
{
dt
}
passed, especially if the
\class
{
tzinfo
}
class is
accounting for DST.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
dst
}{
self, dt
}
\begin{methoddesc}
{
dst
}{
self, 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
\code
{
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
\class
{
timedelta
}
object (see
\method
{
utcoffset()
}
for details).
\class
{
timedelta
}
object (see
\method
{
utcoffset()
}
for details).
Note that DST offset, if applicable, has
Note that DST offset, if applicable, has
...
@@ -937,7 +949,6 @@ particular day, and subject to adjustment via a \class{tzinfo} object.
...
@@ -937,7 +949,6 @@ particular day, and subject to adjustment via a \class{tzinfo} object.
Constructor:
Constructor:
\begin{funcdesc}
{
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:
...
@@ -971,13 +982,26 @@ Class attributes:
...
@@ -971,13 +982,26 @@ Class attributes:
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)
.tzinfo the object passed as the tzinfo argument to the
\begin{memberdesc}
{
minute
}
\class
{
timetz
}
constructor, or
\code
{
None
}
if none
In
\code
{
range(60)
}
.
was passed.
\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 tzinfo argument to the
\class
{
timetz
}
constructor, or
\code
{
None
}
if none was passed.
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -1069,13 +1093,13 @@ from a \class{date} object and a \class{timetz} object.
...
@@ -1069,13 +1093,13 @@ from a \class{date} object and a \class{timetz} object.
Constructor:
Constructor:
\begin{funcdesc}
{
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:
\begin{itemize}
\begin{itemize}
\item
\code
{
MINYEAR <=
\var
{
year
}
<= MAXYEAR
}
\item
\code
{
MINYEAR <=
\var
{
year
}
<= MAXYEAR
}
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
\code
{
1 <=
\var
{
month
}
<= 12
}
\item
\code
{
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
}
...
@@ -1083,7 +1107,7 @@ Constructor:
...
@@ -1083,7 +1107,7 @@ Constructor:
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
\item
\code
{
0 <=
\var
{
minute
}
< 60
}
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
\code
{
0 <=
\var
{
second
}
< 60
}
\item
\code
{
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,
\exception
{
ValueError
}
is raised.
\exception
{
ValueError
}
is raised.
...
@@ -1092,27 +1116,27 @@ Constructor:
...
@@ -1092,27 +1116,27 @@ Constructor:
Other constructors (class methods):
Other constructors (class methods):
\begin{funcdesc}
{
today
}{}
\begin{funcdesc}
{
today
}{}
\methodline
{
utcnow
}{}
\methodline
{
utcnow
}{}
\methodline
{
utcfromtimestamp
}{
timestamp
}
\methodline
{
utcfromtimestamp
}{
timestamp
}
\methodline
{
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}
\end{funcdesc}
\begin{funcdesc}
{
now
}{
\optional
{
tzinfo=None
}}
\begin{funcdesc}
{
now
}{
\optional
{
tzinfo=None
}}
\methodline
{
fromtimestamp
}{
timestamp
\optional
{
, tzinfo=None
}}
\methodline
{
fromtimestamp
}{
timestamp
\optional
{
, tzinfo=None
}}
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,
same names, except that they accept an additional, optional tzinfo
except that they accept an additional, optional tzinfo argument, and
argument, and construct a
\class
{
datetimetz
}
object with that
construct a
\class
{
datetimetz
}
object with that
\class
{
tzinfo
}
object attached.
\class
{
tzinfo
}
object attached.
\end{funcdesc}
\end{funcdesc}
\begin{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
a
\class
{
datetimetz
}
object, and, if the time object is of type timetz,
constructs a
\class
{
datetimetz
}
object, and, if the time object is
the
\class
{
datetimetz
}
object has the same
\class
{
tzinfo
}
object as the time object.
of type timetz, the
\class
{
datetimetz
}
object has the same
\class
{
tzinfo
}
object as the time object.
\end{funcdesc}
\end{funcdesc}
Class attributes:
Class attributes:
...
@@ -1135,31 +1159,37 @@ Class attributes:
...
@@ -1135,31 +1159,37 @@ Class attributes:
Instance attributes, all read-only:
Instance attributes, all read-only:
\begin{memberdesc}
{
year
}
\begin{memberdesc}
{
year
}
Between MINYEAR and MAXYEAR inclusive
Between
\constant
{
MINYEAR
}
and
\constant
{
MAXYEAR
}
, inclusive.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
month
}
\begin{memberdesc}
{
month
}
Between 1 and 12 inclusive
Between 1 and 12 inclusive
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
day
}
\begin{memberdesc}
{
day
}
Between 1 and the number of days in the given month
Between 1 and the number of days in the given month of the given
of the given year
year.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
hour
}
\begin{memberdesc}
{
hour
}
In
\code
{
range(24)
}
.
In
\code
{
range(24)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
minute
}
\begin{memberdesc}
{
minute
}
In
\code
{
range(60)
}
.
In
\code
{
range(60)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
second
}
\begin{memberdesc}
{
second
}
In
\code
{
range(60)
}
.
In
\code
{
range(60)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
microsecond
}
\begin{memberdesc}
{
microsecond
}
In
\code
{
range(1000000)
}
.
In
\code
{
range(1000000)
}
.
\end{memberdesc}
\end{memberdesc}
\begin{memberdesc}
{
tzinfo
}
\begin{memberdesc}
{
tzinfo
}
The object passed as the
\var
{
tzinfo
}
argument to
The object passed as the
\var
{
tzinfo
}
argument to the
the
\class
{
datetimetz
}
constructor, or
\code
{
None
}
\class
{
datetimetz
}
constructor, or
\code
{
None
}
if none was passed.
if none was passed.
\end{memberdesc}
\end{memberdesc}
Supported operations:
Supported operations:
...
@@ -1224,16 +1254,15 @@ Supported operations:
...
@@ -1224,16 +1254,15 @@ Supported operations:
Instance methods:
Instance methods:
\begin{methoddesc}
{
date
}{}
\begin{methoddesc}
{
date
}{}
\methodline
{
time
}{}
\methodline
{
time
}{}
\methodline
{
toordinal
}{}
\methodline
{
toordinal
}{}
\methodline
{
weekday
}{}
\methodline
{
weekday
}{}
\methodline
{
isoweekday
}{}
\methodline
{
isoweekday
}{}
\methodline
{
isocalendar
}{}
\methodline
{
isocalendar
}{}
\methodline
{
ctime
}{}
\methodline
{
ctime
}{}
\methodline
{__
str
__}{}
\methodline
{__
str
__}{}
\methodline
{
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}
\end{methoddesc}
\begin{methoddesc}
{
timetz
}{}
\begin{methoddesc}
{
timetz
}{}
...
@@ -1241,8 +1270,8 @@ These are the same as the \class{datetime} methods of the same names.
...
@@ -1241,8 +1270,8 @@ These are the same as the \class{datetime} methods of the same names.
and tzinfo.
and tzinfo.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
replace
}{
year=, month=, day=, hour=, minute=, second=,
microsecond=,
\begin{methoddesc}
{
replace
}{
year=, month=, day=, hour=, minute=, second=,
tzinfo=
}
microsecond=,
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
...
...
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