views:

177

answers:

2

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>
A: 

2009-10-29 18:52:53.43 is not the same time as 2009-10-29T18:52:53.43-05:00. It's the first step that is incorrect. The conversion from XML to SQL DateTime is correct.

ISO 8601

Bryan
Ok. I understand that. But then what's the solution? Do I need to make change to my select statement? Why "2009-10-29 18:52:53.43" is getting converted to "2009-10-29T18:52:53.43-05:00"?
noob.spt
I've never seen SQL Server output a date in that format. Where is the DB->XML string happening? That's where the issue is. Do you have control over this code?
Bryan
I don't. We are using Enterprise Library to populate this dataset.
noob.spt
A: 

sorry for simply forwarding with an external link, but i found this resource useful recently and always favour authoritative info.

Coding Best Practices Using DateTime in the .NET Framework

MarkyBoyMark