+ 2
Hi guys,can you help with the task.In language C#
The kth second of the year ic comming .It is necessary to determine how many full months and full weeks left until the end of the year.
6 Answers
+ 2
// Define two dates.
DateTime date1 = new DateTime(2020, 1, 1, 8, 0, 15);
DateTime date2 = new DateTime(2021, 1, 1, 0, 0, 0);
// Calculate the interval between the two dates.
TimeSpan interval = date2 - date1;
Console.WriteLine("{0} - {1} = {2}", date2, date1, interval.ToString());
// Display individual properties of the resulting TimeSpan object.
Console.WriteLine(" {0,-35} {1,20}", "Value of Days Component:", interval.Days);
Console.WriteLine(" {0,-35} {1,20}", "Total Number of Days:", interval.TotalDays);
Console.WriteLine(" {0,-35} {1,20}", "Value of Hours Component:", interval.Hours);
Console.WriteLine(" {0,-35} {1,20}", "Total Number of Hours:", interval.TotalHours);
Console.WriteLine(" {0,-35} {1,20}", "Value of Minutes Component:", interval.Minutes);
Console.WriteLine(" {0,-35} {1,20}", "Total Number of Minutes:", interval.TotalMinutes);
Console.WriteLine(" {0,-35} {1,20:N0}", "Value of Seconds Component:", interval.Seconds);
Console.WriteLine(" {0,-35} {1,20:N0}", "Total Number of
+ 1
1. Convert seconds to days (k/(60*60*24))
2. Convert days to weeks...
+ 1
Good luck
+ 1
thank you🤗
0
Me neither 😓😓😅😅
0
Ya
Convert seconds to days
Let you have x seconds
Then
It means x/60*60*24 = y days
Then 365/366-y = z days are left in end of year
And z/7 weaks are left.