In my ASP.NET application I use code from here to find the build date of the application as UTC. The UTC value read from the assembly file is then formatted as follows:
//DateTime time
return time.ToString("dd MMM yyyy HH:mm:ss");
Now one user opens the page served by that application and sees
28 сен 2012 04:13:56
and notifies the other user who opens the same page and sees
27 Sep 2012 12:14:32
Both requests are served by the same application deployed to clean Windows Azure VMs from the very same package, so it's surely exactly the same code being run for both users.
Clearly strings are formatted differently because of different localization for requests from different users. One user sees month displayed as Sep
and the other sees it as сен
(equivalent of Sep
in Russian).
Why do the hours differ? Are they also adjusted according to some timezone that depends on localization?
The most obvious explanation is that the DateTime
values are, in fact, different.
The code you linked uses GetCallingAssembly
, and you should note that MSDN says that:
If the method that calls the GetCallingAssembly method is expanded inline by the just-in-time (JIT) compiler, or if its caller is expanded inline, the assembly that is returned by GetCallingAssembly may differ unexpectedly
To debug this, I would start by displaying time.Ticks
and time.Kind
: if these are identical, you know it's a display problem. If they're different, you need to look at how you're generating the time value.
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