# DbfColumn in ShapeFileFeatureLayer

**URL:** <https://community.thinkgeo.com/t/dbfcolumn-in-shapefilefeaturelayer/7890>\
**Category:** Android\
**Created:** [March 25, 2016, 12:10pm UTC](https://community.thinkgeo.com/t/dbfcolumn-in-shapefilefeaturelayer/7890 "2016-03-25T12:10:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maumet](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/maumet/32/18991_2.png) [@Maumet](https://community.thinkgeo.com/u/Maumet)\
**Post date:** [March 25, 2016, 12:10pm UTC](https://community.thinkgeo.com/t/dbfcolumn-in-shapefilefeaturelayer/7890/1 "2016-03-25T12:10:40Z")

</div>

I create a ShapeFileFeatureLayer with a list of DbfColumn  
One of the DbfColumn is type Date  
col = new DbfColumn(“date”, DbfColumnType.Date, 8, 0);  
And one with type Logical  
col = new DbfColumn(“valid”, DbfColumnType.Logical, 1, 0);

I try to update a value in a feature

f.ColumnValues.Add(“date”,???); What about the DateTime.Now ???  
And  
f.ColumnValues.Add(“valid”,???); Is it “True”, “1”, …

Thanks  
Regards  
Laurent M

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [March 28, 2016, 12:18pm UTC](https://community.thinkgeo.com/t/dbfcolumn-in-shapefilefeaturelayer/7890/2 "2016-03-28T12:18:11Z")

</div>

Hi Laurent M,

The DbfColumnType.Date format is YYYYMMDD(for example 20160326) and the size of DbfColumnType.Logical is 1 byte, the default value is “?”. “Y” or “y”( Yes), “N” or “n”( No), “F” or “f” (False), “T” or “t”(True).

The code are as follows:

// Date in format - YYYYMMDD  
shapeFileFeatureSource.UpdateDbfData(features[0].ColumnValues[“id”], “date”, DateTime.Now.Date.ToString(“yyyyMMdd”));  
// ? - Default  
// Y,y - Yes  
// N,n - No  
// F,f - False  
// T,t - True  
shapeFileFeatureSource.UpdateDbfData(features[0].ColumnValues[“id”], “valid”, “T”);

Hope it’s helped.

Thanks,  
Peter

---

<div class="post-metadata">

**Author:** ![Maumet](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/maumet/32/18991_2.png) [@Maumet](https://community.thinkgeo.com/u/Maumet)\
**Post date:** [April 4, 2016, 8:53am UTC](https://community.thinkgeo.com/t/dbfcolumn-in-shapefilefeaturelayer/7890/3 "2016-04-04T08:53:57Z")

</div>

Ok Thanks

And for  
DbfColumn(“date”, DbfColumnType.DateTime, ??, 0);  
DateTime format is 20160404nnnnnn

Best regards  
Laurent M

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [April 5, 2016, 9:47am UTC](https://community.thinkgeo.com/t/dbfcolumn-in-shapefilefeaturelayer/7890/4 "2016-04-05T09:47:15Z")

</div>

Hi Laurent M,

Please try the following code.

```
   shapeFileFeatureSource.AddColumn(new DbfColumn("dateTime", DbfColumnType.DateTime, 14, 0));

   // Chronological data consisting of month, day, year, hours, minutes, and seconds
   shapeFileFeatureSource.UpdateDbfData(features[0].ColumnValues["id"], "dateTime", string.Format("{0:MMddyyyyHHmmss}", DateTime.Now)); 

```

Thanks,  
Peter
