MCPcopy Create free account
hub / github.com/dolthub/doltgresql / ToTime

Method ToTime

postgres/parser/pgdate/pgdate.go:159–165  ·  view source on GitHub ↗

ToTime returns d as a time.Time. Non finite dates return an error.

()

Source from the content-addressed store, hash-verified

157
158// ToTime returns d as a time.Time. Non finite dates return an error.
159func (d Date) ToTime() (time.Time, error) {
160 if d.days == math.MinInt32 || d.days == math.MaxInt32 {
161 return time.Time{}, pgerror.WithCandidateCode(
162 errors.Newf("%s out of range for timestamp", d), pgcode.DatetimeFieldOverflow)
163 }
164 return time.Unix(d.UnixEpochDays()*secondsPerDay, 0).UTC(), nil
165}
166
167const secondsPerDay = 24 * 60 * 60
168

Callers 9

FormatMethod · 0.95
date.goFile · 0.45
timezone.goFile · 0.45
extract.goFile · 0.45
date_part.goFile · 0.45
plus.goFile · 0.45
nodeExprFunction · 0.45
timestampAssignmentFunction · 0.45
timestampTZAssignmentFunction · 0.45

Calls 2

UnixEpochDaysMethod · 0.95
WithCandidateCodeFunction · 0.92

Tested by

no test coverage detected