Compare commits

...

1 Commits

Author SHA1 Message Date
dtapps d2fc1af3be - 优化 `Format`
4 days ago

@ -13,12 +13,12 @@
#### 安装
```shell
go get -v -u go.dtapp.net/gotime@v1.0.9
go get -v -u go.dtapp.net/gotime@v1.0.10
```
#### 使用
```go
```text
package main
import (

@ -1,16 +1,21 @@
package gotime
const (
DateTimeFormat = "2006-01-02 15:04:05"
DateTimeShrinkFormat = "2006-01-02 15:04"
DateFormat = "2006-01-02"
TimeFormat = "15:04:05"
DateTimeFormat = "2006-01-02 15:04:05"
DateTimeSFormat = "2006-01-0215:04:05"
DateTimeShrinkFormat = "2006-01-02 15:04"
DateTimeShrinkSFormat = "2006-01-0215:04"
DateFormat = "2006-01-02"
TimeFormat = "15:04:05"
TimeShrinkFormat = "15:04"
)
const (
DateTimeZhFormat = "2006年01月02日 15点04分05秒"
DateTimeZhShrinkFormat = "2006年01月02日 15点04分"
DateZhFormat = "2006年01月02日"
TimeZhFormat = "15点04分05秒"
TimeZhShrinkFormat = "15点04分"
DateTimeZhFormat = "2006年01月02日 15点04分05秒"
DateTimeZhSFormat = "2006年01月02日15点04分05秒"
DateTimeZhShrinkFormat = "2006年01月02日 15点04分"
DateTimeZhShrinkSFormat = "2006年01月02日15点04分"
DateZhFormat = "2006年01月02日"
TimeZhFormat = "15点04分05秒"
TimeZhShrinkFormat = "15点04分"
)

@ -2,9 +2,21 @@ package gotime
import "testing"
func TestFormat(t *testing.T) {
t.Log("DateTimeFormat", Current().SetFormat(DateTimeFormat))
t.Log("DateTimeSFormat", Current().SetFormat(DateTimeSFormat))
t.Log("DateTimeShrinkFormat", Current().SetFormat(DateTimeShrinkFormat))
t.Log("DateTimeShrinkSFormat", Current().SetFormat(DateTimeShrinkSFormat))
t.Log("DateFormat", Current().SetFormat(DateFormat))
t.Log("TimeFormat", Current().SetFormat(TimeFormat))
t.Log("TimeShrinkFormat", Current().SetFormat(TimeShrinkFormat))
}
func TestZhFormat(t *testing.T) {
t.Log("DateTimeZhFormat", Current().SetFormat(DateTimeZhFormat))
t.Log("DateTimeZhSFormat", Current().SetFormat(DateTimeZhSFormat))
t.Log("DateTimeZhShrinkFormat", Current().SetFormat(DateTimeZhShrinkFormat))
t.Log("DateTimeZhShrinkSFormat", Current().SetFormat(DateTimeZhShrinkSFormat))
t.Log("DateZhFormat", Current().SetFormat(DateZhFormat))
t.Log("TimeZhFormat", Current().SetFormat(TimeZhFormat))
t.Log("TimeZhShrinkFormat", Current().SetFormat(TimeZhShrinkFormat))

@ -1,3 +1,3 @@
package gotime
const Version = "1.0.9"
const Version = "1.0.10"

Loading…
Cancel
Save