I have 2 questions.
1. Tell me, I want to make a program where the statusbar will display how much is left until November 18th. Ie something like this:

До дня рождения осталось : 18 дней 12:10:5 

What code will be approximately used? Only not just a date, but a date + time.

12 - hours 10 - minutes 5 - seconds.

  1. How can you make the music itself start playing when you start the program?
  • The answer to both questions can be found in Google - why ask them here, then? 1: DateTime a = DateTime.Now (); a.Days; // something like that -> dig in this direction 2: Program.cs -> Main (string [] args) // -> right here to launch music, how to launch - google :) - Eitery

1 answer 1

Now there is no compiler at hand, I can not check, but something like this:

  DateTime finishDate = new DateTime(2011, 11, 18, 12, 0, 0); TimeSpan left = finishDate.Subtract(DateTime.Now); double daysLeft = left.TotalDays; Console.WriteLine("**До дня рождения осталось : " + daysLeft.ToString("0")); 

And you can even easier:

 Console.WriteLine("**До дня рождения осталось : {0:dd\\.hh\\:mm\\:ss}", left); 
  • Thank you very much! Everything worked out. - Angus123
  • Eeee the days turned out, but the hours, minutes, seconds are not displayed (( - Angus123
  • one
    And if you think!? left.TotalHours; left.TotalMinutes; left.TotalSeconds; left.TotalMilliseconds; - invincible