Mark
Mark

Reputation: 419

make application use same timezone, regardless of user location

I am writing an winforms application that is supposed to be used by users from multiple timezones on the same data files.
Part of the operations use timestamps and obviously I want those to be of the same time globally, say ZULU-time (GMT+0 without DST). For now it can be a hard-coded solution.
This seems like something to set globally, in the initialization of the application,
but I do not know where exactly to set this.

This question seems to be more about display of data, which is irrelevant here. I actually want everyone to see the same DateTimes round the globe.

Upvotes: 0

Views: 36

Answers (1)

user6522773
user6522773

Reputation:

Use:

DateTime.UtcNow

or

DateTime.ToUniversalTime()

later, if you want to local time, you can convert it to local time.
https://msdn.microsoft.com/en-us/library/system.datetime.utcnow(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/system.datetime.touniversaltime(v=vs.110).aspx

Upvotes: 1

Related Questions