Question

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.

Était-ce utile?

La solution 2

var dateTime = DateTime.Now.Day;

More info is found in the actual documentation from MSDN

Autres conseils

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

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;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top