In Shopify I can use the snippet {{ “now” | date: “%H:%M” }} to show the current time in my timezone.
In Liquid I can use the same snippet but with a filter {{ “now” | in_time_zone: “Europe/Copenhagen” | date: “%H:%M” }} to show the time in a specific timezone, no matter where the visitor is located in the world.
But that filter is apparently not supported by Shopify!
Is there any way to show the current time in a specific timezone in Shopify?
I hope it is possible in Liquid, because I am going to use the output in a Liquid if-function.
Basically what I need is the following: {% assign current_hour_cph = CURRENT HOUR IN CPH %}
You should look to use JavaScript instead. If you use the Liquid “now” it won’t give you current time, but rather the time in which that page was cached. It’s possible for a shop to not need a cache clearing for hours so your time will be erratic - and wrong.
It’s not so much that it’s unsupported, more that the cache works against you.