PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Can time zone be ignored in a DateTime DataColumn deserialization?

 
 
Joe
Guest
Posts: n/a
 
      4th Mar 2010
Hello,

We serialize a DataTables that have columns which are DateTime. When the
DataTable is deserialized it displays the date in the local time zone
instead of the time the date was saved as.

We actually don't even display the time portion, we just use the date but
since the default time is 12:00AM, when the file is open in another time
zone say -3 the date shows the prior date.

I know this is expected behaviour but it's not what we want.

Any ideas?

Thanks,
Joe


 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      5th Mar 2010
No ideas...this isn't looking good...

"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> We serialize a DataTables that have columns which are DateTime. When the
> DataTable is deserialized it displays the date in the local time zone
> instead of the time the date was saved as.
>
> We actually don't even display the time portion, we just use the date but
> since the default time is 12:00AM, when the file is open in another time
> zone say -3 the date shows the prior date.
>
> I know this is expected behaviour but it's not what we want.
>
> Any ideas?
>
> Thanks,
> Joe
>



 
Reply With Quote
 
Colbert Zhou [MSFT]
Guest
Posts: n/a
 
      6th Mar 2010
Hello Joe,

This can be resolved by setting DateTimeMode to default NO OFFSET. See
comments in this link,
https://connect.microsoft.com/wcf/fe...time-values-in
-a-dataset-shifted-by-timezone?wa=wsignin1.0

"Basically, I think the default DateTimeMode ( which can be edited on a
datetime column in the dataset designer ) should default to a time mode
that does not apply an offset on serialization. I think that is the issue,
when you serialize, by default NO OFFSET should be applied. But the default
datetimemode in a dataset designer is to UnspecifiedLocal, which applies an
offset.

You can ( at least you should be able to ) change the default DateTimeMode
in the dataset designer, and get the correct serialization behavior."

And we have migrated our managed newsgroup support to the MSDN forum
platform. So if, in futhure, you have any questions regarding to .NET or
C#, you can find corresponding MSDN Forum to get prompt support. Here is
the list of the current managed forum.
http://msdn.microsoft.com/en-us/subs.../aa974230.aspx

Here are C# and BCL forums,
http://social.msdn.microsoft.com/For...eneral/threads
http://social.msdn.microsoft.com/for...fxbcl/threads/


Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DateTime.Now returns incorrect time after time zone change RFlaugher Microsoft Dot NET Compact Framework 8 12th Apr 2010 05:14 PM
DateTime Class shows wrong time when Time Zone is changed Dave Hall Microsoft Dot NET Compact Framework 6 14th Jul 2004 06:05 PM
How do I convert a DateTime to another time zone? =?Utf-8?B?TGFycnkgRkFB?= Microsoft Dot NET Framework 5 31st Mar 2004 01:49 AM
How do I convert a DateTime to another time zone? =?Utf-8?B?TGFycnkgRkFB?= Microsoft C# .NET 4 29th Mar 2004 12:31 PM
How do I convert a DateTime to another time zone? =?Utf-8?B?TGFycnkgRkFB?= Microsoft VB .NET 5 29th Mar 2004 12:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:13 AM.