i written a code in vb for finding the last month. but i didn't get the output which i am expecting. here is my code:
a=Format$(Now, "mm")-1
but i want output in 2 digit like if last month is Jan then output should be 01 not only 1
please help me out.
Use the DateAdd function. More specifically:
date d = DateAdd("m", -1, Now)
a = Format(d, "mm")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With