From a5b536e218051b0b53444a0479fb3f4696c3cf4b Mon Sep 17 00:00:00 2001 From: jroam Date: Sun, 5 May 2019 22:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=8D=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g/os/gtime/gtime_format.go | 14 ++------------ g/os/gtime/gtime_z_unit_format_test.go | 2 -- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/g/os/gtime/gtime_format.go b/g/os/gtime/gtime_format.go index 09c2ec51e..6b44275c9 100644 --- a/g/os/gtime/gtime_format.go +++ b/g/os/gtime/gtime_format.go @@ -12,7 +12,6 @@ import ( "github.com/gogf/gf/g/text/gstr" "strconv" "strings" - "time" ) var ( @@ -54,8 +53,7 @@ var ( // ================== 时区 ================== 'O': "-0700", // 与UTC相差的小时数, 例如:+0200 'P': "-07:00", // 与UTC的差别,小时和分钟之间有冒号分隔, 例如:+02:00 - 'T': "MST", // 时区缩写, 本机所在的时区 CST可视为美国、澳大利亚、古巴或中国的标准时间 - 'e': "", // 时区标识, 例如:UTC,GMT,CST ,这与当前操作系统设置的时区有关,在中国基本上是UTC + 'T': "MST", // 时区缩写, 例如: UTC, EST, MDT // ================== 完整的日期/时间 ================== 'c': "2006-01-02T15:04:05-07:00", // ISO 8601 格式的日期,例如:2004-02-12T15:19:21+00:00 @@ -146,9 +144,6 @@ func (t *Time) Format(format string) string { buffer.WriteString(strconv.Itoa(dayOfYear(t))) case 't': buffer.WriteString(strconv.Itoa(daysInMonth(t))) - case 'e': - buffer.WriteString(zeroLocation()) - default: if runes[i] > 255 { buffer.WriteRune(runes[i]) @@ -243,12 +238,7 @@ func weeksOfYear(t *Time) int { return nums } -func zeroLocation() string { - location, _ := time.LoadLocation("") - return location.String() -} - -//格式化使用标准库格式 +// 格式化使用标准库格式 func (t *Time) Layout(layout string) string { return t.Time.Format(layout) } diff --git a/g/os/gtime/gtime_z_unit_format_test.go b/g/os/gtime/gtime_z_unit_format_test.go index 524a974a1..6a67df146 100644 --- a/g/os/gtime/gtime_z_unit_format_test.go +++ b/g/os/gtime/gtime_z_unit_format_test.go @@ -74,8 +74,6 @@ func Test_Format(t *testing.T) { {"k": "2016-01-01", "f": "第W周为星期5", "r": "第53周为星期5"}, //星期5 {"k": "2014-01-01", "f": "第W周为星期3", "r": "第1周为星期3"}, //星期3 {"k": "2015-01-01", "f": "第W周为星期4", "r": "第1周为星期4"}, //星期4 - {"k": "2015-01-01", "f": "时区T", "r": "时区CST"}, - {"k": "2015-01-01", "f": "时区e", "r": "时区UTC"}, } for _, v := range times {