title: Using timer in .Net Core for some scheduled task?
body: <p>I have created a timer in startup.cs file like this:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
  //here i am reading value from appsettings.json
  var timeForScheTask = Configuration.GetSection("TimeForScheduledTask");
  var time = timeForScheTask.GetValue&lt;string&gt;("TimeToRun"); //it returns 09:00:00 PM
  
          AutoResetEvent autoEvent = null;
          autoEvent = new AutoResetEvent(false);
          tm = new Timer(Execute, autoEvent, 10000, 10000);
  }
  </code></pre>
  
  <p>Below is the Execute method of timer:</p>
  
  <pre><code>public void Execute(System.Object stateInfo)
      {
          if (_counter &lt; 10)
          {
              //Console.WriteLine("Call #" + _counter);
              _counter++;
              return;
          }
  
          //Console.WriteLine("Final call");
          tm.Dispose();
      }
  </code></pre>
  
  <p>I just want to run some script/query everyday at 12:00:00 night, I just want to know what to right in this line of code, </p>
  
  <pre><code>        tm = new Timer(Execute, autoEvent, 1000, 1000);
  </code></pre>
  
  <p>instead of 1000,1000</p>
  
  <p>Generally I don't use .net/ timer to run any scheduled task,  but this time i am just experimenting with this and that too .net core, in which microsoft has changed the timer thing a bit.</p>
  
  <p>Thanks in advance.</p>