Length of Character
Posted by BobJ on January 04, 2002 5:50 AM
I need to take the result(In VBA) of Day(now()), which would
equal 4 (1/4/02) and turn it into a two character
field (04) , ultimately, I want it to be two characters on MM,
two on DD and 4 on YYYY.
Below is some code I wrote to get around it but I am sure there is a better way.
'Date Checks
MM = Month(Now)
If Len(MM) = 1 Then MM = "0" & MM
DD = Day(Now)
If Len(DD) = 1 Then DD = "0" & DD
YYYY = Year(Now)
'Date Layout
TDay = YYYY & MM & DD
Thanks! Bj