github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/unix.md (about) 1 --- 2 title: .Unix 3 draft: false 4 description: .Unix returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC. 5 godocref: https://golang.org/search?q=Unix#Functions 6 date: 2017-02-01 7 publishdate: 2017-02-01 8 lastmod: 2017-02-01 9 keywords: [dates,time] 10 categories: [functions] 11 menu: 12 docs: 13 parent: "functions" 14 signature: [".Unix"] 15 workson: [times] 16 hugoversion: 17 relatedfuncs: [Format,dateFormat,now,time] 18 deprecated: false 19 aliases: [] 20 --- 21 22 ## Example: Time Passed Since Last Modification 23 24 This very simple one-liner uses `now.Unix` to calculate the amount of time that has passed between the `.LastMod` for the current page and the last build of the current page. 25 26 {{< code file="time-passed.html" >}} 27 {{ div (sub now.Unix .Lastmod.Unix) 86400 }} 28 {{< /code >}} 29 30 Since both values are integers, they can be subtracted and then divided by the number of seconds in a day (i.e., `60 * 60 * 24 == 86400`). 31 32 {{% note %}} 33 Hugo's output is *static*. For the example above to be realistic, the site needs to be built every day. 34 {{% /note %}} 35 36 37 38 [partial template]: /templates/partials/