I'm using Jekyll to generate a simple site.
I want the date field to display in the format 12 September 2011
.
I've found, through some creative googling, a bit of date-format manipulation, but nothing that seems to get me the month name. What I have is {{ page.date| date: "%m-%d-%Y" }}
, which gets me output as 09-12-2011
, but isn't quite what I'm looking for.
Is there any way to get the month as a name in Jekyll?
Or, barring that, is there any documentation for the date attribute?
The international standard recommends writing the date as year, then month, then the day: YYYY-MM-DD.
The "ddd" custom format specifier represents the abbreviated name of the day of the week. The localized abbreviated name of the day of the week is retrieved from the DateTimeFormatInfo.
This output filter:
{{ page.date | date: "%-d %B %Y" }}
produces dates formatted like:
9 September 2013
Be sure not to miss the minus (-
) in front of %-d
for the day. Without it, numbers below ten would have leading zeros (e.g. 09 September 2013
).
Details on the individual date formatting tokens can be found on the Liquid "Output tags and filters" documentation page.
I put together a large set of Jekyll date formatting examples. It provides examples for several formats and should provide enough detail to format in any way you'd like. Some examples include:
Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With