I'm from the UK, and have recently deployed a website on WinHost's Basic Package.
When using DateTime.Now() in C#, or GETDATE() in SQL, these are both returning something like GMT-8 (because the server is hosted in the US).
I think I'm a bit limited in terms of permissions on the server (for example I can't change my SQL Login Language).
What is the best method of storing these dates in GMT?
use DateTime.UtcNow and store as it is database.
When reading from database assume UTC and convert into UK time using TimeZoneInfo class.
Note that the SQL should not contain any information about time zone offsets.
In SqlServer use getUtcDate() to store all your datetime values. You can convert it to required timezone in your .NET application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With