unix

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package unix provides UNIX helper functions.

Index

Constants

View Source
const (
	UnixFormat = "unix"
	LongFormat = "long"
)

Special time format layouts.

View Source
const (
	NowLayout  = "now"
	UnixLayout = "unix"
)

Special UNIX parse layouts.

Variables

View Source
var (
	ErrInvalidLocationName = errors.New("location name not recognized")
)

UNIX location errors.

View Source
var (
	ErrInvalidTimeLayout = errors.New("date input format not recognized")
)

UNIX parse errors.

View Source
var (
	ErrUnsupportedFormatDirective = errors.New("format directive is invalid or unsupported")
)

Format errors.

Functions

func Format

func Format(t time.Time, layout string) (string, error)

Format returns a string representation of time t according to layout.

func Parse

func Parse(
	s string,
	locS string,
) (t time.Time, layout string, err error)

Parse auto-detects the date/time format of a string and parses it to the time value it represents.

func ParseLocation

func ParseLocation(s string) (*time.Location, error)

ParseLocation parses a given location name and loads the time location it represents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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