473,756 Members | 2,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.NET DateTime Purchase Date and Birth Date shifting

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
3 2084
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*******@disc ussions.microso ft.comwrote in message
news:ED******** *************** ***********@mic rosoft.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
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*******@disc ussions.microso ft.comwrote in message
news:ED******** *************** ***********@mic rosoft.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
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*******@disc ussions.microso ft.comwrote in message
news:ED******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1678
by: Terry Hancock | last post by:
What do you do when a date or time is incompletely specified? ISTM, that as it is, there is no formal way to store this --- you have to guess, and there's no way to indicate that the guess is different from solid information. As a result, I have sometimes had to abandon datetime, even though it seemed like the logical choice for representing data. E.g. I might have information like "this paper was published in May 1997". There's no...
20
11857
by: Gav | last post by:
I have a database with date of births stored dd/mm/yyyy (english dating system) and =date() returns a date in the same format in my server. how do i find the persons age using these two pieces of date. thanks gavin
16
2116
by: KL | last post by:
I am working on a problem and desperately need help! I need to prompt a user for the numerical month of birth, day of birth and year of birth and store it in varialbes and the use the variables to build a date object. Then print the resulting date object, in it's full form. on the screen using document.write. This IS for school and I think I am starting out right, but can't quite seem to grasp what I am doing wrong, or where to go from...
3
1822
by: ad | last post by:
I have a DataView, say myDV, it contain a DataTime field, "Birth". I want to get the Birth Value from the DataView: DateTiem dBirth= (DateTime)myDV; But the complier throw an error. How can I get datetime for Dataview?
1
1586
by: Lerp | last post by:
Hi all, What do I have to do in order to get my value from my textbox that is formatted like 'mm/dd/yyyy' into a datetime database field ? Currently getting an error: Syntax error converting datetime from character string I have 2 validators on this form field as seen below along with a sub that is supposed to be called on ServerValidate (which it seems it is misfiring)
4
2482
by: Michael C# | last post by:
Given a DateTime variable, what's the best way to check "minor" status (i.e., less than age 18 years) based on today's date? I came up with this: Dim minor As Boolean = true 'dtDOB is a DateTime variable set to Date of Birth If (DateTime.Now.Subtract(dteDOB.Value.AddYears(18)).TotalDays >= 0) Then minor = false End If This appears to work, but seems a little obfuscated. I was just wondering
24
2033
by: rn5a | last post by:
The date in my local machine is set to the dd/MM/yyyy format. When I insert a date in a MS-Access DB table, it gets populated in the above format. For e.g. if the date is, say, 8th March 2007, it gets populated in the DB table as 08/03/2007 In other words, first the day is shown, then the month & finally the year but when I retrieve it in ASP.NET & using DatePart, try to extract the day & the month like this (assume that the date...
2
1203
by: Matuag | last post by:
Hi All, I am trying to create a form which can calculate with Age and Birth Date fields. I want Age to be calculated based on Birth Date (which I managed to do) but at the same time if Birth Date is not available it should allow users to enter the age in the same field. Is this possible?
3
3412
by: jamieharrop | last post by:
Afternoon all, I've been battling with this all day today and my brain is now pretty much fried. I have one table that lists several details about my customers (name, address, phone, date of birth etc). I want to create a query that will allow me to enter a start date and an end date and will then display the customers who have birthdays within those two dates. I know I can do this using:
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.