Documentation ¶
Index ¶
- Constants
- Variables
- func Age(birthdate time.Time) float64
- func AgeAt(birthdate, point time.Time) float64
- func DateHhMmStr() string
- func DateHhStr() string
- func DateStr() string
- func DateTimeStr() string
- func DayInt() int64
- func Epoch() int64
- func EpochAfter(d time.Duration) int64
- func EpochAfterStr(d time.Duration) string
- func EpochStr() string
- func Filename() string
- func HhmmssStr() string
- func HourInt() int64
- func HumanStr() string
- func IsValidTimeRange(start, end, check time.Time) bool
- func IsoStr() string
- func LastTwoDigitYear() string
- func MonthInt() int64
- func RandomSleep()
- func Sleep(ns time.Duration)
- func ToDateHourStr(t time.Time) string
- func ToDateStr(t time.Time) string
- func ToDateTimeStr(t time.Time) string
- func ToEpoch(date string) int64
- func ToHhmmssStr(t time.Time) string
- func ToHumanStr(t time.Time) string
- func ToIsoStr(t time.Time) string
- func Track(fun func()) time.Duration
- func UnixNano() int64
- func UnixNanoAfter(d time.Duration) int64
- func UnixToDateStr(epoch float64) string
- func UnixToDateTimeStr(epoch float64) string
- func UnixToFile(i int64) string
- func UnixToHumanDateStr(epoch float64) string
- func UnixToHumanStr(epoch float64) string
- func Weekday() int
- func WeekdayStr() string
- func YearDayInt() int64
- func YearInt() int64
Constants ¶
const FILE = `20060102_150405`
const HMS = `150405`
const HUMAN = `2-Jan-2006 15:04:05`
const HUMAN_DATE = `2 Jan 2006`
const ISO = `2006-01-02T15:04:05.999999`
const YMD = `2006-01-02`
const YMDH = `20060102.15`
const YMDHM = `20060102.1504`
const YMD_HM = `2006-01-02 15:04`
const YMD_HMS = `2006-01-02 15:04:05`
const YY = `06`
Variables ¶
var EMPTY = time.Time{}
Functions ¶
func DateHhMmStr ¶
func DateHhMmStr() string
DateHhMmStr current iso date and hour
T.DateHhMmStr()// output "20160317.1059"
func DateHhStr ¶
func DateHhStr() string
DateHhStr current iso date and hour
T.DateHhStr()// output "20160317.10"
func DateTimeStr ¶
func DateTimeStr() string
DateTimeStr current iso date and time
T.ToDateTimeStr(time.Now()) // "2016-03-17 10:07:50"
func EpochAfter ¶
EpochAfter get current unix time added with a duration
func EpochAfterStr ¶
EpochAfterStr get current unix time added with a duration
func Filename ¶
func Filename() string
Filename get filename version of current date
T.Filename()) // "20160317_102543"
func HumanStr ¶
func HumanStr() string
HumanStr current human date
T.HumanStr() // "17-Mar-2016 10:06"
func IsValidTimeRange ¶
IsValidTimeRange check if time in are in the range
t1, _:=time.Parse(`1992-03-23`,T.DateFormat) t2, _:=time.Parse(`2016-03-17`,T.DateFormat) T.IsValidTimeRange(t1,t2,time.Now()) // bool(false)
func IsoStr ¶
func IsoStr() string
IsoStr current iso time
T.IsoStr() // "2016-03-17T10:07:56.418728"
func LastTwoDigitYear ¶
func LastTwoDigitYear() string
LastTwoDigitYear return current last two digit year
func ToDateHourStr ¶
ToDateHourStr convert time to iso date and hour:minute
T.ToDateHourStr(time.Now()) // "2016-03-17 10:07"
func ToDateTimeStr ¶
ToDateTimeStr convert time to iso date and time
T.ToDateTimeStr(time.Now()) // "2016-03-17 10:07:50"
func ToHhmmssStr ¶
ToHhmmssStr convert time to iso date and hourminutesecond
T.ToDateHourStr(time.Now()) // "230744"
func ToHumanStr ¶
ToHumanStr convert time to human date
T.ToHumanStr(time.Now()) // "17-Mar-2016 10:06"
func ToIsoStr ¶
ToIsoStr convert time to iso formatted time string
T.ToIsoStr(time.Now()) // "2016-03-17T10:04:50.6489"
func Track ¶
Track measure elapsed time in nanosec
T.Track(func(){ x:=0 T.Sleep(1) }) // "done in 1.00s"
func UnixNanoAfter ¶
UnixNanoAfter get current unix nano after added with certain duration
func UnixToDateStr ¶
UnixToDateStr convert from unix sconds to YYYY-MM-DD
func UnixToDateTimeStr ¶
UnixToDateTimeStr convert unix seconds to YYYY-MM-DD_hh:mm:ss
func UnixToHumanDateStr ¶
UnixToHumanDateStr convert from unix to human date format D MMM YYYY
func UnixToHumanStr ¶
UnixToHumanStr convert from unix to human format D-MMM-YYYY hh:mm:ss
Types ¶
This section is empty.