Quote:
When You run it on Server the time is not correct(But date is correct).
|
The date could be "wrong" as well as the day has already changed in one timezone but not yet in the other.
But it all depends on what you mean with "correct" and "wrong". If I as a visitor were in the same time zone as the server it could be right for me....
You can take a look at ToUniversalTime on the DateTime struct (
http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx) which gives the universal time regardless the timezone. Then you can calculate back to the user's time zone if you have that information (could base it on an IP address, or ask the user's timezone as these Wrox forums do it).
For future questions like these that are not directly related to my book, would you mind posting in a more general ASP.NET category from this list:
http://p2p.wrox.com/asp-net-4-539/
Cheers,
Imar