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 |
|
nto
Starting Member
12 Posts |
Posted - 2009-07-28 : 21:14:49
|
| Hi All,just quick question i want to do select field with specific date time format (YY-MM-DD) and also want to rename the field at the same time.is that possible in sql?This is my codeSELECT InstallationDT AS 'Installation Date'WHERE Maintenancehow do i output the installation date with different date format time?Thanks for your time |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-28 : 22:20:28
|
the formatting should be performed at you client side where the date is being displayed not in SQL.If you must, you can use convert() to convert the date to string and specify the format.SELECT convert(varchar(10), InstallationDT, 121) AS 'Installation Date' Do note that result data type is a string not a datetime anymore KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
nto
Starting Member
12 Posts |
Posted - 2009-07-29 : 01:41:59
|
| Thanks that work!!!! |
 |
|
|
|
|
|