timeutil

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(s string) (int64, error)

Parse converts a time string to a unix timestamp (seconds). Supported formats:

  • Go duration (relative to now): "5m", "1h", "24h", "168h" Interpreted as "now minus duration"
  • Future duration with "+" prefix: "+24h", "+7d" Interpreted as "now plus duration"
  • Day shorthand: "7d", "30d" — converted to hours automatically
  • Date: "2026-04-01" (parsed as local midnight)
  • Datetime: "2026-04-01 10:00:00" (parsed as local time)
  • Unix timestamp: "1712000000" (passed through)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL