Ok, so you’re using Influx. In that case you need to add something like tz('America/Los_Angeles') at the end of your query, in order to use the correct date boundaries (and not UTC). The rest of what you have looks right. See Explore data using InfluxQL | InfluxDB OSS 1.8 Documentation for more detail.