-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqliteReader.py
More file actions
37 lines (27 loc) · 784 Bytes
/
sqliteReader.py
File metadata and controls
37 lines (27 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sqlite3
import datetime
# Connect to the database
#conn = psycopg2.connect(
# host="hostname",
# user="username",
# password="password",
# dbname="database_name"
#)
# Connect to the database file
conn = sqlite3.connect("History")
# Create a cursor object
cur = conn.cursor()
# Execute a SELECT statement
cur.execute("SELECT start_time FROM downloads")
# Fetch all rows
rows = cur.fetchall()
# Iterate through the rows
for i in range(0, len(rows)):
#print(row[0])
#Convert a chrome timestamp
timestamp = datetime.datetime(1601,1,1) + datetime.timedelta(microseconds=rows[i][0])
print(timestamp)
#dt_object = datetime.datetime(1601,1,1) + datetime.timedelta(microseconds=timestamp)
# Close the cursor and connection
cur.close()
conn.close()