From 04d9b0a1a5585ede943c4be93f7ad61fa14748e2 Mon Sep 17 00:00:00 2001 From: Nika Jones Date: Tue, 6 May 2014 23:51:33 -0700 Subject: [PATCH] Adds documentation to the website. Explains how to format the time. --- .../configuration-templates.html.markdown | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/website/source/docs/templates/configuration-templates.html.markdown b/website/source/docs/templates/configuration-templates.html.markdown index f2c42c2fb..5bb1e823e 100644 --- a/website/source/docs/templates/configuration-templates.html.markdown +++ b/website/source/docs/templates/configuration-templates.html.markdown @@ -55,9 +55,62 @@ in Packer templates. These are listed below for reference. * `pwd` - The working directory while executing Packer. * `isotime` - UTC time in RFC-3339 format. +* isotime `<format>` - UTC time in [<format>](http://golang.org/pkg/time/#example_Time_Format) format. * `timestamp` - The current Unix timestamp in UTC. * `uuid` - Returns a random UUID. +### isotime Format +Formatting for the function isotime `<format>` uses the magic reference date **Mon Jan 2 15:04:05 -0700 MST 2006**, which breaks down to the following: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Day of WeekMonthDateHourMinuteSecondYearTimezone
Numeric-010203 (15)040506-0700
TextualMonday (Mon)January (Jan)-----MST
+ _The values in parentheses are the abbreviated, or 24-hour clock values_ + + Here are some example formated time, using the above format options: + +
+isotime = June 7, 7:22:43pm 2014
+
+{{isotime "2006-01-02"}} = 2014-06-07
+{{isotime "Mon 1506"}} = Sat 1914
+{{isotime "01-Jan-06 03\_04\_05"}} = 07-Jun-2014 07\_22\_43
+{{isotime "Hour15Year200603"}} = Hour19Year201407
+
+ + ## Amazon Specific Functions Specific to Amazon builders: