<DocumentElement> <tLockhistory> <lockrequesteddate>2012-12-14T00:00:00+05:30</lockrequesteddate> <lockexpirydate>2012-12-29T00:00:00+05:30</lockexpirydate> <createddate>2012-12-14T00:00:00+05:30</createddate> </tLockhistory> <tLockhistory> <lockrequesteddate>2012-12-14 00:00:00</lockrequesteddate> <lockexpirydate>2012-12-29 00:00:00</lockexpirydate> <createddate>2012-12-14 00:00:00</createddate> </tLockhistory></DocumentElement>
declare @xml xml ='<DocumentElement><tLockhistory><lockrequesteddate>2012-12-14T00:00:00+05:30</lockrequesteddate><lockexpirydate>2012-12-29T00:00:00+05:30</lockexpirydate><createddate>2012-12-14T00:00:00+05:30</createddate></tLockhistory><tLockhistory><lockrequesteddate>2012-12-14 00:00:00</lockrequesteddate><lockexpirydate>2012-12-29 00:00:00</lockexpirydate><createddate>2012-12-14 00:00:00</createddate></tLockhistory></DocumentElement> '-- selecting the value as CHAR(19) will take the date and time, but drop the timezone information, giving you the "local" time.select cast(nd.value('(./lockrequesteddate/text())[1]','char(19)') as datetime) as lockrequesteddatefrom @xml.nodes('/DocumentElement/tLockhistory') as x(nd)