diff --git a/outputer.go b/outputer.go index b15dfcba..70f8cf78 100644 --- a/outputer.go +++ b/outputer.go @@ -5,6 +5,7 @@ import ( "fmt" "strconv" "strings" + "time" ) // String implements the interface Stringer for Carbon struct. @@ -788,3 +789,9 @@ func (c Carbon) ToFormatString(format string, timezone ...string) string { func (c Carbon) Format(format string, timezone ...string) string { return c.ToFormatString(format, timezone...) } + +// ToStdTime converts Carbon to standard time.Time. +// 将 Carbon 转换成标准 time.Time +func (c Carbon) ToStdTime() time.Time { + return c.time.In(c.loc) +}