SQL Server - Month Function - left pad single digit months

Asked By Scott on 05-Feb-08 12:36 AM
Month(now()) returns 1 in January.  How do I left pad that 1 such that
it will return 01 for all single digit months?

Thanks.




Norman Yuan replied on 29-Jan-08 03:13 PM
If you need an expression in report design, try this:

=IIF(Month(Now())<10,"0" & Month(Now()),"" & Month(Now()))

Or, even simple:

=Right("0" & Month(Now()),2)