hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

now.md (1177B)

    1 ---
    2 title: now
    3 linktitle: now
    4 description: Returns the current local time 
    5 date: 2017-02-01
    6 publishdate: 2017-02-01
    7 lastmod: 2017-04-30
    8 categories: [functions]
    9 menu:
   10   docs:
   11     parent: "functions"
   12 keywords: [dates,time]
   13 signature: ["now"]
   14 workson: []
   15 hugoversion:
   16 relatedfuncs: [Unix,dateFormat]
   17 deprecated: false
   18 aliases: []
   19 ---
   20 
   21 See [`time.Time`](https://godoc.org/time#Time).
   22 
   23 For example, building your site on June 24, 2017, with the following templating:
   24 
   25 ```
   26 <div>
   27     <small>&copy; {{ now.Format "2006"}}</small>
   28 </div>
   29 ```
   30 
   31 would produce the following:
   32 
   33 ```
   34 <div>
   35     <small>&copy; 2017</small>
   36 </div>
   37 ```
   38 
   39 The above example uses the [`.Format` function](/functions/format), which page includes a full listing of date formatting using Go's layout string.
   40 
   41 {{% note %}}
   42 Older Hugo themes may still be using the obsolete Page’s `.Now` (uppercase with leading dot), which causes build error that looks like the following:
   43 
   44     ERROR ... Error while rendering "..." in "...": ...
   45     executing "..." at <.Now.Format>:
   46     can't evaluate field Now in type *hugolib.PageOutput
   47 
   48 Be sure to use `now` (lowercase with _**no**_ leading dot) in your templating.
   49 {{% /note %}}