Hi,
I am serializing a collection of objects of a Type(Class).
The class contians a DateTime type property in it.
Now, I am serializing this collection.
For some of the DateTime values, I get the DateTime with the TimeZone
Information included in the XML.
Like this ... 2007-05-30T16:12:55.79239Z
Now, I dont want this in my XML, as it creates problem while converting this
value to datetime in SQL SERVER.
I an using .Net 2.0 and SQL Server 2005.
One of the the following to solutions is required.
1. The XML generated by serialization does not have the time zone
information with for the field.
or
2. Handling the conversion of a string representing this DateTime with
TimeZone information in SQL Server to convert it to SQL Date Time.
I need some solution for this urgently.
Regards
Sugandh
On May 30, 12:30 pm, "Sugandh Jain" <sugandh.j
@nirvana-sol.com>
wrote:
> Hi,
> I am serializing a collection of objects of a Type(Class).
> The class contians a DateTime type property in it.
> Now, I am serializing this collection.
> For some of the DateTime values, I get the DateTime with the TimeZone
> Information included in the XML.
> Like this ... 2007-05-30T16:12:55.79239Z
> Now, I dont want this in my XML, as it creates problem while converting this
> value to datetime in SQL SERVER.
> I an using .Net 2.0 and SQL Server 2005.
> One of the the following to solutions is required.
> 1. The XML generated by serialization does not have the time zone
> information with for the field.
> or
> 2. Handling the conversion of a string representing this DateTime with
> TimeZone information in SQL Server to convert it to SQL Date Time.
> I need some solution for this urgently.
> Regards
> Sugandh
The best way to handle this is to solve the problem that is causing
timezone information to appear in your serialized data. I would do
this by tweaking the class definition. For each datetime field, apply
the <XMLIgnore> attribute to it, and substitute a string-valued
property that retrieves/sets the datetime field correctly.