Domanda

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.

È stato utile?

Soluzione 2

var dateTime = DateTime.Now.Day;

More info is found in the actual documentation from MSDN

Altri suggerimenti

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;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top