I have the following code:
string textTransDate = String.Format("{0}-{1}-{2} {3}:{4}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute);
I want to add leading zeroes to the month and day parameters if they are less than 10, how would I accomplish this?
string textTransDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
More info here:
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
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