diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-01-23 19:58:02 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-01-23 19:58:02 (GMT) |
commit | 10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d (patch) | |
tree | a08fd27ddaa04db1b7cad9c552b08fd964e53a68 /Doc | |
parent | 250684ddd8223de98b5944d13e89a12673d0a51a (diff) | |
download | cpython-10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d.zip cpython-10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d.tar.gz cpython-10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d.tar.bz2 |
Reimplemented datetime.now() to be useful.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libdatetime.tex | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Doc/lib/libdatetime.tex b/Doc/lib/libdatetime.tex index 9133f1e..b890024 100644 --- a/Doc/lib/libdatetime.tex +++ b/Doc/lib/libdatetime.tex @@ -525,19 +525,25 @@ Other constructors, all class methods: See also \method{now()}, \method{fromtimestamp()}. \end{methoddesc} -\begin{methoddesc}{now}{} - Return the current local datetime. This is like \method{today()}, - but, if possible, supplies more precision than can be gotten from - going through a \function{time.time()} timestamp (for example, - this may be possible on platforms that supply the C +\begin{methoddesc}{now(tz=None)}{} + Return the current local date and time. If optional argument + \var{tz} is \code{None} or not specified, this is like + \method{today()}, but, if possible, supplies more precision than can + be gotten from going through a \function{time.time()} timestamp (for + example, this may be possible on platforms supplying the C \cfunction{gettimeofday()} function). + + Else \var{tz} must be an instance of a class \class{tzinfo} subclass, + and the current date and time are translated to \var{tz}'s time + zone. In this case the result is equivalent to + \code{\var{tz}.fromutc(datetime.utcnow().replace(tzinfo=\var{tz})}. See also \method{today()}, \method{utcnow()}. \end{methoddesc} \begin{methoddesc}{utcnow}{} - Return the current UTC datetime, with \member{tzinfo} \code{None}. - This is like \method{now()}, but - returns the current UTC date and time. + Return the current UTC date and time, with \member{tzinfo} \code{None}. + This is like \method{now()}, but returns the current UTC date and time, + as a naive \class{datetime} object. See also \method{now()}. \end{methoddesc} |