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 |
|
wotrac
Yak Posting Veteran
98 Posts |
Posted - 2005-11-11 : 17:42:44
|
| How do I go about changing the string value01/12/04 to a datetime, but without the time. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-11-11 : 18:10:26
|
you mean to display it with out the timr part in your front end?formating should be done at the front end.Go with the flow & have fun! Else fight the flow |
 |
|
|
wotrac
Yak Posting Veteran
98 Posts |
Posted - 2005-11-12 : 12:20:14
|
| I am trying to create a view where one of the fieldscontains the date entered as a string. I need to be able to convert it to a date, so that I can compare it against a start date togenerate a week number. |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2005-11-12 : 12:29:17
|
| DON'T STORE DATE VALUES AS STRINGS!WHY does every noob developer insist on doing this, I will never understand.Also, uhmm... '01/12/04' doesn't HAVE a time portion. So just cast or convert it to a datetime value. |
 |
|
|
wotrac
Yak Posting Veteran
98 Posts |
Posted - 2005-11-12 : 13:25:32
|
| Unfortunately I didn't write the application, so I have to work withwhat I've got! |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2005-11-12 : 22:33:54
|
| Well, I'll still try to help you out. But again, '01/12/04' doesn't include a time component, so perhaps you need to explain the issue in more detail. |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-11-12 : 22:38:11
|
| You can't convert it to datetime without a time. Datetime always has a time. If you run a CAST('01/12/05' AS DATETIME) it's going to add in the lowest possible time to the end of the date. That shouldn't be an issue. You just need to deal with this fact in your code. If it does, let us know and we can help you out.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|