How can I find the day of the year, year, month and day for now in C#? [duplicate]

System.DateTime moment = new System.DateTime.Now;

int year = moment.Year;
int month = moment.Month;
int day = moment.Day;
int hour = moment.Hour;
int minute = moment.Minute;
int second = moment.Second;
int millisecond = moment.Millisecond;

Have a look here: MSDN Documentation – DateTime

Browse More Popular Posts

Leave a Comment