Time Zone and DateTime voes.

S

Satish Itty

Hi all,
I have a big problem in my hands and not sure how I can fix this. Any
suggestions would be greatly appreciated.
I have a .NET 3 tier app developed in VS2003 and .NET 1.1. the client is a
windows application and middle tier runs on IIS. Data is passed between the
client and middle tier as DataSets and custom value object classes. The
problem in my hand is that the client application is deployed in different
time zones and the middle tier is in Eastern Time Zone. So the users in time
zones different from eastern time zone see the datetime adjusted to their
local time, which messes up the system. A lot of the datetimes we use are
just for storing dates only the time part is 00:00:00 and the problem is
some user whoose time zone is behind eastern time see this the date is off
by a day.
On searching internet some of the alternatives I found was to convert
datetiemes into string which is not possible in my case becase I have date
calculation going on the client.
What are my options here to rectify this issue ?

Thanks in advance.
 
B

Brian Gideon

Satish,

I recommend storing, calculating, and manipulating times in UTC. When
it comes time to display the time to the end user then convert to the
local time zone. There are several advantages with this approach. Any
mistakes made in converting to the local time zone aren't as critical
since it only effects how the data is displayed and not how it's stored
or calculated. Also, you can completely ignore the effects of daylight
saving time except where displayed to the end user. The daylight
saving time logic can get a little complicated especially when dealing
with multiple time zones that have different definitions of it. Or
worse, the definitions change with time (ie. the United States will use
a different definition starting next year). And of course, you can
always assume 24 hours in a day when using UTC.

Brian
 
S

Satish Itty

My problem is that for most of the cases I'm storing only the dates so I
dont really want them to converted to local time. Every user no matter what
time zone they are in should see the same date. But since Im using the date
time variable with time part as 00:00:00 when it get converted to the local
time of a time zone behind the server all the dates are off by a day.

--
HTH
Satish
Brian Gideon said:
Satish,

I recommend storing, calculating, and manipulating times in UTC. When
it comes time to display the time to the end user then convert to the
local time zone. There are several advantages with this approach. Any
mistakes made in converting to the local time zone aren't as critical
since it only effects how the data is displayed and not how it's stored
or calculated. Also, you can completely ignore the effects of daylight
saving time except where displayed to the end user. The daylight
saving time logic can get a little complicated especially when dealing
with multiple time zones that have different definitions of it. Or
worse, the definitions change with time (ie. the United States will use
a different definition starting next year). And of course, you can
always assume 24 hours in a day when using UTC.

Brian
 
P

PS

Satish Itty said:
My problem is that for most of the cases I'm storing only the dates so I
dont really want them to converted to local time. Every user no matter
what time zone they are in should see the same date.

To see the same date they must also see the same time, i.e. at midnight
everyone no matter where they are moves to a new day. So base everything on
one time zone and that's what the time is no matter where you are in the
world.

PS

But since Im using the date
time variable with time part as 00:00:00 when it get converted to the
local time of a time zone behind the server all the dates are off by a
day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top