You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

62 lines
983 B

package Helper
import (
"strconv"
"strings"
"time"
)
func MinusInt64(a, b int64) string {
return strconv.FormatInt(a-b, 10)
}
func MinusInt(a, b int) string {
return strconv.Itoa(a - b)
}
func Minus(a, b int) int {
return a - b
}
func PlusInt64(a, b int64) string {
return strconv.FormatInt(a+b, 10)
}
func PlusInt(a, b int) string {
return strconv.Itoa(a + b)
}
func Iterate(count int) []int {
var i int
var Items []int
for i = 0; i < count; i++ {
Items = append(Items, i)
}
return Items
}
func StrToLower(s string) string {
return strings.ToLower(s)
}
func FormatTimestamp(t interface{}) string {
var (
s string
tt time.Time
exists bool
)
// Check if timestamp is string
s, exists = t.(string)
if exists {
return s
}
// Check if timestamp is time.Time
tt, exists = t.(time.Time)
if !exists || tt.IsZero() {
return ""
}
loc, _ := time.LoadLocation("Australia/Adelaide")
return tt.
In(loc).
Format("02/01/2006 03:04 PM")
}