I'm using C# in a ASP.NET web application
In my C# code i have this line where I save today's date into a variable.
Todays date is 11/6/2017
With this code below. The value that gets saved in my variable looks like this: 11/6/2017 8:18:23 AM
// save todays date in a variable
DateTime testvar1 = DateTime.Now;
How do I format DateTime.Now so it save all the digits for the month and day.
I want the value saved in the variable to be this:
11/06/2017 8:18:23 AM
If today's date was 9/5/2017 the value saved in the variable would be this:
Basically add the zeros for single digit months and days.
09/05/2017 8:18:23 AM