MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / EvalAtTimeZone

Method EvalAtTimeZone

pkg/sql/sem/tree/datum.go:2492–2496  ·  view source on GitHub ↗

EvalAtTimeZone evaluates this TimestampTZ as if it were in the supplied location, returning a timestamp without a timezone.

(ctx *EvalContext, loc *time.Location)

Source from the content-addressed store, hash-verified

2490// EvalAtTimeZone evaluates this TimestampTZ as if it were in the supplied
2491// location, returning a timestamp without a timezone.
2492func (d *DTimestampTZ) EvalAtTimeZone(ctx *EvalContext, loc *time.Location) *DTimestamp {
2493 _, locOffset := d.Time.In(loc).Zone()
2494 t := d.Time.UTC().Add(time.Duration(locOffset) * time.Second).UTC()
2495 return MakeDTimestamp(t, time.Microsecond)
2496}
2497
2498// DInterval is the interval Datum.
2499type DInterval struct {

Callers 1

stripTimeZoneMethod · 0.95

Calls 2

MakeDTimestampFunction · 0.85
AddMethod · 0.65

Tested by

no test coverage detected