2
Answers

NP90 DateTime

Ask a question
Maha

Maha

16y
1.9k
1

Hi Guys

 

NP90 DateTime

 

In this program due to time lag 2nd output must have different time but it is producing the same as 1st one. I don’t why, anyone knows please explain the reason.

 

Thank you

 

namespace DateTime

{

   using System;

 

   public class DateTimeNow

   {

      static public void Main()

      {

         object x;

 

         x = DateTime.Now;

 

         Console.WriteLine("{0}", x);

 

         // Inject a time lag to get unique times.

         System.Threading.Thread.Sleep(2000);

 

         Console.WriteLine("{0}", x);

      }

   }

}

/*

3/25/2008 4:11:17 PM

3/25/2008 4:11:17 PM

*/

 


Answers (2)