Q:

Write a C# Sharp program which shows that when a time that falls within this range is converted to a long integer value and is then restored and the original value is adjusted to become a valid time

0

Write a C# Sharp program which shows that when a time that falls within this range is converted to a long integer value and is then restored and the original value is adjusted to become a valid time.

Expected Output :

Invalid Time: False

3/14/2016 2:30:00 AM -> 3/14/2016 2:30:00 AM

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
public class Example22
{
   public static void Main()
   {
      DateTime date1 = new DateTime(2016, 3, 14, 2, 30, 00);
      Console.WriteLine("Invalid Time: {0}", 
                        TimeZoneInfo.Local.IsInvalidTime(date1));
      long ft = date1.ToFileTime();
      DateTime date2 = DateTime.FromFileTime(ft);
      Console.WriteLine("{0} -> {1}", date1, date2); 
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now