From 6d6ced4a09245dbf6fdc3c07b189f16ea39ae332 Mon Sep 17 00:00:00 2001 From: Tatsushi Demachi Date: Wed, 21 Jan 2015 22:52:12 +0900 Subject: [PATCH] Add dateFormat template function This is the implementation of the proposal at #235 and http://discuss.gohugo.io/t/parsing-dates-in-templates/603/3 --- content/templates/functions.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/templates/functions.md b/content/templates/functions.md index 89c866951..d84d8ad39 100644 --- a/content/templates/functions.md +++ b/content/templates/functions.md @@ -391,6 +391,11 @@ Replace all occurences of the search string with the replacement string. e.g. `{{ replace "Batman and Robin" "Robin" "Catwoman" }}` → "Batman and Catwoman" +### dateFormat +Converts the textual representation of the datetime into the other form or returns it of Go `time.Time` type value. These are formatted with the layout string. + +e.g. `{{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }}` →"Wednesday, Jan 21, 2015" + ### highlight Take a string of code and a language, uses Pygments to return the syntax highlighted code in HTML. Used in the [highlight shortcode](/extras/highlighting).