I'm trying to create ShapeFile which contains time-specific values.
At first, I tried to just add DateTime fields to Attributes table just using:
attributesTable.Add("DateTime", myObject.MyDateTimeField));,
but according to ShapeFileDataWriter:
else if (type == typeof(DateTime)) header.AddColumn(name, 'D', DateLength, DateDecimals);
and DbFileWriter:
else if (columnValue is DateTime)
{
Write((DateTime)columnValue);
}
...
/// <summary>
/// </summary>
/// <param name="date"></param>
private void Write(DateTime date)
{
foreach (char c in date.Year.ToString(NumberFormatInfo.InvariantInfo))
_writer.Write(c);
if (date.Month < 10)
_writer.Write('0');
foreach (char c in date.Month.ToString(NumberFormatInfo.InvariantInfo))
_writer.Write(c);
if (date.Day < 10)
_writer.Write('0');
foreach (char c in date.Day.ToString(NumberFormatInfo.InvariantInfo))
_writer.Write(c);
}
DateTime is always converted to Date format.
So I started to search how to place Time in dbf file, and found in documentation that there is a Timestamp field which has @ symbol.
I tried to change symbol in shape file header, but I See that there are a few places that should be fixed to use Timestamp field.
My question is: In actual code is there a way to place in .shp/.dbf files not only date but also a time and mark it as @ timestamp?
Is there a reason why it's not supported? Is my documentation wrong or is there any other reason?
If there just never be any need to use timestamp before could I contribute and add that functionality? :)
Hi,
I'm trying to create ShapeFile which contains time-specific values.
At first, I tried to just add DateTime fields to Attributes table just using:
attributesTable.Add("DateTime", myObject.MyDateTimeField));
,but according to ShapeFileDataWriter:
else if (type == typeof(DateTime)) header.AddColumn(name, 'D', DateLength, DateDecimals);
and DbFileWriter:DateTime is always converted to Date format.
So I started to search how to place Time in dbf file, and found in documentation that there is a Timestamp field which has @ symbol. I tried to change symbol in shape file header, but I See that there are a few places that should be fixed to use Timestamp field.
My question is: In actual code is there a way to place in .shp/.dbf files not only date but also a time and mark it as @ timestamp? Is there a reason why it's not supported? Is my documentation wrong or is there any other reason?
If there just never be any need to use timestamp before could I contribute and add that functionality? :)