How do I prevent saving of time-zone information during serialization... 
Author Message
 How do I prevent saving of time-zone information during serialization...

Any DateTime object itself is timezone-dependent
(invariant time is dependent on GMT). The best way I
reckon to avoid such issues is to set the DateTimeFormat
property of the object to be serialiazed. If this is not
not done the Invariant DateTimeFormat is used.

Quote:
>-----Original Message-----

>I notice that when I serialize an instance of a class
that contains a
>dataset which contains a datetime column, the time-zone
information on the
>system on which I perform the serialization is saved

along with the datetime
Quote:
>value (please see the attached file).

>The datetime value in the attached file is '9/10/2002

10:06:46 AM' but also
Quote:
>notice the '-07:00' close to this value, which indicates -
7 hours from GMT
>(I am in the PST time-zone and I suppose the -7:00 has

adjusted for daylight
Quote:
>savings - not sure).

>I would like to be able to perform the serialization

without the time-zone
Quote:
>information being saved. Is this what is

called "invariant" time? In any
Quote:
>case, any clues would be appreciated.

>NOTE: This issue can be especially tricky when passing a
byte array of
>serialized datetime values between clients and web

services that are in
Quote:
>different time zones; each must programmatically adjust
the time. I'd
>appreciate a built-in way to save "static" datetime
values that are
>timezone-independent!

>Thanks,

>Taiwo



Mon, 28 Mar 2005 18:29:30 GMT  
 How do I prevent saving of time-zone information during serialization...
You need to be careful about what you really want here. When date time
information is serialized, it may be converted so that is represents the
correct time when it is sent to a different time zone. In this respect the
date time is invarient under serialization, as we always take into account
the local time at the ends of the wire. The representation can change, but
the time represented does not change.

If you in fact want time that does change every time you send it to a
different time zone, that is you send "10:00 1/2/2002" from Seattle to
Timbucktoo and get "10:00 1/2/2002" at the other end, then you should send
the time as a string. That will prevent it being treated as a piece of date
time information, and treat it simply as a set of characters. If you want a
static set of characters, then use string.

NOTE: a version of date time that is not adjusted with respect to time zone
is under consideration for a future version.

--
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:

> I notice that when I serialize an instance of a class that contains a
> dataset which contains a datetime column, the time-zone information on the
> system on which I perform the serialization is saved along with the
datetime
> value (please see the attached file).

> The datetime value in the attached file is '9/10/2002 10:06:46 AM' but
also
> notice the '-07:00' close to this value, which indicates -7 hours from GMT
> (I am in the PST time-zone and I suppose the -7:00 has adjusted for
daylight
> savings - not sure).

> I would like to be able to perform the serialization without the time-zone
> information being saved. Is this what is called "invariant" time? In any
> case, any clues would be appreciated.

> NOTE: This issue can be especially tricky when passing a byte array of
> serialized datetime values between clients and web services that are in
> different time zones; each must programmatically adjust the time. I'd
> appreciate a built-in way to save "static" datetime values that are
> timezone-independent!

> Thanks,

> Taiwo



Tue, 29 Mar 2005 04:32:04 GMT  
 How do I prevent saving of time-zone information during serialization...

Thanks Kim. I am not really complaining at this point as I knew that I
could, with more work than I'd like to, programmatically solve this
particular problem. It's just that I don't think I can bind a date
represented as a string to a DateTimePicker control - at least I haven't
tried it. Plus I'd have to do all kinds of kludgy stuff to get the string
date in/out of databases since I need to perform *date* operations on the
data as stored in-situ in the database.

Anyway, it was a design omission that might be rectified in the future so
that's good enough.

One last question though, after I deserialize a piece of datetime
information, is it possible to find out the time zone at the serialization
source? At least with this piece of information, I can programmatically
adjust the date as I want.

Thanks,

Taiwo



Quote:
> You need to be careful about what you really want here. When date time
> information is serialized, it may be converted so that is represents the
> correct time when it is sent to a different time zone. In this respect the
> date time is invarient under serialization, as we always take into account
> the local time at the ends of the wire. The representation can change, but
> the time represented does not change.

> If you in fact want time that does change every time you send it to a
> different time zone, that is you send "10:00 1/2/2002" from Seattle to
> Timbucktoo and get "10:00 1/2/2002" at the other end, then you should send
> the time as a string. That will prevent it being treated as a piece of
date
> time information, and treat it simply as a set of characters. If you want
a
> static set of characters, then use string.

> NOTE: a version of date time that is not adjusted with respect to time
zone
> is under consideration for a future version.

> --
> Please do not send email directly to this alias. This alias is for
newsgroup
> purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > I notice that when I serialize an instance of a class that contains a
> > dataset which contains a datetime column, the time-zone information on
the
> > system on which I perform the serialization is saved along with the
> datetime
> > value (please see the attached file).

> > The datetime value in the attached file is '9/10/2002 10:06:46 AM' but
> also
> > notice the '-07:00' close to this value, which indicates -7 hours from
GMT
> > (I am in the PST time-zone and I suppose the -7:00 has adjusted for
> daylight
> > savings - not sure).

> > I would like to be able to perform the serialization without the
time-zone
> > information being saved. Is this what is called "invariant" time? In any
> > case, any clues would be appreciated.

> > NOTE: This issue can be especially tricky when passing a byte array of
> > serialized datetime values between clients and web services that are in
> > different time zones; each must programmatically adjust the time. I'd
> > appreciate a built-in way to save "static" datetime values that are
> > timezone-independent!

> > Thanks,

> > Taiwo



Tue, 29 Mar 2005 06:54:10 GMT  
 How do I prevent saving of time-zone information during serialization...

While I see that this makes reasonable amount of sense for most scenarios, I
think you point about 'sending a string' is not exactly a usable one. If you
have an object you serialize you have to live with its structure and going
around modifying it is surely a hack at best.

OTOH, it seems logical that hte time zone conversion would take place -
frankly I can't think of many scenarios when this shouldn't happen.
s
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwthreads/
-----------------------------------
Making waves on the Web with Visual FoxPro


Quote:
> You need to be careful about what you really want here. When date time
> information is serialized, it may be converted so that is represents the
> correct time when it is sent to a different time zone. In this respect the
> date time is invarient under serialization, as we always take into account
> the local time at the ends of the wire. The representation can change, but
> the time represented does not change.

> If you in fact want time that does change every time you send it to a
> different time zone, that is you send "10:00 1/2/2002" from Seattle to
> Timbucktoo and get "10:00 1/2/2002" at the other end, then you should send
> the time as a string. That will prevent it being treated as a piece of
date
> time information, and treat it simply as a set of characters. If you want
a
> static set of characters, then use string.

> NOTE: a version of date time that is not adjusted with respect to time
zone
> is under consideration for a future version.

> --
> Please do not send email directly to this alias. This alias is for
newsgroup
> purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > I notice that when I serialize an instance of a class that contains a
> > dataset which contains a datetime column, the time-zone information on
the
> > system on which I perform the serialization is saved along with the
> datetime
> > value (please see the attached file).

> > The datetime value in the attached file is '9/10/2002 10:06:46 AM' but
> also
> > notice the '-07:00' close to this value, which indicates -7 hours from
GMT
> > (I am in the PST time-zone and I suppose the -7:00 has adjusted for
> daylight
> > savings - not sure).

> > I would like to be able to perform the serialization without the
time-zone
> > information being saved. Is this what is called "invariant" time? In any
> > case, any clues would be appreciated.

> > NOTE: This issue can be especially tricky when passing a byte array of
> > serialized datetime values between clients and web services that are in
> > different time zones; each must programmatically adjust the time. I'd
> > appreciate a built-in way to save "static" datetime values that are
> > timezone-independent!

> > Thanks,

> > Taiwo



Thu, 31 Mar 2005 10:12:21 GMT  
 How do I prevent saving of time-zone information during serialization...

I certainly don't want conversion to take place for someone's date of
birth - in fact for most dates that I can think of. If you were born in
Tokyo on 1/1/1970 12:00 AM, I certainly don't want that date to appear as
12/31/1969 7:00 AM when I receive the serialized data in Seattle!

---
Taiwo



Quote:

> While I see that this makes reasonable amount of sense for most scenarios,
I
> think you point about 'sending a string' is not exactly a usable one. If
you
> have an object you serialize you have to live with its structure and going
> around modifying it is surely a hack at best.

> OTOH, it seems logical that hte time zone conversion would take place -
> frankly I can't think of many scenarios when this shouldn't happen.
> s
> +++ Rick ---

> --

> Rick Strahl
> West Wind Technologies
> http://www.west-wind.com/
> http://www.west-wind.com/wwthreads/
> -----------------------------------
> Making waves on the Web with Visual FoxPro


> > You need to be careful about what you really want here. When date time
> > information is serialized, it may be converted so that is represents the
> > correct time when it is sent to a different time zone. In this respect
the
> > date time is invarient under serialization, as we always take into
account
> > the local time at the ends of the wire. The representation can change,
but
> > the time represented does not change.

> > If you in fact want time that does change every time you send it to a
> > different time zone, that is you send "10:00 1/2/2002" from Seattle to
> > Timbucktoo and get "10:00 1/2/2002" at the other end, then you should
send
> > the time as a string. That will prevent it being treated as a piece of
> date
> > time information, and treat it simply as a set of characters. If you
want
> a
> > static set of characters, then use string.

> > NOTE: a version of date time that is not adjusted with respect to time
> zone
> > is under consideration for a future version.

> > --
> > Please do not send email directly to this alias. This alias is for
> newsgroup
> > purposes only.
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.


> > > I notice that when I serialize an instance of a class that contains a
> > > dataset which contains a datetime column, the time-zone information on
> the
> > > system on which I perform the serialization is saved along with the
> > datetime
> > > value (please see the attached file).

> > > The datetime value in the attached file is '9/10/2002 10:06:46 AM' but
> > also
> > > notice the '-07:00' close to this value, which indicates -7 hours from
> GMT
> > > (I am in the PST time-zone and I suppose the -7:00 has adjusted for
> > daylight
> > > savings - not sure).

> > > I would like to be able to perform the serialization without the
> time-zone
> > > information being saved. Is this what is called "invariant" time? In
any
> > > case, any clues would be appreciated.

> > > NOTE: This issue can be especially tricky when passing a byte array of
> > > serialized datetime values between clients and web services that are
in
> > > different time zones; each must programmatically adjust the time. I'd
> > > appreciate a built-in way to save "static" datetime values that are
> > > timezone-independent!

> > > Thanks,

> > > Taiwo



Fri, 01 Apr 2005 10:52:57 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Real time From Time Zone information

2. Getting time zone information?

3. Must saving be always be done using serialization?!

4. Read/Write Properties During Design Time, but Read-Only During Run-Time

5. How to convert local time with specific time zone to UTC time in Win32 API

6. How to convert local time to gmt using a local variable time zone per process/thread

7. set date/time/time zone dialog

8. Obtain Time Zone

9. Time Zones

10. How to maintain TimeStamp consistency across Time Zones?

11. Dataset DateTime column value affected by time zone setting

12. Need time zone conversion routine/program/function that is callable, pcumming

 

 
Powered by phpBB® Forum Software