Re: local time for remote users

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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)


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
GetDate()
and Framework's DateTime.Now function/property.

Everything was fine until the client decided to use the app for its
plant in
the 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
run
on the same IIS and SQL server as the local app (i.e., here in north
america).

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
why> the far east userswere saying that timestamps were off by 13 hours.
I'm going
to 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
their
local time zone?

If it helps, I think that I should have timestamps in the database
reflect> the user's local time since in THIS case, the local and far east
plants
represent different business units and the data will not be combined for
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
In your case I think I would just add an offset value in the
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.)


.



Relevant Pages

  • Repeatable hard crash with 2.6.0.test[123]
    ... One application will reliably cause the system to crash when it exits ... This app worked fine and exited correctly ... the few changes needed to get the 2.kernels running. ... # ACPI Support ...
    (Linux-Kernel)
  • Re: Schannel and Session Renegotiation
    ... Schannel does not support the server sending app ... We are discussing the option of providing support for the client blowing off ...
    (microsoft.public.platformsdk.security)
  • [PATCH 06/13] async_tx: add support for asynchronous GF multiplication
    ... Some devices can natively support P+Q continuation and can skip ... +static struct page *scribble; ... * @offset: offset in pages to start transaction ...
    (Linux-Kernel)
  • Re: Avoid double execution of a program
    ... Sergey Bogdanov ... CreateEvent is not supported in my version of CF, as only GetEvents and GetProperties are supported as methods of System.ComponentModel.TypeDescriptor. ... Consider donating to support us! ... My .NET CF app is designoed to be executed once in target PDAs. ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: Unable to copy file. ... Access to the path ... is denied.
    ... not used by any other app. ... references are put in by VS2005 I do not use the resx files. ... ** it the service app used(configured in windows Service manager) when you ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.vsnet.general)