0

I'm having a table IMAGEDATA in which the column VALUE stores datetime format in en-US (for ex. 06/08/2012 02:10:36 p.m.). I need to convert the datetime format to ISO8601 format (ex. 2012-08-22T13:10:39) for all the rows that are currently in the table. I'm novice in these topics. Could you please me some better approach it will be more helpful.Thanks.

praveen
  • 12,083
  • 1
  • 41
  • 49

1 Answers1

1

Internally Datetime values are stored as 2 integers . They are not stored in the specific format in which they are inserted .In order to convert to 8601 format try the below code

Declare @date datetime
set @date = '06/08/2012 02:10:36 '
Select convert(varchar(30),@date,126)
praveen
  • 12,083
  • 1
  • 41
  • 49