'Can I Force A ASP.Net Website to Show Time in A Specific Time Zone?

I have a client request that all times be displayed in Pacific Time Zone, regardless of client settings. I'd like to avoid a scenario where I have to call a function for every time display and instead have a single point where I can make the switch.

I'm thinking a custom culture might do the trick, but I wanted to ask before I set off down a potentially blind alley (or miss something trivially easy).



Solution 1:[1]

Here's the documentation for Daniel's sample:

http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx

Solution 2:[2]

If you store your times in UTC you can convert to whatever you want easily. Michael Brumm has some fairly old code that may help you out with a custom TimeZone. Hard coding an offset will cause issues when DST kicks in.

Note: I haven't used this code on Michael's site.

http://www.michaelbrumm.com/simpletimezone.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mtblewis
Solution 2 cigien