cal

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIME_DATE      string = "2006-01-02"
	TIME_COMMON    string = "2006-01-02 15:04:05"
	TIME_SHORTDATE string = "20060102"

	TIME_TO_DAYS    int = 1
	TIME_TO_HOURS   int = 2
	TIME_TO_MINUTES int = 3
	TIME_TO_SECONDS int = 4
)

Variables

View Source
var (
	CUT_OFF_CEIL  = 2
	CUT_OFF_ROUND = 3
	CUT_OFF_FLOOR = 4
)

Functions

func AnyPercent added in v0.1.8

func AnyPercent(num interface{}, places int, cutoff int) string

func CeilFloat added in v0.1.6

func CeilFloat(f float64, places int) float64

func DayListBetweenStartEnd added in v0.1.4

func DayListBetweenStartEnd(start, end string) ([]string, error)

func FloorFloat added in v0.1.6

func FloorFloat(num float64, places int) float64

func GetCidrIpRange

func GetCidrIpRange(cidr string) (first string, broadcast string)

func GetCurrentAndNextHour added in v0.1.6

func GetCurrentAndNextHour(timeStr string) (string, string, error)

func GetDiffTime

func GetDiffTime(previousTime, laterTime interface{}, flag int) (int64, error)

GetDiffTime get the diff time from previous to later time GetDiffTime 获取时间之间的天数,小时数, 分钟数和秒数 parameter previousTime, should be string or time.Time parameter laterTime, should be string or time.Time parameter flag, value is TIME_TO_DAYS,TIME_TO_HOURS, TIME_TO_MINUTES, TIME_TO_SECONDS

func GetFirstAndLastDateOfWeek

func GetFirstAndLastDateOfWeek(date time.Time) (weekMonday, weekSunday string)

GetFirstAndLastDateOfWeek 获取当天所在周的周一和周日时间

func LenToSubNetMask

func LenToSubNetMask(subnet int) string

LenToSubNetMask 如 24 对应的子网掩码地址为 255.255.255.0

func Percent added in v0.1.6

func Percent(num float64, places int, cutoff int) string

func PercentVal added in v0.1.7

func PercentVal(num float64, places int, cutoff int) string

func RoundFloat added in v0.1.6

func RoundFloat(num float64, places int) float64

func SubNetMaskToLen

func SubNetMaskToLen(netmask string) (int, error)

SubNetMaskToLen 如 255.255.255.0 对应的网络位长度为 24

func Tomorrow added in v0.1.5

func Tomorrow(today string) (string, error)

func UnixTimeStamp2TimeStr

func UnixTimeStamp2TimeStr(sec int64) string

func Yesterday added in v0.1.5

func Yesterday(today string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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