MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate. This will be equivalent to the midnight of the given zone.
(loc *time.Location, d *DDate)
| 2920 | // MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate. |
| 2921 | // This will be equivalent to the midnight of the given zone. |
| 2922 | func 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 |
no test coverage detected
searching dependent graphs…