Skip to content

Commit d699ea1

Browse files
committed
feat: time/timeutil: add TimeUpdateLocation()
1 parent c8ab4be commit d699ea1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

time/timeutil/zone.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package timeutil
2+
3+
import "time"
4+
5+
func TimeUpdateLocation(t time.Time, z string) (time.Time, error) {
6+
if loc, err := time.LoadLocation(z); err != nil {
7+
return t, err
8+
} else {
9+
return t.In(loc), nil
10+
}
11+
}

0 commit comments

Comments
 (0)