Skip to content

Commit 33c1744

Browse files
committed
partial backport from go-gitea#20903
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3dfb20d commit 33c1744

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/timeutil/timestamp.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ func (ts TimeStamp) AsTime() (tm time.Time) {
5454
return ts.AsTimeInLocation(setting.DefaultUILocation)
5555
}
5656

57+
// AsLocalTime convert timestamp as time.Time in local location
58+
func (ts TimeStamp) AsLocalTime() time.Time {
59+
return time.Unix(int64(ts), 0)
60+
}
61+
5762
// AsTimeInLocation convert timestamp as time.Time in Local locale
5863
func (ts TimeStamp) AsTimeInLocation(loc *time.Location) (tm time.Time) {
5964
tm = time.Unix(int64(ts), 0).In(loc)

0 commit comments

Comments
 (0)