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

Function MakeDTimestampTZFromDate

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

MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate. This will be equivalent to the midnight of the given zone.

(loc *time.Location, d *DDate)

Source from the content-addressed store, hash-verified

2354// MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate.
2355// This will be equivalent to the midnight of the given zone.
2356func MakeDTimestampTZFromDate(loc *time.Location, d *DDate) (*DTimestampTZ, error) {
2357 t, err := d.ToTime()
2358 if err != nil {
2359 return nil, err
2360 }
2361 // Normalize to the correct zone.
2362 t = t.In(loc)
2363 _, offset := t.Zone()
2364 return MakeDTimestampTZ(t.Add(time.Duration(-offset)*time.Second), time.Microsecond), nil
2365}
2366
2367// ParseDTimestampTZ parses and returns the *DTimestampTZ Datum value represented by
2368// the provided string in the provided location, or an error if parsing is unsuccessful.

Callers 1

Calls 3

MakeDTimestampTZFunction · 0.85
AddMethod · 0.65
ToTimeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…