Skip to content

Instantly share code, notes, and snippets.

@garethpaul
Created October 16, 2022 17:04
Show Gist options
  • Save garethpaul/579f19a9aa43e622833af6a87e5fe84b to your computer and use it in GitHub Desktop.
Save garethpaul/579f19a9aa43e622833af6a87e5fe84b to your computer and use it in GitHub Desktop.
Chrome History with Day/Hour etc
DROP TABLE chrome_history;
CREATE TABLE IF NOT EXISTS chrome_history AS
SELECT
strftime('%Y-%m-%d', datetime((last_visit_time / 1000000) - 11644473600, 'unixepoch', 'localtime')) AS visit_date,
case cast (strftime('%w', datetime((last_visit_time / 1000000) - 11644473600, 'unixepoch', 'localtime')) as integer)
when 0 then 'Sunday'
when 1 then 'Monday'
when 2 then 'Tuesday'
when 3 then 'Wednesday'
when 4 then 'Thursday'
when 5 then 'Friday'
else 'Saturday' end as servdayofweek,
strftime('%H:%M', datetime((last_visit_time / 1000000) - 11644473600, 'unixepoch', 'localtime')) AS time,
strftime('%H', datetime((last_visit_time / 1000000) - 11644473600, 'unixepoch', 'localtime')) AS hour,
SUBSTR(SUBSTR(urls.url, INSTR(urls.url, '//') + 2), 0, INSTR(SUBSTR(urls.url, INSTR(urls.url, '//') + 2), '/')) AS domain,
urls.visit_count,
visit_duration
FROM urls,
visits
WHERE urls.id = visits.url;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment