Adding leading zero to single digiits in single digit numbers (1-9)

How can i make DateTime.Today.Month.ToString value to have leading zero on it because if i use this it only shows 9 instead of 09

welcome to the forum

have a look here:

give a try on DateTime.Today.toString("MM")

Use String.PadLeft. More details here:

Assign → monthAsString.PadLeft("2", CChar("0"))

1 Like