The following code shows how to format date in MS SQL 1.MM/dd/yyyy
select convert(nvarchar(10),getdate(),101)
2.yyyy.MM.DD
select convert(nvarchar(10),getdate(),102)
3.dd/MM/yyyy
select convert(nvarchar(10),getdate(),103)
You can get the dates in other formats by changing the parameter i.e 101,102,103.The other parameters are 104,105,106,107.
|
| Author: Kapil Dhawan 17 Jun 2008 | Member Level: Gold Points : 2 |
Hello Nice piece of code Thanks for sharing your knowledge with us. I hope to see more good code from your side
This code will help lots of Guys
Regards, Kapil
|