By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,275 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

.NET DateTime Purchase Date and Birth Date shifting

P: n/a
Birth Date and a Purchase Date aata is being stored in sql. This information
is retrieved across time zones through a .Net Web Service. When the data is
viewed in a .Net client application these dates are shifted due to time zone
differences. Anyone know the best way to stop this ffrom happening?
Jul 19 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
First, it depends on how the DateTime values are stored. Are they stored as
local DateTimes or UTC DateTimes? I would recommend storing them as UTC
DateTimes, and then the client can simply convert it to local.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"C Villalba" <CV*******@discussions.microsoft.comwrote in message
news:ED**********************************@microsof t.com...
Birth Date and a Purchase Date aata is being stored in sql. This
information
is retrieved across time zones through a .Net Web Service. When the data
is
viewed in a .Net client application these dates are shifted due to time
zone
differences. Anyone know the best way to stop this ffrom happening?

Jul 19 '06 #2

P: n/a
I have set up a tester where i am storing the Dates in UTC format in Sql. I
then pull it out of sql still in UTC and pass it on to the client through a
web service. I save the file on my machine so i can reopen it as i move
through time zones. I then display the value in a text box to see what i get.
As i move through time zones on my machine and reopen the tester i notice
that even the utc time is shifting and eventually the date shifts to the day
before the actual purchase or birth date. Any ideas?

"Kevin Spencer" wrote:
First, it depends on how the DateTime values are stored. Are they stored as
local DateTimes or UTC DateTimes? I would recommend storing them as UTC
DateTimes, and then the client can simply convert it to local.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"C Villalba" <CV*******@discussions.microsoft.comwrote in message
news:ED**********************************@microsof t.com...
Birth Date and a Purchase Date aata is being stored in sql. This
information
is retrieved across time zones through a .Net Web Service. When the data
is
viewed in a .Net client application these dates are shifted due to time
zone
differences. Anyone know the best way to stop this ffrom happening?


Jul 19 '06 #3

P: n/a
Hi,

I think you should read the following article:

http://msdn.microsoft.com/library/de...tetimecode.asp

It explains some best practices using datetimes in .NET and also what the
problems are when transferring datetimes in XML format. I'm sure you will
find some useful information in that article.

Hope this helps,

Joris

"C Villalba" wrote:
I have set up a tester where i am storing the Dates in UTC format in Sql. I
then pull it out of sql still in UTC and pass it on to the client through a
web service. I save the file on my machine so i can reopen it as i move
through time zones. I then display the value in a text box to see what i get.
As i move through time zones on my machine and reopen the tester i notice
that even the utc time is shifting and eventually the date shifts to the day
before the actual purchase or birth date. Any ideas?

"Kevin Spencer" wrote:
First, it depends on how the DateTime values are stored. Are they stored as
local DateTimes or UTC DateTimes? I would recommend storing them as UTC
DateTimes, and then the client can simply convert it to local.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"C Villalba" <CV*******@discussions.microsoft.comwrote in message
news:ED**********************************@microsof t.com...
Birth Date and a Purchase Date aata is being stored in sql. This
information
is retrieved across time zones through a .Net Web Service. When the data
is
viewed in a .Net client application these dates are shifted due to time
zone
differences. Anyone know the best way to stop this ffrom happening?
Jul 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.