How to convert date timezone for 'now' before running query?

My database table timestamps are stored in US Pacific time, and I'm trying to create a report that will query for the last 7 full days (i.e yesterday - 6 days) of activity when it loads, and allow the viewer to manually change the start and end dates via parameters. Like this:

 

SELECT * FROM myTable WHERE date >= '{{start_date}}' AND date <= '{{end_date}}'

{% form %}
start_date:
  type: date
  default: {{ 'now' | date: '%s' | minus: 604800 | date: '%Y-%m-%d' }}
end_date:
  type: date
  default: {{ 'now' | date: '%s' | minus: 86400 | date: '%Y-%m-%d' }}
{% endform %}

The problem is that 'now' in Liquid returns the date in UTC, but I need it in Pacific time, so all of my reports are inaccurate.

Does anyone know how to get 'now' to return the date in a different time zone?

Thanks

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 3 wk agoLast active
  • 7Views
  • 1 Following