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
Our community of experts have been thoroughly vetted for their expertise and industry experience.
This award recognizes a member of Experts Exchange who has made outstanding contributions to the community within their first year as an expert. The Rookie of the Year is awarded to a new expert who has the highest number of quality contributions.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.