A
Andrew Wilhite
Hello,
I am just learning C# and I have ran into a problem that I cannot seem
to resolve. I need to capture today's date, subtract a day, and then
put it into the MM-DD-YYYY format. I know how to do one or the
other, but i cannot figure out how to do both. Here is my code
snippet:
DateTime Date1 = System.DateTime.Now.AddDays(-1);
string Day = System.Convert.ToString(Date1.Day);
string Month = System.Convert.ToString(Date1.Month);
string Year = System.Convert.ToString(Date1.Year);
string Logs = "log" +Year+Month+Day+"*.xml";
I need the string logs to be yesterdays date and have leading zero on
the month.
Any help would be appreciated!
I am just learning C# and I have ran into a problem that I cannot seem
to resolve. I need to capture today's date, subtract a day, and then
put it into the MM-DD-YYYY format. I know how to do one or the
other, but i cannot figure out how to do both. Here is my code
snippet:
DateTime Date1 = System.DateTime.Now.AddDays(-1);
string Day = System.Convert.ToString(Date1.Day);
string Month = System.Convert.ToString(Date1.Month);
string Year = System.Convert.ToString(Date1.Year);
string Logs = "log" +Year+Month+Day+"*.xml";
I need the string logs to be yesterdays date and have leading zero on
the month.
Any help would be appreciated!