mytime

package module
v0.0.0-...-1a9c3ee Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 3 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

mytime

Some time functions.

Install

go get github.com/gtlyy/mytime

Licence

MIT License - see LICENSE for more details

Documentation

Overview

功能:提供时间处理函数

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDate

func ConvertDate(date string) string

将 yyyymmdd 转为 yyyy-mm-ddT09:30:00Z 这个不算通用的,以后可以删去。

func GetHmsnNowCst

func GetHmsnNowCst() (h, m, s, n int)

返回 hour, min, sec, nanoSec : CST

func GetHmsnNowUtc

func GetHmsnNowUtc() (h, m, s, n int)

返回 hour, min, sec, nanoSec : UTC

func ISOCSTToISO

func ISOCSTToISO(strISOCST string) string

iso_cst to iso: 2021-10-07T18:48:57.443Z -> 2021-10-07T10:48:57.443Z

func ISOCSTToTime

func ISOCSTToTime(strISOCST string) time.Time

iso(CST) -> time: 2021-10-07T18:48:57.443Z -> time(2021-10-07 18:48:57.443 +0000 CST)

func ISOCSTToTs

func ISOCSTToTs(strISOCST string) string

iso(CST) -> ts: 2021-10-07T18:48:57.443Z -> 1633603737443

func ISONow

func ISONow() string

Get a iso time. eg: 2018-03-16T18:02:48.284Z

func ISONowCST

func ISONowCST() string

Get iso CST now.

func ISOToISOCST

func ISOToISOCST(strISO string) string

iso to iso_cst: 2021-10-07T10:48:57.443Z -> 2021-10-07T18:48:57.443Z

func ISOToTime

func ISOToTime(strISO string) time.Time

iso -> time: 2021-10-07T10:48:57.443Z -> time(2021-10-07 10:48:57.443 +0000 UTC)

func ISOToTs

func ISOToTs(strISO string) string

iso -> ts: 2021-10-07T10:48:57.443Z -> 1633603737443

func TimeCSTToTs

func TimeCSTToTs(tt time.Time) string

time(CST) -> ts: time(2021-10-07 18:48:57.443 +0000 CST) -> 1633603737443

func TimeToISO

func TimeToISO(tt time.Time) string

time(UTC) -> str: time(2021-10-07 10:48:57.443 +0000 UTC) -> 2021-10-07T10:48:57.443Z

func TimeToISOCST

func TimeToISOCST(tt time.Time) string

time(UTC) -> str: time(2021-10-07 10:48:57.443 +0000 UTC) -> 2021-10-07T10:48:57.443Z

func TimeToStr

func TimeToStr(tt time.Time, format string) string

time(UTC) -> str: time(2021-10-07 10:48:57.443 +0000 UTC) -> 2021-10-07T10:48:57.443Z

func TimeToTs

func TimeToTs(tt time.Time) string

time -> ts: time(2021-10-07 10:48:57.443 +0000 UTC) -> 1633603737443

func TsNow

func TsNow() string

Get now ts:

func TsToISO

func TsToISO(ts string) string

ts -> ISO Str(UTC): 1633603737443 -> 2021-10-07T10:48:57.443Z

func TsToISOCST

func TsToISOCST(ts string) string

ts -> ISO Str(CST): 1633603737443 -> 2021-10-07T18:48:57.443Z

func TsToStr

func TsToStr(ts string, format string) string

ts -> Str(UTC): 1633603737443 -> 2021-10-07T10:48:57.443Z (or other format)

func TsToStrCST

func TsToStrCST(ts string, format string) string

ts -> Str(CST): 1633603737443 -> 2021-10-07T18:48:57.443Z (or other format)

func TsToTime

func TsToTime(ts string) time.Time

ts -> time(UTC): 1633603737443 -> 2021-10-07 10:48:57.443 +0000 UTC

func TsToTimeCST

func TsToTimeCST(ts string) time.Time

ts -> time(CST): 1633603737443 -> 2021-10-07 18:48:57.443 +0000 CST

Types

This section is empty.

Jump to

Keyboard shortcuts

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