We have an old database which stores date and time as smalldatetime. The date and times are generated by different applications with this code:
Syste.DateTime appointmentDate = System.DateTime.Now;
We want to migrate this database to make it timezone independed. So we decided to use SQL DateTimeOffSet data type because it comes with all what we need. It stores the UTC date and a offset... just perfect.
Unfortunately we have extremely old applications which are based on .Net 2.0. So there is no System.DateTimeOffSet.
What is the best way to develop a timezone awareness application in .Net 2.0?
- Store milliseconds since 1970-01-01 as long data type in database and convert it back to System.DateTime in our application? But then we will lose the timezone
- Store date and time as smalldatetime in our database but use System.DateTime.UtcNow to generate date and time on client side? But then we will lose the timezone too.
Background for our migration is this question: Azure App Service - DateTime changes during Sync
Any ideas?