Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Temporal query in QGIS

SpatiaLite field

  • Column name: time
  • Type: VARCHAR
  • Example value: 2014/04/25 20:30:00

WHERE clause for temporal subset query

DATETIME(
   substr(time,1,4)||'-'||
   substr(time,6,2)||'-'||
   substr(time,9,2)||' '||
   substr(time,12,8)
) > DATETIME('2014-04-25 18:00:00') AND 
DATETIME(
   substr(time,1,4)||'-'||
   substr(time,6,2)||'-'||
   substr(time,9,2)||' '||
   substr(time,12,8)
) < DATETIME('2014-04-25 20:30:00')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment