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 |
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2009-05-28 : 07:41:42
|
Hi,I want to display the date in the format of 01 June.From the below query , the date is displayed as 1 June.SELECT CAST(DAY(GETDATE()+4) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()+4) AS [DD Month]Kindly help me. Thanks in advance |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-28 : 07:44:52
|
[code]SELECT CONVERT(CHAR(2), GETDATE(), 106) + ' ' + DATENAME(MONTH, GETDATE()) AS [DD Month][/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2009-05-28 : 07:48:52
|
quote: Originally posted by Peso
SELECT CONVERT(CHAR(2), GETDATE(), 106) + ' ' + DATENAME(MONTH, GETDATE()) AS [DD Month] E 12°55'05.63"N 56°04'39.26"
Thanks a lot for ur reply :)ur looking smart |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-28 : 08:08:14
|
I have to admit I got help from Books Online.Thank you. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-05-28 : 08:27:16
|
quote: Originally posted by shanmugaraj Hi,I want to display the date in the format of 01 June.From the below query , the date is displayed as 1 June.SELECT CAST(DAY(GETDATE()+4) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()+4) AS [DD Month]Kindly help me. Thanks in advance
But note that if you want to show dates in front end application, you should use format function thereMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|