-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAge
Milestone
Description
Using Go 1.9
Documenation states:
func (t Time) In(loc *Location) Time
In returns t with the location information set to loc.
My interpretation is that the function In will change the location information but keep all other details the same. The consequence is that it will have a different Unix time usually since they represent different points in time.
startDate := .... //startDate (time.Time) 2018-01-01 00:00:00 +1100 AEDT
_startDate := time.Date(startDate.Year(), startDate.Month(), startDate.Day(), startDate.Hour(), startDate.Minute(), startDate.Second(), startDate.Nanosecond(), time.UTC)
fmt.Println("startDate", spew.Sdump(startDate), spew.Sdump(startDate.In(time.UTC)), spew.Sdump(_startDate))
Output:
startDate (time.Time) 2018-01-01 00:00:00 +1100 AEDT
(time.Time) 2017-12-31 13:00:00 +0000 UTC
(time.Time) 2018-01-01 00:00:00 +0000 UTC
Expected output:
startDate.In(time.UTC)) and _startDate should produce same result
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAge