Tool
Go Unix Timestamp Snippets
Go examples for Unix seconds, milliseconds, nanoseconds, converting timestamps to time.Time, and formatting with RFC3339 or custom layouts.
Go timestamp basics
Go's time package has direct helpers for Unix seconds, milliseconds, and nanoseconds. Use time.Now().Unix() for seconds and time.Now().UnixMilli() for JavaScript-compatible milliseconds.
Formatting time.Time values
Use time.Unix(seconds, 0) to create a time.Time from Unix seconds, then call UTC() when you want deterministic output. RFC3339 is usually the best string format for API responses.