Documentation
¶
Overview ¶
Package timeutil provides shared time layouts and formatting/parsing helpers used across API handlers, exports, and reporting paths.
It centralizes ToughRADIUS date-time string conventions to keep serialized timestamps consistent across JSON, CSV, and UI-facing outputs.
Index ¶
- Constants
- Variables
- func ComputeEndTime(times int, unit string) time.Time
- func FmtDateString(t time.Time) string
- func FmtDatetime6String(t time.Time) string
- func FmtDatetime8String(t time.Time) string
- func FmtDatetime14String(t time.Time) string
- func FmtDatetimeMString(t time.Time) string
- func FmtDatetimeString(t time.Time) string
- func ParseTimeDesc(timestr string) string
- type LocalTime
Constants ¶
View Source
const ( Datetime14Layout = "20060102150405" Datetime8Layout = "20060102" Datetime6Layout = "200601" YYYYMMDDHHMMSS_LAYOUT = "2006-01-02 15:04:05" YYYYMMDDHHMM_LAYOUT = "2006-01-02 15:04" YYYYMMDD_LAYOUT = "2006-01-02" )
Variables ¶
View Source
var (
ShangHaiLOC, _ = time.LoadLocation("Asia/Shanghai")
EmptyTime, _ = time.Parse("2006-01-02 15:04:05 Z0700 MST", "1979-11-30 00:00:00 +0000 GMT")
)
Functions ¶
func FmtDateString ¶
FmtDateString formats t as "2006-01-02".
func FmtDatetime6String ¶
FmtDatetime6String formats t as "200601".
func FmtDatetime8String ¶
FmtDatetime8String formats t as "20060102".
func FmtDatetime14String ¶
FmtDatetime14String formats t as "20060102150405".
func FmtDatetimeMString ¶
FmtDatetimeMString formats t as "2006-01-02 15:04".
func FmtDatetimeString ¶
FmtDatetimeString formats t as "2006-01-02 15:04:05".
func ParseTimeDesc ¶
Types ¶
type LocalTime ¶
func (LocalTime) MarshalCSV ¶
func (LocalTime) MarshalJSON ¶
func (*LocalTime) MarshalParam ¶
func (*LocalTime) UnmarshalJSON ¶
func (*LocalTime) UnmarshalParam ¶
Click to show internal directories.
Click to hide internal directories.