Author |
Topic |
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-08-10 : 23:07:47
|
I'm trying to format date.Now i use : select convert(varchar(10),dcol,103)but i want to get format of dd-MMM-yyy(12-Aug-2008)how can i do it? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-10 : 23:11:42
|
Do you have Books Online installed ? If not, download and installed it.Search th Books Online for CAST and CONVERT and check the style that matched your requirement. KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-10 : 23:13:39
|
or see here if you don't have BOL http://msdn.microsoft.com/en-us/library/aa226054(SQL.80).aspx KH[spoiler]Time is always against us[/spoiler] |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-08-10 : 23:28:58
|
I tried already.But i can't find any format of 10-Aug-2008I can only get 10 Aug 200 or 10-08-2008 or others.quote: Originally posted by khtan or see here if you don't have BOL http://msdn.microsoft.com/en-us/library/aa226054(SQL.80).aspx KH[spoiler]Time is always against us[/spoiler]
|
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-10 : 23:29:44
|
[code]select replace(convert(varchar(20), getdate(), 106), ' ', '-')[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-10 : 23:31:31
|
the date can be easily format at your front end application. You should do it there instead of at SQL. KH[spoiler]Time is always against us[/spoiler] |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-08-10 : 23:38:32
|
I see that i can easily format at front end like .tostring("dd-MMM-yyyy") but i can't format that column coz of some conditions.Thank u khtan. quote: Originally posted by khtan
select replace(convert(varchar(20), getdate(), 106), ' ', '-') KH[spoiler]Time is always against us[/spoiler]
|
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-11 : 03:32:10
|
quote: Originally posted by kwikwisi I see that i can easily format at front end like .tostring("dd-MMM-yyyy") but i can't format that column coz of some conditions.Thank u khtan. quote: Originally posted by khtan
select replace(convert(varchar(20), getdate(), 106), ' ', '-') KH[spoiler]Time is always against us[/spoiler]
What are the conditions that stop you from doing formation at front end?MadhivananFailing to plan is Planning to fail |
 |
|
|