Skip to content

Commit

Permalink
optimize ToW3cString method
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Feb 5, 2024
1 parent cc3301f commit 01ff8fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion outputer.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,13 @@ func (c Carbon) ToRssString(timezone ...string) string {
// ToW3cString outputs a string in "2006-01-02T15:04:05Z07:00" layout.
// 输出 "2006-01-02T15:04:05Z07:00" 格式字符串
func (c Carbon) ToW3cString(timezone ...string) string {
return c.ToRfc3339String(timezone...)
if len(timezone) > 0 {
c.loc, c.Error = getLocationByTimezone(timezone[0])
}
if c.IsInvalid() {
return ""
}
return c.StdTime().Format(W3cLayout)
}

// ToUnixDateString outputs a string in "Mon Jan _2 15:04:05 MST 2006" layout.
Expand Down

0 comments on commit 01ff8fc

Please sign in to comment.