I am working on a desktop standalone application with SQLite.
In my application, I used to save the Datetime as DateTime.Now
to identity when the user last visited, last logged in and many other purposes.. It works as expected for me.
Problem now is When I change the System Time format from "M/d/yyyy" to "d/M/yyyy" in the machine, Every thing messed up.
I got Exception in all the area where I used to retrieve the Datetime from Sqlite DB and convert that to datetime using Convert.ToDateTime("[retrived DB value]");
It seems like the the Convert.ToDateTime
trying to convert the Datetime from different Culture to current culture.
I fell I implemented the design to save and retrieve DateTime in a wrong way. . Not sure.
What is the standard way of doing this, independent of system Datetime Culture? Any ideas?
Note: The field which I used in my DB to save the DatimeTime value is in "NTEXT" format.