Retrieve the Field's value as a tuple of date & time components.
(self)
| 70 | return force_str(string, encoding=self._feat.encoding, strings_only=True) |
| 71 | |
| 72 | def as_datetime(self): |
| 73 | "Retrieve the Field's value as a tuple of date & time components." |
| 74 | if not self.is_set: |
| 75 | return None |
| 76 | yy, mm, dd, hh, mn, ss, tz = [c_int() for i in range(7)] |
| 77 | status = capi.get_field_as_datetime( |
| 78 | self._feat.ptr, |
| 79 | self._index, |
| 80 | byref(yy), |
| 81 | byref(mm), |
| 82 | byref(dd), |
| 83 | byref(hh), |
| 84 | byref(mn), |
| 85 | byref(ss), |
| 86 | byref(tz), |
| 87 | ) |
| 88 | if status: |
| 89 | return (yy, mm, dd, hh, mn, ss, tz) |
| 90 | else: |
| 91 | raise GDALException( |
| 92 | "Unable to retrieve date & time information from the field." |
| 93 | ) |
| 94 | |
| 95 | # #### Field Properties #### |
| 96 | @property |
no test coverage detected