Write a C# Sharp program to display the number of ticks that have elapsed since the beginning of the twenty-first century and to instantiate a TimeSpan object using the Ticks property

  • برمجة سي شارب
  • برمجة

 Write a C# Sharp program to display the number of ticks that have elapsed since the beginning of the twenty-first century and to instantiate a TimeSpan object using the Ticks property.

Note: The TimeSpan object is then used to display the elapsed time using several other time intervals.

Expected Output :

English (Jamaica):                                                      
   Local date and time: 20/08/2016 15:54:07, Local                      
   UTC date and time: 20/08/2016 10:24:07, Utc                          
                                                                        
English (New Zealand):                                                  
   Local date and time: 20/08/2016 3:54:07 PM, Local                    
   UTC date and time: 20/08/2016 10:24:07 AM, Utc                       
                                                                        
suomi (Suomi):                                                          
   Local date and time: 20.8.2016 15:54:07, Local                       
   UTC date and time: 20.8.2016 10:24:07, Utc                           
                                                                        
Deutsch (Schweiz):                                                      
   Local date and time: 20.08.2016 15:54:07, Local                      
   UTC date and time: 20.08.2016 10:24:07, Utc                          
                                                                        
Nederlands (Nederland):                                                 
   Local date and time: 20-8-2016 15:54:07, Local                       
   UTC date and time: 20-8-2016 10:24:07, Utc

الأجوبة

using System;
using System.Globalization;
public class Example6
{
   public static void Main()
   {
      DateTime localDate = DateTime.Now;
      DateTime utcDate = DateTime.UtcNow;
      String[] cultureNames = { "en-JM", "en-NZ", "fr-BE",
                                "de-CH", "nl-NL" } ;
      foreach (var cultureName in cultureNames) {
         var culture = new CultureInfo(cultureName);
         Console.WriteLine("{0}:", culture.NativeName);
         Console.WriteLine("   Local date and time: {0}, {1:G}",
                           localDate.ToString(culture), localDate.Kind);
         Console.WriteLine("   UTC date and time: {0}, {1:G}\n",
                           utcDate.ToString(culture), utcDate.Kind);
      }
   }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...