So I wanted to make a random timestamp generator in c# which had to be a string.
I came up with a random generator made out of loads of random.next
's
but when the day month hour or minute is under 10 it has to have a zero in front, or the string length
won't reach the length I need it to be which is like this:
1111/11/11 11:11
without spaces and slashes so it'll be like this:
111111111111
but if the minute is like 9 then it'll be like this
11111111119
which is not long enough!
here is my code now
decimal cijfer;
string tijd;
string jaar;
string maand;
string dag;
string uur;
string minuten;
Random random = new Random();
cijfer = random.Next(64, 94);
jaar = random.Next(1943, 2020).ToString();
maand = random.Next(0, 13).ToString();
dag = random.Next(0, 29).ToString();
uur = random.Next(0, 23).ToString();
minuten = random.Next(0, 61).ToString();
maand.PadLeft(2, '0');
dag.PadLeft(2, '0');
uur.PadLeft(2, '0');
minuten.PadLeft(2, '0');
tijd = jaar + maand + dag + uur + minuten;
Console.WriteLine(tijd);
Console.ReadLine();
which does not work and I do not understand why.