Skip to content

Commit 09afe27

Browse files
authored
Fixed date to string saving
1 parent b2fe98e commit 09afe27

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

shapefile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,9 @@ def __dbfRecords(self):
937937
elif fieldType == "D":
938938
# date: 8 bytes - date stored as a string in the format YYYYMMDD.
939939
if isinstance(value, date):
940-
value = b"%s%s%s"%(value.year,value.month,value.day)
940+
value = value.strftime("%Y%m%d")
941941
elif isinstance(value, list) and len(value) == 3:
942-
value = b"%s%s%s"%value
942+
value = date(*value).strftime("%Y%m%d")
943943
elif value in MISSING:
944944
value = b('0') * 8 # QGIS NULL for date type
945945
else:

0 commit comments

Comments
 (0)