Convert datetime to certain format
-
Hello All, I need to convert this value of datetime 2012-09-16T20:08:30Z to this format "mmddyy". I tried select convert(char(10),'2012-09-16T20:08:30Z',101) - but this did not work. Is there any other method to try before trying to write a whole bunch of casts, replaces!
-
Hello All, I need to convert this value of datetime 2012-09-16T20:08:30Z to this format "mmddyy". I tried select convert(char(10),'2012-09-16T20:08:30Z',101) - but this did not work. Is there any other method to try before trying to write a whole bunch of casts, replaces!
vanikanc wrote:
I need to convert this value of datetime
2012-09-16T20:08:30Z to this format "mmddyy".Doesn't seem a valid datetime format to me As a string-function use:
SELECT LEFT('2012-09-16T20:08:30Z', 10) ...
With values in datetime-format:
SELECT CONVERT(DATE,@datetime)
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.