Different timezones

Hello,

is there any way to convert timezones? I need to be able to determine midnight in GMT+1 and GMT+2 in build process on forestry.io where is UTC timezone.
I found only .UTC and .Local time modifiers which dont fit. I need to check now.GMT+2 for example. Or ability to set different timezone on forestry.io somehow.

Untested, but try this and work from there

{{ (time INPUT).Zone }}

@zwbetz. Error, there is no .Zone method/attribute.

Sorry about that, memory of Time Go doc is fuzzy

I need something like now.EuropeParis
Because now.UTC and now.Local is the same and I’m not able to change timezone on building server.

Now that I’m back at a laptop, there is a GO func for loading a timezone location, but it isn’t currently available in Hugo templating

Is there any way to change it globally via config or constant like HUGO_ENV?

Time zone support in Hugo has been on the TODO list for a while. I didn’t find the issue, so I create a new one:

I will make a mental note and try to get it done for the next Hugo ver.

4 Likes

that would be awesome.