Question : Changing C++ unmanaged DateTime to C# DateTime  MYSQL db

we have an old service written in C++ unmanaged code running on our server that is tracking bandwidth useage per user per transaction, that stores the start and end time ect in a MYSQL table.

is there a way to code the insert statement so it will show as an actual date and time instead of ticks since jan 1 1970 or whatever C++ tracks it as either in the service or thru MYSQL, to make it easier to use in our apps and websites that are written in C#

Answer : Changing C++ unmanaged DateTime to C# DateTime  MYSQL db

My advice would be to keep epoch time in your database for the benefit of all the apps you might use in the future, its just much more wisely used than DATETIME, theres a good article about these issues in more depth here, (look specifically at the Obtaining Epoch time section)[1]

when you extract your epoch time from your mySQL database, if you want it in a DATETIME format use the query:

SELECT FROM_UNIXTIME(myEpochDateCol) FROM mydb.myDateTable; in your C# instead of
SELECT myEpochDateCol FROM mydb.myDateTable;

Random Solutions  
programming4us programming4us