Write a program, which prints, on the console which day of the week is today
1. //DayOfWeek now = DateTime.Today.DayOfWeek;
//Console.WriteLine(now);
2. DateTime today = DateTime.Today;
string date=today.DayOfWeek;
Console.WriteLine(today);
Questions are :
A) With the first code i am getting the value....but with the second i am not getting. I want to know how we can do from 2nd one...
B) Also we have DATETIME and DAYOFWEEK. which one should we use while using IDE?
C) Also i get confused should we use brackets at the end or not ? in what cases should we use brackets .
For example if i give DayOfWeek now = DateTime.Today.DayOfWeek(); it gives me error.
But if i give DayOfWeek now = DateTime.Today.DayOfWeek; it works. What is the concept here? Pls suggest
Hiten PandyaRank #1,237 · 1.4K reputationPosted Mar 8, 2018, 5:33 PM EST
Debasis SahaRank #21 · 46.5K reputationPosted Mar 8, 2018, 5:35 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts