Skip to content

Commit

Permalink
Fix writing Date value to DBF
Browse files Browse the repository at this point in the history
  • Loading branch information
thbeu committed Mar 1, 2024
1 parent e5dafa0 commit 6c00e5a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dbfopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1541,10 +1541,10 @@ int SHPAPI_CALL DBFWriteDateAttribute(DBFHandle psDBF, int iRecord, int iField,
return false;
if (lValue->day < 0 || lValue->day > 99)
return false;
char dateValue[9]; /* "yyyyMMdd\0" */
snprintf(dateValue, sizeof(dateValue), "%04d%02d%02d", lValue->year,
lValue->month, lValue->day);
return (DBFWriteStringAttribute(psDBF, iRecord, iField, dateValue));
const double dateValue =
lValue->year * 10000 + lValue->month * 100 + lValue->day;
return (DBFWriteStringAttribute(psDBF, iRecord, iField,
STATIC_CAST(const char *, &dateValue)));
}

/************************************************************************/
Expand Down

0 comments on commit 6c00e5a

Please sign in to comment.