I'm building an app which needs to function depending on the current day. I've googled but returned with no results. Is there any function in C# that will return the current day depending on system time? Any help would be appreciated.
Asked
Active
Viewed 2,732 times
3 Answers
5
Have you tried DateTime.Now.Day? Sorry but I can´t comment yet.
@edit
For more information about the DateTime class, take a look at this link: http://msdn.microsoft.com/en-us/library/system.datetime.aspx

Marciano.Andrade
- 307
- 7
- 19
-
I would suggest you edit your post to include more helpful information. Take this link for example: http://msdn.microsoft.com/en-us/library/system.datetime.aspx – gunr2171 Sep 05 '13 at 17:04
2
var dateTime = DateTime.Now.Day;
More info is found in the actual documentation from MSDN

123 456 789 0
- 10,565
- 4
- 43
- 72
1
This is what I use to display the date as: MM/DD/YYYY
string fullDate;
string date = DateTime.Today.Day.ToString();
string month = DateTime.Today.Month.ToString();
string year = DateTime.Today.Year.ToString();
fullDate = month + "/" + date + "/" + year;

Justin Adkins
- 1,214
- 2
- 23
- 41
-
Rather than concatenate 3 strings and have to allocate memory for each one, and rather than write 4 lines of code, and rather than declaring 4 string variables, how about DateTime.Now.ToString("MM/dd/yyyy")? – Bill Gregg Sep 05 '13 at 17:12
-
@BillGregg I had not idea you could do that. lol I'll look into it tonight. :) Thanks – Justin Adkins Sep 05 '13 at 17:28