Re: local time for remote users
- From: stcheng@xxxxxxxxxxxxxxxxxxxx ("Steven Cheng")
- Date: Wed, 20 Feb 2008 02:23:24 GMT
Thanks for Alexey's input.
Hi Marc,
ASP.NET globalization can help you do some UI rendering or time/currency
formatting depend on the UICulture and Culture info you set for the ASP.NET
worker thread.
#How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization
http://msdn2.microsoft.com/en-us/library/bz9tc508.aspx
However, for Datetime of remote client user, ASP.NET/http request won't
send such information(only some user-language info will be sent).
Therefore, the reasonable approach would be:
1. You may let the user choose their timezone(stored as a profile item of
each user) and on the page where you need to display datetime, you may
manually calculate the correct time via the timezone offset in current
user's profile.
2. Stored a static timezone offset in web.config file and retrieve it at
runtime when you want to display time info.
Also, is it possible that you use UTC time for all the users?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: Alexey Smirnov <alexey.smirnov@xxxxxxxxx>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: local time for remote users
Date: Tue, 19 Feb 2008 10:48:19 -0800 (PST)
GetDate()
On Feb 19, 3:25 pm, MarcG <JoePt...@xxxxxxxxxxxxxxxx> wrote:
I have an aspnet/sql2005 app that supports a set of local users in a
manufacturing environment. I (thoughtlessly) built it using SQL's
plant inand Framework's DateTime.Now function/property.
Everything was fine until the client decided to use the app for its
runthe far east. The good news is that the far east system will not share a
database with the local one. The bad news is that the far east app will
america).on the same IIS and SQL server as the local app (i.e., here in north
why> the far east userswere saying that timestamps were off by 13 hours.
So what I now have is two instances of the app and database running in
separate app pools.
Obviously I haven't worked with internationalization apps before and said
"Oh, yeah, hadn't thought of that..." when the client called and asked
I'm going
theirto have to fix this, but fortunately they haven't asked for output in
Cantonese.
So, what is the "right" way to deal with the general problem an app faces
when wanting to present time information to remote users according to
reflect> the user's local time since in THIS case, the local and far eastlocal time zone?
If it helps, I think that I should have timestamps in the database
plants
represent different business units and the data will not be combined forIn your case I think I would just add an offset value in the
reporting purposes (i.e., I don't have the general problem of users from
different time zones sharing data and it is the time zone of the business
unit I'm trying to deal with).
It would be great, but I think impossible, to have a time zone associted
with the app pool and the database instance.
Thx
Marc
web.config file in each application and use that value in the
application to display right time according to the offset.
<appSettings>
<add key="offset" value="13" />
</appSettings>
int offset =
Convert.ToInt32(ConfigurationSettings.AppSettings["offset"]);
DateTime dt = ...from the db...
DateTime desiredTime = dt.AddHours(offset);
If you would have more than one location then you should consider
having the offset settings in the user profile (or based on a client
IP address, etc.)
.
- References:
- Re: local time for remote users
- From: Alexey Smirnov
- Re: local time for remote users
- Prev by Date: Event
- Next by Date: Re: form1.target='_blank';
- Previous by thread: Re: local time for remote users
- Next by thread: Re: local time for remote users
- Index(es):
Relevant Pages
|