time.Time.UnixNano() Function in Golang with Examples
In Go language, time packages supply functionality for determining as well as viewing time. The Time.UnixNano() function in Go language is used to yield “t” as a Unix time that is the number of seconds passed from January 1, 1970, in UTC and the output here doesn’t rely upon the location connected with t. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
Syntax:func (t Time) UnixNano() int64
Here, “t” is the stated time.
Note: Here, the output returned is not defined if the given Unix time in nanoseconds is not formed by an int64 type(which is a date before the year 1678 or after the year 2262). This implies that the result of calling the UnixNano() method on the zero Time is ambiguous.
Return value: It returns “t” as a Unix time which is of type int64.
Here, the time “t” stated in the above code has values which contain constant “e” but they are converted in usual range while conversion.