From 9a32a60c3920b220b495d7ecf6af337a8be97a33 Mon Sep 17 00:00:00 2001 From: Peleus <245629560@qq.com> Date: Wed, 6 Sep 2023 11:31:48 +0800 Subject: [PATCH] Move `ToStdTime` method from `carbon.go` to `outputer.go` --- outputer.go | 7 +++++++ 1 file changed, 7 insertions(+) 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) +}