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
ef1b50de
Commit
ef1b50de
authored
Dec 06, 2005
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add common usage example
parent
5ed262b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Doc/lib/libdatetime.tex
Doc/lib/libdatetime.tex
+17
-0
No files found.
Doc/lib/libdatetime.tex
View file @
ef1b50de
...
@@ -1419,3 +1419,20 @@ C standard added additional format codes.
...
@@ -1419,3 +1419,20 @@ C standard added additional format codes.
The exact range of years for which
\method
{
strftime()
}
works also
The exact range of years for which
\method
{
strftime()
}
works also
varies across platforms. Regardless of platform, years before 1900
varies across platforms. Regardless of platform, years before 1900
cannot be used.
cannot be used.
\subsection
{
Examples
}
\subsubsection
{
Creating Datetime Objects from Formatted Strings
}
The
\class
{
datetime
}
class does not directly support parsing formatted time
strings. You can use
\function
{
time.strptime
}
to do the parsing and create
a
\class
{
datetime
}
object from the tuple it returns:
\begin{verbatim}
>>> s = "2005-12-06T12:13:14"
>>> from datetime import datetime
>>> from time import strptime
>>> datetime(*strptime(s, "
%Y-%m-%dT%H:%M:%S")[0:6])
datetime.datetime(2005, 12, 6, 12, 13, 14)
\end{verbatim}
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