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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query:convert unseparated string to datetime & DATEADD

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-16 : 10:04:28
hurun ain writes "how can i make a query that...:

1)my field contains unseparated date string : "20020401105545Z "
2)I want to change the time zone of the date string from GMT to CST.... (-6.00) DATEADD...
3)I want to present it in a nice datetime format:
"Sat May 04 02:56:04 2002" or any format that contains date and time.

TQ...."

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-04-16 : 15:11:44
use substring() to separate the pieces of the date out of the string, concatenate them together into a date format sql server will recognize (such as yyyy-mm-dd ) and CAST the string to a datetime.

setBasedIsTheTruepath
<O>
Go to Top of Page
   

- Advertisement -