I need to pass on the Published and Last Modified dates for a page in the JSON syntax(“2018-05-09T20:21:51+01:00”) in the head of each html page (for Schema.org ), with the date represented as a string in RFC3339 format. I’m trying to do this with following code, without specifying a format since as I understand it Hugo formats dates in RFC3339 format by default:
The format string provided by @frjo produces date strings that comply with ISO 8601.
You are getting this:
2016-06-19T11:50:32Z
Because (a) you have not specified a time zone offset in your front matter dates, or (b) the time zone offset specified in your front matter dates is zero (i.e., your time zone is GMT).
If your front matter dates do not include a time zone offset, you can set a default time zone in your site configuration: