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 |
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-07-24 : 02:29:58
|
| hai, i want the datetime format to be yyyy-mm-dd hh:mi:ss. how can i get this. if i declare as small date time i get only yyyy-mm-dd hh:mii tried some convert function also, but im not sure y didnt i get the expected result. help me pls...While retrieving the date i need this format.. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-07-24 : 02:32:30
|
use convert(varchar(30), dte, 121) KH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-07-24 : 03:29:49
|
You should use your front end application or reporting tools to perform the formatting instead of doing it in T-SQL.Also refer to Books Online on more information on convert() KH |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-24 : 06:06:30
|
quote: use convert(varchar(30), dte, 121)
A minor correction/enhancement...select convert(varchar(30 19), dte, 121) But, as khtan mentions, the front-end is the place to do formatting... Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-07-24 : 06:24:59
|
"A minor correction/enhancement..."Thanks Ryan. Was lazy to count the required number of chars.  KH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-24 : 11:10:02
|
| Why dont you use DateTime datatype?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|