ParseDTimestampTZ parses and returns the *DTimestampTZ Datum 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 ParseTimeContext (either for the time or the local timezone).
(ctx ParseTimeContext, s string, precision time.Duration, loc *time.Location)
| 1092 | // The dependsOnContext return value indicates if we had to consult the |
| 1093 | // ParseTimeContext (either for the time or the local timezone). |
| 1094 | func ParseDTimestampTZ(ctx ParseTimeContext, s string, precision time.Duration, loc *time.Location) (_ *DTimestampTZ, dependsOnContext bool, _ error) { |
| 1095 | now := relativeParseTime(ctx).In(loc) |
| 1096 | t, dependsOnContext, err := pgdate.ParseTimestamp(now, pgdate.ParseModeYMD, s) |
| 1097 | if err != nil { |
| 1098 | t, dependsOnContext, err = pgdate.ParseTimestamp(now, pgdate.ParseModeDMY, s) |
| 1099 | if err != nil { |
| 1100 | t, dependsOnContext, err = pgdate.ParseTimestamp(now, pgdate.ParseModeMDY, s) |
| 1101 | if err != nil { |
| 1102 | return nil, false, err |
| 1103 | } |
| 1104 | } |
| 1105 | } |
| 1106 | // Always normalize time to the current location. |
| 1107 | d, err := MakeDTimestampTZ(t, precision) |
| 1108 | return d, dependsOnContext, err |
| 1109 | } |
| 1110 | |
| 1111 | // Round returns a new DTimestampTZ to the specified precision. |
| 1112 | func (d *DTimestampTZ) Round(precision time.Duration) (*DTimestampTZ, error) { |
no test coverage detected