Here is an example. I expected 1900/01/02 but got 1900/1/2 instead. If “1” was an int it would work. Why DOESNT this return 2 digits? i understand its a string but isnt the point of :00 to specify the digits? Why is it being ignored?
var date = string.Format("{0:0000}/{1:00}/{2:00}", "1900", "1", "2");
Because strings cannot be formatted like numbers; you can, however, specify a width of the target string (but they get padded with spaces, not
0).