FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Doc/includes/sqlite3/adapter_datetime.py at master · python-emscripten/cpython · GitHub
python-emscripten
cpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
adapter_datetime.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
17 lines (12 loc) · 323 Bytes
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
adapter_datetime.py
Copy path
File metadata and controls
17 lines (12 loc) · 323 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import
sqlite3
import
datetime
import
time
def
adapt_datetime
(
ts
):
return
time
.
mktime
(
ts
.
timetuple
())
sqlite3
.
register_adapter
(
datetime
.
datetime
,
adapt_datetime
)
con
=
sqlite3
.
connect
(
":memory:"
)
cur
=
con
.
cursor
()
now
=
datetime
.
datetime
.
now
()
cur
.
execute
(
"select ?"
, (
now
,))
print
(
cur
.
fetchone
()[
0
])
con
.
close
()
Back
|
FazBrowse Home
|
New Git URL