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 |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2010-03-09 : 16:24:08
|
| How to convert datetime to string?For example, 2010-03-09 16:22:27.980 become 03092010162227 |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2010-03-09 : 16:31:43
|
Declare @DT datetimeset @DT ='2010-03-09 16:22:27.980'select replace(Convert(varchar(30),@DT,110),'-','') + replace(Convert(varchar(30),@DT,108),':','') Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2010-03-09 : 16:50:57
|
| It works fine. Thank you! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-10 : 01:24:16
|
quote: Originally posted by Sun Foster How to convert datetime to string?For example, 2010-03-09 16:22:27.980 become 03092010162227
If you want to show formatted dates in front end application, do formation thereMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|