473,320 Members | 1,746 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,320 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 3397
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.