pd

Format a number with total number of digits
I used it to format a date as "yyyy-mm-dd"

CodeFunctionName
What is this?

Public

Tested

Imported
Function pd(n, totalDigits)
if totalDigits > len(n) then
pd = String(totalDigits-len(n),"0") & n
else
pd = n
end if
End Function

' Example
' BBlogDate = pd(Year(BBlogDate),4) & "-" & pd(Month(BBlogDate),2) & "-" & pd(Day(BBlogDate),2)

n, totalDigits

BBlogDate = pd(Year(BBlogDate),4) & "-" & pd(Month(BBlogDate),2) & "-" & pd(Day(BBlogDate),2)

Views 2,861

Downloads 1,081

CodeID
DB ID