Monday, March 5, 2007

Two Digit Month and Date

You may need this when exporting data to a character based file format, etc.

SELECT
RIGHT('00' + RTRIM(MONTH(GETDATE())), 2) AS DataMonth
, RIGHT('00' + RTRIM(day(GETDATE())), 2) AS DataDate

2 comments:

Anonymous said...

Amiable post and this post helped me alot in my college assignement. Thanks you for your information.

Anonymous said...

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.