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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you print out just the current date.

A

DateTime.Now.ToShortDateString();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you print out just the current time?

A

DateTime.Now.ToShortTimeString();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How would you make 08/03/2015 print out as Monday, 03 2015?

A

DateTime.Now.ToLongDateString();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How would you print out just the time along with the seconds?

A

DateTime.Now.ToLongTimeString();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How would you add days to the Date and Time?

A

DateTime.Now.AddDays(3);

3 = amound of days

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How would you add hours to the current Date and Time?

A

DateTime.Now.AddHours(3)

3 = amount of hours.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly