I want to create a field in SQLite DB(using C#) to store time taken(duration) field. The value will be in
TimeSpan in C#. This is meant to represent an elapsed duration of time, which is what you are describing.
In SQLite, you should store an
INTEGER type so that your data is sortable. You simply need to decide what granularity you need.
For example, you could store the
TimeSpan.Ticks if you care about the absolute finest precision possible. You would need an
INTEGER of 8 bytes for this. When loading, you can use either
TimeSpan.FromTicks, or the constructor
More likely, you will want to store a whole number of seconds, which you can get from
TimeSpan.TotalSeconds. You could probably use an
INTEGER of 4 bytes for this. When loading, you can use
TimeSpan.FromSeconds to recreate the timespan from your integer.