Opened 13 years ago
Closed 13 years ago
#4107 closed enhancement (fixed)
SHPWriteOGRFeature doesn't support OFTDateTime fields
Reported by: | math | Owned by: | warmerdam |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | default | Version: | 1.8.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
I think that it would be nice to at least write the date part of a DateTime into our shapefile.
Here's what I've added in my version to support it in shape2ogr.cpp at ln 1180:
// When it's a DateTime, we still want to write the date part into our shapefile. case OFTDateTime: case OFTDate: { int nYear, nMonth, nDay; if( poFeature->GetFieldAsDateTime( iField, &nYear, &nMonth, &nDay, NULL, NULL, NULL, NULL ) ) { DBFWriteIntegerAttribute( hDBF, poFeature->GetFID(), iField, nYear*10000 + nMonth*100 + nDay ); } }
Change History (2)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
You're right... I had found this issue in 1.5.1 and when I moved to 1.8.0, I just checked in something was made to support DateTime in shape2ogr.cpp between 1.5.1 and 1.8.0. I've tested the workflow that wasn't working with DateTime in 1.5.1 in 1.8.0 and it's working fine. I think we can close this one.
Note:
See TracTickets
for help on using tickets.
Interesting... How come you end up with a OFTDateTime field at that point ? Normally OGRShapeLayer::CreateField() turns OFTDateTime field into OFTDate fields. So I don't understand why you need that case OFTDateTime.