473,396 Members | 2,151 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,396 software developers and data experts.

Help! Something adds 1 hour to my datetimes! :-S

Hi,

For some reason, somewhere in my application 1 hour is added to my dates,
depending in which time zone the application is run...
Because I don't have a clue where this happens, I posted this to the three
relevant newsgroups (vb/ado, sql and xml): my aplogize for this.

I'm doing a Synchronisation between two SQL Servers (2000): All the Data is
read into a DataSet, and exported to an XML-file:
SQL Server -> DataSet (VB.NET 2003) -> XML -> DataSet -> SQL Server

When I run everything in the West Central Africa Timezone (GMT+1, no
summer-time): everything works fine. But I notice that all my dates in my
XML-file are written like this
"<DATE_DEB_APP>2006-02-01T00:00:00.0000000+01:00</DATE_DEB_APP> ": with the
"+01:00" at the end. But not that big of a problem, because the application
writes the date with 00:00 hours to the database.

I (well, my pc) is in the Brussels Timezone (GMT+1: but because of the
summer-hour we actuallt have GTM+2 now).
Everything goes fine also when I put the databse on my local SQL Server,
make the XML-file, read it again, and write it to the other database (also
local). All the dates are also presented with the "+01:00"-suffix. Except
one: a date that the application writes to the database when filling the
DataSet, and select it at the end to put it in the XML-file also: this one
gets the suffix "+02:00":
<SyncSend>2006-05-03T09:58:19.6070000+02:00</SyncSend>

So far so good: some not-really wanted things, but everything goes fine.

Problems start when I'm doing a synchronisation between an SQL server in
Central African TimeZone, and a local one in Brussels Timezone.
What hapens is that all my dates are having 1 hour added to them! So instead
of the "2006-02-01T00:00:00" they have as value "2006-02-01T01:00:00"!!

I somehow can understand why this happens; because 00:00h in Central Africa
is 01:00h in Brussels on this moment. But I don't want it to happen! I want
the exact time to be transfered!

Does anybody has a clue where this exactly happens? And how to prevent this?
Is there a way to say that it has to use the actual value? and not one that
calculates the time?

On this moment it's really nice to be able to use tha capbilities of the
DataSet with the XML-files and SqlDataAdapter with commandbuilder to do my
insert and updates. I won't really like to loose this :-S

Thanks a lot in advance!

Any help our hints would be really appreciated!

Pieter
May 3 '06 #1
3 975
Reading your post, it sounds like you want the Brussels events to use UTC
and the African events to not. If so, you will have to write in something
that detects where the event is occuring and adjust, if necessary.

The system, itself, will either use UTC (default) or local. If you wanted to
configure to one or the other, it is possible. But, configuring different
client locations to different methods is problematic and will require custom
coding.

Hope I understand the problem. Good luck!

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Pieter Coucke" <pi**********@hotmail.com> wrote in message
news:OC*************@TK2MSFTNGP02.phx.gbl...
Hi,

For some reason, somewhere in my application 1 hour is added to my dates,
depending in which time zone the application is run...
Because I don't have a clue where this happens, I posted this to the three
relevant newsgroups (vb/ado, sql and xml): my aplogize for this.

I'm doing a Synchronisation between two SQL Servers (2000): All the Data
is read into a DataSet, and exported to an XML-file:
SQL Server -> DataSet (VB.NET 2003) -> XML -> DataSet -> SQL Server

When I run everything in the West Central Africa Timezone (GMT+1, no
summer-time): everything works fine. But I notice that all my dates in my
XML-file are written like this
"<DATE_DEB_APP>2006-02-01T00:00:00.0000000+01:00</DATE_DEB_APP> ": with
the "+01:00" at the end. But not that big of a problem, because the
application writes the date with 00:00 hours to the database.

I (well, my pc) is in the Brussels Timezone (GMT+1: but because of the
summer-hour we actuallt have GTM+2 now).
Everything goes fine also when I put the databse on my local SQL Server,
make the XML-file, read it again, and write it to the other database (also
local). All the dates are also presented with the "+01:00"-suffix. Except
one: a date that the application writes to the database when filling the
DataSet, and select it at the end to put it in the XML-file also: this one
gets the suffix "+02:00":
<SyncSend>2006-05-03T09:58:19.6070000+02:00</SyncSend>

So far so good: some not-really wanted things, but everything goes fine.

Problems start when I'm doing a synchronisation between an SQL server in
Central African TimeZone, and a local one in Brussels Timezone.
What hapens is that all my dates are having 1 hour added to them! So
instead of the "2006-02-01T00:00:00" they have as value
"2006-02-01T01:00:00"!!

I somehow can understand why this happens; because 00:00h in Central
Africa is 01:00h in Brussels on this moment. But I don't want it to
happen! I want the exact time to be transfered!

Does anybody has a clue where this exactly happens? And how to prevent
this? Is there a way to say that it has to use the actual value? and not
one that calculates the time?

On this moment it's really nice to be able to use tha capbilities of the
DataSet with the XML-files and SqlDataAdapter with commandbuilder to do my
insert and updates. I won't really like to loose this :-S

Thanks a lot in advance!

Any help our hints would be really appreciated!

Pieter

May 3 '06 #2
Pieter,

This is due to the standard way in which dotnet DateTimes are serialized and
deserialized.

To see what is happening, write a test app and, run code like this :

==
DateTime dt = // set to any DateTime you want to test
MessageBox.Show(dt.ToString("yyyy-MM-dd HH:mm:ss")); // X
string SerializedDate = XmlConvert.ToString(dt);
MessageBox.Show(SerializedDate); // Y
==
Close this test app, then change to another timezone on your PC, restart
your test app, then run code like this :
==
string SerializedDate = // set to exact string value shown when "Y" above
is run.
DateTime dt = XmlConvert.ToDateTime(SerializedDate);
MessageBox.Show(dt.ToString("yyyy-MM-dd HH:mm:ss")); // Z
==

You should see that the values shown by X and Z are different, as a result
of a DateTime being serialized in one timezone, and deserialized in another.

One possible solution might be to manually modify the serialized XML at the
deserialization end, just before deserialization takes place. You'd need to
tweak the timezone components of the serialized DateTime strings, so that
they would look like local DateTimes when they are deserialized. (This
applies mainly for dotnet 1.1 - there may be better ways in dotnet 2.0).

HTH,
Stephen
"Pieter Coucke" <pi**********@hotmail.com> wrote in message
news:OC*************@TK2MSFTNGP02.phx.gbl...
Hi,

For some reason, somewhere in my application 1 hour is added to my dates,
depending in which time zone the application is run...
Because I don't have a clue where this happens, I posted this to the three
relevant newsgroups (vb/ado, sql and xml): my aplogize for this.

I'm doing a Synchronisation between two SQL Servers (2000): All the Data
is read into a DataSet, and exported to an XML-file:
SQL Server -> DataSet (VB.NET 2003) -> XML -> DataSet -> SQL Server

When I run everything in the West Central Africa Timezone (GMT+1, no
summer-time): everything works fine. But I notice that all my dates in my
XML-file are written like this
"<DATE_DEB_APP>2006-02-01T00:00:00.0000000+01:00</DATE_DEB_APP> ": with
the "+01:00" at the end. But not that big of a problem, because the
application writes the date with 00:00 hours to the database.

I (well, my pc) is in the Brussels Timezone (GMT+1: but because of the
summer-hour we actuallt have GTM+2 now).
Everything goes fine also when I put the databse on my local SQL Server,
make the XML-file, read it again, and write it to the other database (also
local). All the dates are also presented with the "+01:00"-suffix. Except
one: a date that the application writes to the database when filling the
DataSet, and select it at the end to put it in the XML-file also: this one
gets the suffix "+02:00":
<SyncSend>2006-05-03T09:58:19.6070000+02:00</SyncSend>

So far so good: some not-really wanted things, but everything goes fine.

Problems start when I'm doing a synchronisation between an SQL server in
Central African TimeZone, and a local one in Brussels Timezone.
What hapens is that all my dates are having 1 hour added to them! So
instead of the "2006-02-01T00:00:00" they have as value
"2006-02-01T01:00:00"!!

I somehow can understand why this happens; because 00:00h in Central
Africa is 01:00h in Brussels on this moment. But I don't want it to
happen! I want the exact time to be transfered!

Does anybody has a clue where this exactly happens? And how to prevent
this? Is there a way to say that it has to use the actual value? and not
one that calculates the time?

On this moment it's really nice to be able to use tha capbilities of the
DataSet with the XML-files and SqlDataAdapter with commandbuilder to do my
insert and updates. I won't really like to loose this :-S

Thanks a lot in advance!

Any help our hints would be really appreciated!

Pieter

May 4 '06 #3
Ok, Thanks for the advice Gregory and Stephen!
May 4 '06 #4

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

Similar topics

9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
4
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to...
2
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
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: 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...
0
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...
0
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...
0
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,...

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.