helpers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MJD_0      float64 = 2400000.5
	MJD_JD2000 float64 = 51544.5
)

Variables

View Source
var (
	DefaultTimeFormat     = "hh:mm:ss"
	DefaultDateFormat     = "YYYY-MM-DD"
	DefaultDateTimeFormat = "YYYY-MM-DD hh:mm:ss"
)
View Source
var Placeholder = []p{
	{"hh", "15"},
	{"h", "03"},
	{"mm", "04"},
	{"ss", "05"},
	{"MMMM", "January"},
	{"MMM", "Jan"},
	{"MM", "01"},
	{"M", "1"},
	{"pm", "PM"},
	{"ZZZZ", "-0700"},
	{"ZZZ", "MST"},
	{"ZZ", "Z07:00"},
	{"YYYY", "2006"},
	{"YY", "06"},
	{"DDDD", "Monday"},
	{"DDD", "Mon"},
	{"DD", "02"},
	{"D", "2"},
}

Functions

func BytesInSlice

func BytesInSlice(a []byte, list [][]byte) bool

func BytesToUint16

func BytesToUint16(b []byte) uint16

func BytesToUint32

func BytesToUint32(b []byte) uint32

func BytesToUint64

func BytesToUint64(b []byte) uint64

func BytesToUints16

func BytesToUints16(b []byte) (res []uint16)

func Format

func Format(format string, date time.Time) string

Format formats a date based on Microsoft Excel (TM) conventions Format("DD.MM.YYYY", time.Now())

func FormatDate

func FormatDate(date time.Time) string

FormatDate formats the given date to the DefaultDateFormat

func FormatDateTime

func FormatDateTime(date time.Time) string

FormatDateTime formats the given date to the DefaultDateTimeFormat

func FormatTime

func FormatTime(date time.Time) string

FormatTime formats the given date to the DefaultTimeFormat

func Parse

func Parse(format string, value string) (time.Time, error)

Parse parses a value to a date based on Microsoft Excel (TM) formats Parse("M/D/YY", "2/3/07")

func ParseDate

func ParseDate(value string) (time.Time, error)

ParseDate Parse parses a date in DefaultDateFormat to a date

func ParseDateTime

func ParseDateTime(value string) (time.Time, error)

ParseDateTime Parse parses a date in DefaultDateTimeFormat to a date

func ParseTime

func ParseTime(value string) (time.Time, error)

ParseTime Parse parses a date in DefaultTimeFormat to a date

func TimeFromExcelTime

func TimeFromExcelTime(excelTime float64, date1904 bool) time.Time

Convert an excelTime representation (stored as a floating point number) to a time.Time.

func TimeToExcelTime

func TimeToExcelTime(t time.Time, date1904 bool) float64

TimeToExcelTime will convert a time.Time into Excel's float representation, in either 1900 or 1904 mode. If you don't know which to use, set date1904 to false. TODO should this should handle Julian dates?

func TimeToUTCTime

func TimeToUTCTime(t time.Time) time.Time

Types

This section is empty.

Jump to

Keyboard shortcuts

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