Gets or sets a DateTimeFormatInfo that defines the culturally appropriate format of displaying dates and times. : DateTimeFormatInfo « Date Time « C# / C Sharp






Gets or sets a DateTimeFormatInfo that defines the culturally appropriate format of displaying dates and times.

  
using System;
using System.Globalization;
public class SamplesCultureInfo  {
   public static void Main()  {
      CultureInfo myCI = new CultureInfo("en-US", false);
      CultureInfo myCIclone = (CultureInfo) myCI.Clone();
      myCIclone.DateTimeFormat.AMDesignator = "a.m.";
      myCIclone.DateTimeFormat.DateSeparator = "-";
      myCIclone.NumberFormat.CurrencySymbol = "USD";
      myCIclone.NumberFormat.NumberDecimalDigits = 4;

      Console.WriteLine( "{0} {1}", myCI.DateTimeFormat.AMDesignator, myCIclone.DateTimeFormat.AMDesignator );
      Console.WriteLine( "{0} {1}", myCI.DateTimeFormat.DateSeparator, myCIclone.DateTimeFormat.DateSeparator );
      Console.WriteLine( "{0} {1}", myCI.NumberFormat.CurrencySymbol, myCIclone.NumberFormat.CurrencySymbol );
      Console.WriteLine( "{0} {1}", myCI.NumberFormat.NumberDecimalDigits, myCIclone.NumberFormat.NumberDecimalDigits );

   }

}

   
    
  








Related examples in the same category

1.CultureInfo Provides information about a specific culture
2.Determines the specific cultures that use the Chinese language, and displays the parent culture
3.Gets the list of calendars that can be used by the culture.
4.Custom Date and Time Format Strings
5.DateTimeFormatInfo Class
6.DateTimeFormatInfo.AbbreviatedMonthGenitiveNames
7.DateTimeFormatInfo.FullDateTimePattern
8.ALL the patterns
9.DateTimeFormatInfo.LongDatePattern
10.DateTimeFormatInfo.LongTimePattern
11.DateTimeFormatInfo.MonthDayPattern
12.DateTimeFormatInfo.RFC1123Pattern
13.DateTimeFormatInfo.ShortDatePattern
14.DateTimeFormatInfo.ShortTimePattern
15.DateTimeFormatInfo.SortableDateTimePattern
16.DateTimeFormatInfo.UniversalSortableDateTimePattern
17.DateTimeFormatInfo.YearMonthPattern
18.To Short Date Time
19.To Date Time from dmtf date