HUGO

Can I change the date format to "DD-MM-YYYY"?

I was wondering if it is possible for me to specify dates in the frontmatter using this format.

No.

Obviously, the timestamp is generated for you when you create new content with hugo new post/foo.md.

If I have to change the timestamp to the current time, I rely on my editor to insert the text in the correct format. Most editors have the ability, either natively or through a plugin/extension, to insert a timestamp in a predetermined format. That makes things a little easier.

Please, pretty please, only use dashes in ISO format dates. Dash was selected as the separator for the reason of not being in use in any other format.

Using dash in any other format is just an effort to break the standard.

I think you’ve misunderstood me.

I’m working on a website in which I need people to fill out their birth dates, and here in India, everyone is used to DD-MM-YYYY format, so I’m not worried about the timestamp, I just want to format the birthdate frontmatter parameter in this format, and Hugo expects YYYY-MM-DD format, so I was wishing I could change this expected format to DD-MM-YYYY.

I’m using dashes only.

So how are the users entering the dates? An HTML form?

Yeah, I’m using Google Forms to get a CSV file which I’ll process using a script to convert into frontmatter. I know that I can transform the date format from input to Hugo’s default date format using the script, but it was just plain curiosity whether Hugo supports different date formats or not.

The name of the date field (date, expiryDate, birthday) is irrelevant. Examples:

2020-05-23
2020-05-23T16:35:16
2020-05-23T16:35:16.123
2020-05-23T16:35:16-04:00
2020-05-23T16:35:16.123-04:00

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