473,671 Members | 2,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3426
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.goo glegroups.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.goo glegroups.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.goo glegroups.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.goo glegroups.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
1873
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) raises an exception, with exception message - not supported. Version of DB2 - 7.1
4
6339
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 found that it was shifted three Bytes to the left, i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This means that the value written and the value read sometimes do not match, which is of course inacceptable for all real world...
0
3080
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 on Windows 2000 machines. I configured a connection pool data source using type 4 for a local test environment in WSAD 5.1.x, and a connection pool data source on the WebSphere Server too. Both data sources are accessing the same database.
33
2709
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 subscriber (and some large ones as well). $10,000 - $15,000 per user?!? Forget it! 2) Do you (MS) honestly believe that the market you are targeting will just buy this product on good faith? Without our recommendations? Think about
0
284
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 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.
9
1852
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 executable file (not system executable file) and then he starts that program using some kind of emulator that can be implemented in any platform. That is like Java but only for C/C++ programs. Is there somewhere such project ?
13
6495
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
1657
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 version runs fine it displays a known bug when run on a ppc. It appears we have an endianness dependency which is statically compiled into the binaries. One proposed fix is to make the endian variable code dynamically change at run time. ...
0
8917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8598
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,...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7437
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6229
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
5696
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
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
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.