Adjusting Timezone - Convert XML DateTime to SQL DateTime

Posted by noob.spt on Stack Overflow See other posts from Stack Overflow or by noob.spt
Published on 2009-11-05T00:52:37Z Indexed on 2010/05/29 13:02 UTC
Read the original article Hit count: 277

Filed under:
|
|
|
|

We are using TypedDataSet in our application. Data is passed to procedure in form of XML for insert/update.

Now after populating DE with data, datetime remains the same though timezone information is added as below.

Date in DB: 2009-10-29 18:52:53.43 Date in XML: 2009-10-29T18:52:53.43-05:00

Now when I am trying to convert below XML to SQL DateTime it is adjusting 5 hours and I am getting

2009-10-29 23:52:53.430 as the final output, which is wrong. Need to find a way to extract datetime from below XML snippet ignoring timezone.

I have XML in following format, with timezone difference -05.00

<Order>
   <EnteredDateTime>2009-10-29T18:52:53.43-05:00</EnteredDateTime>
</Order>

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET