March 19, 2013 at 4:34 pm
Hi,
Need help on get month number from Date field, I am getting month number as 1 for Jan, 2 for Feb
But I need 01 for Jan, 02 for Feb..like this
Can you please some one help me out
Thanks
Grace
March 19, 2013 at 4:37 pm
try this and see if it helps:
select right('0' + cast(month(getdate()) as varchar),2)
March 20, 2013 at 12:25 am
Or maybe a little "silent truncation" (one of my favorite tools) is in order.
SELECT CONVERT(CHAR(2),GETDATE(),1)
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy