conv

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Package conv provides handy conversion functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FToC

func FToC(f float64) float64

FToC converts fahrenheit to celsius

func FeetToMeters

func FeetToMeters(f float64) float64

FeetToMeters converts feet to meters

func MilesToKm

func MilesToKm(m float64) float64

MilesToKm converts miles to kilometers

func ParseTime added in v1.0.13

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

ParseTime attempts to extract a valid time.Time from an input string. We prefer RFC3999. Fallback should match MSSQL's CURRENT_TIMESTAMP.

func RelativeTime

func RelativeTime(dur time.Duration) string

RelativeTime takes a time.Duration and returns the largest denomination relative time. eg. 1y for a duration over 400 days.

func Round

func Round(num float64) int

Round a floating point number to the nearest integer. -0.5 becomes -1, 0.5 becomes 1.

func ToFixed

func ToFixed(num float64, precision int) float64

ToFixed will set a fixed precision on a float.

Types

This section is empty.

Jump to

Keyboard shortcuts

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