Reputation: 429
I'm having a problem getting dates to either display or sort correctly in my DataGridView. The dgv.DataSource is bound to a DataTable which is populated with data from an SQLite database. Since SQLite doesn't have a "datetime" column type, I'm stuck storing the dates as strings (or integers).
So, either I store the date in a format that is sortable (such as SQLite's recommended "YYYY-MM-DD HH:MM:SS.SSS" format) and have it be not (easily) readable for the user, or I store it in a more human readable format ("MM-dd-yyyy hh:mm AM/PM") and have it not sortable.
Obviously neither option is good.
Does anyone know how to store a date in a sortable format while also displaying it in a datagridview in a readable format?
WATYF
Upvotes: 0
Views: 710
Reputation: 11
Save the dates in milliseconds format and convert it while showing on the grid, they are sortable.
Upvotes: 1