I have a data structure that contains a time in MDT that I would like to convert to the local time. Its value looks like this: "8:15 am MDT"
. I have read the docs and do not fully understand them my goal is something like this: {{ dateFormat (.Path.To.Time.Data.time) .Date.Local }}
this just exports 0:00 CST
. But I want it to export 9:15 CDT
.
I am not sure if I understand your issue. Can you confirm if ALL your field contains is “hh:mm am/pm timezone”? Because I am pretty sure that Hugo won’t understand that. It will help if you have a timestamp-like structure that it can parse, like the formats listed here. In that case, you could parse the field with
{{ dateFormat "02 Jan 06 15:04 MST" $yourvariableContainingTheDateTime }}
By setting your website’s timezone it should (untested) convert properly.
This all is only to output a date, not to read your date in and convert it somehow. To my knowledge that is not possible. Either Hugo “get’s it” or not.