Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query:convert unseparated string to datetime & DATEADD
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 04/16/2002 :  10:04:28  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
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.


Used SQL Salesman

992 Posts

Posted - 04/16/2002 :  15:11:44  Show Profile  Reply with Quote
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.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000