473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

universal time problem

I am building a .net client application that will be deployed world
wide.

The client can schedule reminders. To do this the user picks the
datetime he wants the reminder sent, _I convert the datetime to
Universal time_, and it is submitted through a web service - where it
finally saved to sql server.

I have one local webservice for my testing purposes, I will call this
service A.

I have production webservice also, I will call this service B. This
webservice is in a different timezone

When my client uses webervice A or B to save the reminder it ends up
as a different date in the database! Even though I converted the
datetime to Universal _in the client application_!

This is driving me somewhat crazy. What can I do to fix this behavior?

I have read in many places that it is best practice to:

- only write UTC times to the database
- do every calculation/comparison in UTC.
- only use local time (DST or not) to VISUALIZE to the user.
- if user enters (local) time, IMMEDIATELY convert to UTC,
and only save it as UTC, NEVER as local.
Tom

Nov 23 '05 #1
5 3401
I had a similar problem recently and it was because a computer had the right
local time, the wrong time zone and therefore the wrong UTC time. Are the
timezones and local times correct on the computers? (I am sure they are -
you just have to ask this question)

<th*****************@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I am building a .net client application that will be deployed world
wide.

The client can schedule reminders. To do this the user picks the
datetime he wants the reminder sent, _I convert the datetime to
Universal time_, and it is submitted through a web service - where it
finally saved to sql server.

I have one local webservice for my testing purposes, I will call this
service A.

I have production webservice also, I will call this service B. This
webservice is in a different timezone

When my client uses webervice A or B to save the reminder it ends up
as a different date in the database! Even though I converted the
datetime to Universal _in the client application_!

This is driving me somewhat crazy. What can I do to fix this behavior?

I have read in many places that it is best practice to:

- only write UTC times to the database
- do every calculation/comparison in UTC.
- only use local time (DST or not) to VISUALIZE to the user.
- if user enters (local) time, IMMEDIATELY convert to UTC,
and only save it as UTC, NEVER as local.
Tom

Nov 23 '05 #2
I had a similar problem recently and it was because a computer had the right
local time, the wrong time zone and therefore the wrong UTC time. Are the
timezones and local times correct on the computers? (I am sure they are -
you just have to ask this question)

<th*****************@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I am building a .net client application that will be deployed world
wide.

The client can schedule reminders. To do this the user picks the
datetime he wants the reminder sent, _I convert the datetime to
Universal time_, and it is submitted through a web service - where it
finally saved to sql server.

I have one local webservice for my testing purposes, I will call this
service A.

I have production webservice also, I will call this service B. This
webservice is in a different timezone

When my client uses webervice A or B to save the reminder it ends up
as a different date in the database! Even though I converted the
datetime to Universal _in the client application_!

This is driving me somewhat crazy. What can I do to fix this behavior?

I have read in many places that it is best practice to:

- only write UTC times to the database
- do every calculation/comparison in UTC.
- only use local time (DST or not) to VISUALIZE to the user.
- if user enters (local) time, IMMEDIATELY convert to UTC,
and only save it as UTC, NEVER as local.
Tom

Nov 23 '05 #3
Need some more info. Print the UTC when you create it, print the wire
formate and print it when the service gets it before storing it and see
where it is getting changed.

--
William Stacey [MVP]

<th*****************@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I am building a .net client application that will be deployed world
wide.

The client can schedule reminders. To do this the user picks the
datetime he wants the reminder sent, _I convert the datetime to
Universal time_, and it is submitted through a web service - where it
finally saved to sql server.

I have one local webservice for my testing purposes, I will call this
service A.

I have production webservice also, I will call this service B. This
webservice is in a different timezone

When my client uses webervice A or B to save the reminder it ends up
as a different date in the database! Even though I converted the
datetime to Universal _in the client application_!

This is driving me somewhat crazy. What can I do to fix this behavior?

I have read in many places that it is best practice to:

- only write UTC times to the database
- do every calculation/comparison in UTC.
- only use local time (DST or not) to VISUALIZE to the user.
- if user enters (local) time, IMMEDIATELY convert to UTC,
and only save it as UTC, NEVER as local.
Tom

Nov 23 '05 #4
Need some more info. Print the UTC when you create it, print the wire
formate and print it when the service gets it before storing it and see
where it is getting changed.

--
William Stacey [MVP]

<th*****************@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I am building a .net client application that will be deployed world
wide.

The client can schedule reminders. To do this the user picks the
datetime he wants the reminder sent, _I convert the datetime to
Universal time_, and it is submitted through a web service - where it
finally saved to sql server.

I have one local webservice for my testing purposes, I will call this
service A.

I have production webservice also, I will call this service B. This
webservice is in a different timezone

When my client uses webervice A or B to save the reminder it ends up
as a different date in the database! Even though I converted the
datetime to Universal _in the client application_!

This is driving me somewhat crazy. What can I do to fix this behavior?

I have read in many places that it is best practice to:

- only write UTC times to the database
- do every calculation/comparison in UTC.
- only use local time (DST or not) to VISUALIZE to the user.
- if user enters (local) time, IMMEDIATELY convert to UTC,
and only save it as UTC, NEVER as local.
Tom

Nov 23 '05 #5
[at least in .net 1.1), System.DateTime will not serialize correctly if it's
in UTC - it will always write the value of the DateTime object and then
append the PC's UTC offset. So if the local pc is UTC-5, and you have a
DateTime object that is set to 8/29/2005 @ 11:14:15am (UTC, non-utc, it
doesn't matter, as DateTime doesn't track this info - therein lies the
problem), it will serialize as "2005-08-29T11:14:15-05:00". Obviously, if
you have set this to UTC, it will be wrong. So, always serialize DateTime
objects only in local pc time.

"th*****************@yahoo.com" wrote:
I am building a .net client application that will be deployed world
wide.

The client can schedule reminders. To do this the user picks the
datetime he wants the reminder sent, _I convert the datetime to
Universal time_, and it is submitted through a web service - where it
finally saved to sql server.

I have one local webservice for my testing purposes, I will call this
service A.

I have production webservice also, I will call this service B. This
webservice is in a different timezone

When my client uses webervice A or B to save the reminder it ends up
as a different date in the database! Even though I converted the
datetime to Universal _in the client application_!

This is driving me somewhat crazy. What can I do to fix this behavior?

I have read in many places that it is best practice to:

- only write UTC times to the database
- do every calculation/comparison in UTC.
- only use local time (DST or not) to VISUALIZE to the user.
- if user enters (local) time, IMMEDIATELY convert to UTC,
and only save it as UTC, NEVER as local.
Tom

Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Priya | last post by:
Hi, I am having some problem with DB2 Universal JDBC driver. 1. The method getColumnType(columnNumber)of ResultSetMetaData always returns zero. 2. The method getColumnDisplaySize(ColumnNum)...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
0
by: Bing | last post by:
Hi, I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x environment and WebSphere application Server 5.0.2...
33
by: news.microsoft.com | last post by:
To Microsoft and fellow MSDN Universal subscribers... Regarding new MSDN Universal (I mean Premier) price and level changes: 1) Way too expensive for the small and medium developer Universal...
0
by: thomasamillergoogle | last post by:
I am building a .net client application that will be deployed world wide. The client can schedule reminders. To do this the user picks the datetime he wants the reminder sent, _I convert the...
9
by: Andrzej | last post by:
Greetings. Is there any project of universal environment for running programs written in C++ ? For example a programmer compiles program using compilator and linker that produces universal...
13
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
14
by: Robin Becker | last post by:
A user reports problems with one of our extensions when running the intel compiled extension on ppc and vice versa. He is building the extension as a universal binary. Although the intel compiled...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.