Re: How to get a two-digit month value -
06-10-2008
, 02:31 PM
Try:
select
replace (str (datepart (mm, getdate ()), 2), ' ', '0')
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Danny" <Danny (AT) discussions (DOT) microsoft.com> wrote
Howdy.
I'm attempting to use DATEPART to give me a two-digit month, and further, to
cast that as a nvarchar. It is rendering March as '3' instead of '03'.
Is there a way to get '03' here????
Thanks.
Danny |