|
-
Apr 25th, 2005, 04:50 AM
#1
Thread Starter
Hyperactive Member
sql, turn string into date
I have a string of a date in my sql server database:
'wed feb 16 2005'
How (in sql) do i turn it into a date formatted like this:
2005-02-16 00:00:00.000
-
Apr 25th, 2005, 05:59 AM
#2
Fanatic Member
Re: sql, turn string into date
Assuming your string is always in the same format, you could try out something like this:
Code:
Select Convert(smalldatetime, SubString(field, Charindex(' ', field, 0) + 1, Len(field)), 101)
Chris
Master Of My Domain
Got A Question? Look Here First
-
Apr 25th, 2005, 06:46 AM
#3
Thread Starter
Hyperactive Member
Re: sql, turn string into date [resolved]
ended up using something similar
Code:
convert(smalldatetime, substring(@datestring,4,len(@datestring) -3))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|