General C# programming - DateTime Flashcards
1
Q
How do you access the current Date and Time.
A
DateTime.Now
to print this out to the console or ui screen you must use
DateTime.Now.ToString
2
Q
How do you print out just the current date.
A
DateTime.Now.ToShortDateString();
3
Q
How do you print out just the current time?
A
DateTime.Now.ToShortTimeString();
4
Q
How would you make 08/03/2015 print out as Monday, 03 2015?
A
DateTime.Now.ToLongDateString();
5
Q
How would you print out just the time along with the seconds?
A
DateTime.Now.ToLongTimeString();
6
Q
How would you add days to the Date and Time?
A
DateTime.Now.AddDays(3);
3 = amound of days
7
Q
How would you add hours to the current Date and Time?
A
DateTime.Now.AddHours(3)
3 = amount of hours.