Convert dates of multiple files

I am moving my site to Hugo. I have date formats as date: 02 Jan 2022 and I want to convert (replace) them to this format 2022-01-02T15:04:05-07:00 for all existing posts. Is this possible?


How about you tell us more about what system you are on? I could probably use some of my precious time to write a bash script, but I don’t want to waste that time if you are on Windows because my knowledge is of no use over there :wink:

It’s a simple "range over a folder and change all date: dd MMM YYYY to date: new datetimeformat. It’s not something that is integrated into Hugo, but most shells are able to do it.

Also: If your previous date timestamps are only the day, you need to think about your site setup first. You have to setup your timezone properly so that there are no issues coming up, if the conversion ends you up with 2022-01-02T00:00:00-07:00 and you are not in UTC-7 (It’s 10 pm on the 1st of Jan 2022 in UTC-9 for instance).

It is windows indeed! Although I found out about the .Format in Hugo which does exactly what I want.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.