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

Function MakeDTimestampTZFromDate

pkg/sql/sem/tree/datum.go:2922–2931  ·  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

2920// MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate.
2921// This will be equivalent to the midnight of the given zone.
2922func MakeDTimestampTZFromDate(loc *time.Location, d *DDate) (*DTimestampTZ, error) {
2923 t, err := d.ToTime()
2924 if err != nil {
2925 return nil, err
2926 }
2927 // Normalize to the correct zone.
2928 t = t.In(loc)
2929 _, offset := t.Zone()
2930 return MakeDTimestampTZ(t.Add(time.Duration(-offset)*time.Second), time.Microsecond)
2931}
2932
2933// ParseTimestampTZ parses and returns the time.Time value represented by the
2934// provided string in the provided location, or an error if parsing is

Callers 1

Calls 5

MakeDTimestampTZFunction · 0.85
InMethod · 0.80
DurationMethod · 0.80
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…