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 |
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-01-16 : 18:29:41
|
| hey all,i have a string that i want to convert to a datethe string is like somystring = 17.03.2003 16:38SELECT convert(varchar(128),mystring,104)now i know i can use this method but the problem isi cant find a datetime format that will suit my string input104 does dd.mm.yybut i want the time included as wellany ideas on how i can get this one to work? i am guessing the use of DATEADD but not sure to how creat a empty date so i can use this function |
|
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-01-16 : 18:31:13
|
| if there is no eazy way let me know cause i can always just select substrings from the input string and put together my own date format that can workta |
 |
|
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-01-16 : 18:44:31
|
| just a side noteat the moment i do thisselect SUBSTRING ( '17.03.2003 16:38' , 7 , 4) + '-' + SUBSTRING ( '17.03.2003 16:38' , 4 , 2) + '-' + SUBSTRING ( '17.03.2003 16:38' , 1 , 2) + ' ' + SUBSTRING ( '17.03.2003 16:38' , 12 , 2) + ':' + SUBSTRING ( '17.03.2003 16:38' , 15 , 2) |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-01-16 : 18:45:49
|
Don't ask why, but mine did this...select convert(datetime,'17.03.2003 16:38',104)------------------------------------------------------ 2003-03-17 16:38:00.000 rockmoose |
 |
|
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-01-16 : 18:52:30
|
| thats fine that is just getting the millisecondsI am using this to compaire 2 dates i.e if date in table > inputdate So if the the millseconds are there it wont matter as they will always be 000 so wont effect my code |
 |
|
|
|
|
|
|
|