ToolsConvert

package
v0.0.0-...-332b391 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Day = time.Hour * 24
)

Variables

This section is empty.

Functions

func ByteToFloat32_BigEndian

func ByteToFloat32_BigEndian(bytes []byte) float32

func ByteToFloat32_LittleEndian

func ByteToFloat32_LittleEndian(bytes []byte) float32

func ByteToFloat64_BigEndian

func ByteToFloat64_BigEndian(bytes []byte) float64

func ByteToFloat64_LittleEndian

func ByteToFloat64_LittleEndian(bytes []byte) float64

func BytesToInt32_BigEndian

func BytesToInt32_BigEndian(b []byte) int

func BytesToInt32_LittleEndian

func BytesToInt32_LittleEndian(b []byte) int

字节转换成整形32位

func BytesToInt64_BigEndian

func BytesToInt64_BigEndian(buf []byte) int64

func BytesToInt64_LittleEndian

func BytesToInt64_LittleEndian(buf []byte) int64

func Float32ToByte_BigEndian

func Float32ToByte_BigEndian(float float32) []byte

func Float32ToByte_LittleEndian

func Float32ToByte_LittleEndian(float float32) []byte

func Float64ToByte_BigEndian

func Float64ToByte_BigEndian(float float64) []byte

func Float64ToByte_LittleEndian

func Float64ToByte_LittleEndian(float float64) []byte

func FormatFloat

func FormatFloat(value float64, decNum uint8) (result float64)

浮点数保留几位小数

func Int32ToBytes_BigEndian

func Int32ToBytes_BigEndian(n int) []byte

整形32位转换成字节

func Int32ToBytes_LittleEndian

func Int32ToBytes_LittleEndian(n int) []byte

整形32位转换成字节

func Int64ToBytes_BigEndian

func Int64ToBytes_BigEndian(i int64) []byte

func Int64ToBytes_LittleEndian

func Int64ToBytes_LittleEndian(i int64) []byte

func Int64ToStr

func Int64ToStr(value int64) (result string)

func IntToStr

func IntToStr(value int) (result string)

func MustParse

func MustParse(datestr string) time.Time

MustParse parse a date, and panic if it can't be parsed. Used for testing. Not recommended for most use-cases.

func ParseAny

func ParseAny(datestr string) (time.Time, error)

ParseAny parse an unknown date format, detect the layout, parse. Normal parse. Equivalent Timezone rules as time.Parse()

func ParseIn

func ParseIn(datestr string, loc *time.Location) (time.Time, error)

ParseIn with Location, equivalent to time.ParseInLocation() timezone/offset rules. Using location arg, if timezone/offset info exists in the datestring, it uses the given location rules for any zone interpretation. That is, MST means one thing when using America/Denver and something else in other locations.

func ParseLocal

func ParseLocal(datestr string) (time.Time, error)

ParseLocal Given an unknown date format, detect the layout, using time.Local, parse.

Set Location to time.Local. Same as ParseIn Location but lazily uses the global time.Local variable for Location argument.

denverLoc, _ := time.LoadLocation("America/Denver")
time.Local = denverLoc

t, err := dateparse.ParseLocal("3/1/2014")

Equivalent to:

t, err := dateparse.ParseIn("3/1/2014", denverLoc)

func SliceByteToString

func SliceByteToString(b []byte) string

func StrToDateTime

func StrToDateTime(str string, fmt string) time.Time

func StrToFloat

func StrToFloat(value string) (result float64)

字符串转浮点型

func StrToFloatDef

func StrToFloatDef(value string, defvalue float64) (result float64)

func StrToInt

func StrToInt(value string) (result int)

func StrToIntdef

func StrToIntdef(value string, defvalue int) (result int)

func StringToSliceByte

func StringToSliceByte(s string) []byte

func UnixTimeToDateTime

func UnixTimeToDateTime(value int64) 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