1---
2title: .Unix
3description: Converts a time.Time value to the number of seconds elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
4date: 2017-02-01
5keywords: [dates,time]
6categories: [functions]
7menu:
8  docs:
9    parent: "functions"
10signature: [".Unix",".UnixMilli",".UnixMicro",".UnixNano"]
11relatedfuncs: [Format,dateFormat,now,time]
12---
13
14The `Milli`, `Micro`, and `Nano` variants return the number of milliseconds, microseconds, and nanoseconds (respectively) elapsed since the Unix epoch.
15
16```go-html-template
17.Date.Unix        --> 1637259694
18.ExpiryDate.Unix  --> 1672559999
19.Lastmod.Unix     --> 1637361786
20.PublishDate.Unix --> 1637421261
21
22("1970-01-01T00:00:00-00:00" | time.AsTime).Unix --> 0
23("1970-01-01T00:00:42-00:00" | time.AsTime).Unix --> 42
24("1970-04-11T01:48:29-08:00" | time.AsTime).Unix --> 8675309
25("2026-05-02T20:09:31-07:00" | time.AsTime).Unix --> 1777777771
26
27now.Unix      --> 1637447841
28now.UnixMilli --> 1637447841347
29now.UnixMicro --> 1637447841347378
30now.UnixNano  --> 1637447841347378799
31```
32