Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
avmreddy17
Posting Yak Master
180 Posts |
Posted - 2008-07-05 : 10:31:55
|
| I have a column of datatype VARCHAR(32) and the value in that is GMT date/time , What is the good way of converting it into Eastern time and the output should of the datatype DATETIME, so that I can use the DATEDIFF function on that20080702-13:12:07.000Is there a better way of handling this then using the SUBSTRING functionSELECT CONVERT( DATETIME , SUBSTRING('20080703-20:00:00.922' , 1 ,8) + ' ' + SUBSTRING('20080703-20:00:00.922' , 10 ,12) ) Thanks for all the help |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-07-05 : 12:53:50
|
| Hello,I don't know what is better, but this looks smaller:select convert(datetime,replace('20080703-20:00:00.922','-',' '))Greetings WebfredThere are 10 types of people in the world: Those who understand binary, and those who don't... |
 |
|
|
avmreddy17
Posting Yak Master
180 Posts |
Posted - 2008-07-06 : 12:06:55
|
| WebfredI guess yours is more clean and short.Thanks |
 |
|
|
|
|
|