[thelist] Quick and Dirty Numerical Padding w/ASP....

Anthony Baratta Anthony at Baratta.com
Mon Aug 12 18:40:01 CDT 2002


<tip author="Anthony Baratta" subject="Padding Numbers with leading Zeros
in ASP">

I used to run numbers I wanted to pad through a function that checked to
see if the number was less than 9 or 99, and padded with leading zeros
accordingly. The other day I stumbled across a more simple and straight
forward way. (Believe it or not it was at the Microsoft MSDN site.)

_Padding with a Leading Zero the Day and Month_

strDay = Right("00" & CStr(Day(Now())),2)
strMonth = Right("00" & CStr(Month(Now())),2)

If you want two leading zeros for hundreds just change the 2 to a 3.

Piece of pie.

</tip>
--
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list