Comments (1)
The simplest solution is to use GetBytes
, then convert the bytes to string and parse the string.
Or you can replace the DateTime parsing entirely using custom coumn class:
class MyDateTimeColumn : DateTimeColumn
{
public MyDateTimeColumn(string name, int offset) : base(name, offset)
{
}
protected override DateTime? DoLoad(byte[] buffer, int offset, Encoding encoding)
{
string dateTimeString = encoding.GetString(buffer, offset, Size);
// parse and return the string
}
}
class MyHeaderLoader : HeaderLoader
{
protected override Column CreateColumn(byte size, byte type, string name, int columnOffset)
{
if (type == NativeColumnType.Date)
{
return new MyDateTimeColumn(name, columnOffset);
}
return base.CreateColumn(size, type, name, columnOffset);
}
}
class Program
{
static void Main(string[] args)
{
using var table = Table.Open("C:\\file.dbf", new MyHeaderLoader());
// use the table
}
}
Hope it'll help 🙂
from ndbfreader.
Related Issues (11)
- Some buffer offset problems when reading dbf rows HOT 2
- HeaderLoader doesn't read, expose or use decimal count header field HOT 4
- Feature Request: Option to read rows with dbf deleted flag (*)
- How to read "memo" / bytes[] / fpt values? HOT 2
- The DBWINUS0 column's type is not supported. HOT 1
- Is there a way to execute a query against the tables? HOT 2
- Not able to read DateTime column of dbf with size 8 HOT 4
- Ask for dbf HOT 1
- Reader ignores actual column size HOT 1
- 读取字符串乱码bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndbfreader.