I have an C# application that will be running in a different timezone than where I am developing it. It uses time-based data, and performs calculations and makes decisions based on the time-based data. I want to test using the real data, so was wondering how I could set the time zone or something similar of the application as if I was in the other timezone, and all variables of type DateTime would use this default time?
The easiest way would be to just change the timezone on your machine, which is getting picked up by the DateTime
class.
As a general recommendation I would do all time related calculations and storing of times in UTC, only for display purposes convert to the local time zone.
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