diff options
Diffstat (limited to 'modules/timeutil/timestamp.go')
-rw-r--r-- | modules/timeutil/timestamp.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/timeutil/timestamp.go b/modules/timeutil/timestamp.go index 88008d1fad..40fcb8603f 100644 --- a/modules/timeutil/timestamp.go +++ b/modules/timeutil/timestamp.go @@ -54,6 +54,11 @@ func (ts TimeStamp) AsTime() (tm time.Time) { return ts.AsTimeInLocation(setting.DefaultUILocation) } +// AsLocalTime convert timestamp as time.Time in local location +func (ts TimeStamp) AsLocalTime() time.Time { + return time.Unix(int64(ts), 0) +} + // AsTimeInLocation convert timestamp as time.Time in Local locale func (ts TimeStamp) AsTimeInLocation(loc *time.Location) (tm time.Time) { tm = time.Unix(int64(ts), 0).In(loc) |