Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Date

Status
Not open for further replies.
Dec 11, 2009
60
US
I am trying to get a format of mmddyyyy with this formula:

Convert(VarChar(2), month(startdate)) + CONVERT(VarChar(2),Day(startdate)) + Convert(VarChar(4), year(startdate)) as startdate

However it comes out mddyyyy when the month is a single digit, how can I accomplish a 2digit month at all times?

Thanks!!
 
Replace(Convert(varchar(10), startdate, 101), '/','')

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top