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

Function ParseTimestampTZ

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

ParseTimestampTZ parses and returns the time.Time value represented by the provided string in the provided location, or an error if parsing is unsuccessful. The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

(
	ctx ParseContext, s string, precision time.Duration,
)

Source from the content-addressed store, hash-verified

2937// The dependsOnContext return value indicates if we had to consult the
2938// ParseContext (either for the time or the local timezone).
2939func ParseTimestampTZ(
2940 ctx ParseContext, s string, precision time.Duration,
2941) (_ time.Time, dependsOnContext bool, _ error) {
2942 now := relativeParseTime(ctx)
2943 t, dependsOnContext, err := pgdate.ParseTimestamp(now, dateStyle(ctx), s, dateParseHelper(ctx))
2944 if err != nil {
2945 return time.Time{}, false, err
2946 }
2947 if t, err = roundAndCheck(t, precision); err != nil {
2948 return time.Time{}, false, err
2949 }
2950 return t, dependsOnContext, nil
2951}
2952
2953// ParseDTimestampTZ parses and returns the *DTimestampTZ Datum value represented by
2954// the provided string in the provided location, or an error if parsing is unsuccessful.

Callers 2

ParseDTimestampTZFunction · 0.85

Calls 5

ParseTimestampFunction · 0.92
relativeParseTimeFunction · 0.85
dateStyleFunction · 0.85
dateParseHelperFunction · 0.85
roundAndCheckFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…