Name

DateTimeFormatInfo

Synopsis

This class defines how DateTime values are formatted for a culture. Several standard patterns are defined with the default property values. These standard patterns are designated by a format character. The format character provides a shortcut to specify the format of a DateTime with the ToString( ) method. You can create custom formats using a set of format pattern characters. These characters represent different styles of day and time representations and allow you to build customized pattern strings. To create custom patterns, first you need to construct a writable instance of DateTimeFormatInfo by using its constructor. Use InvariantInfo to fetch a culture-independent, read-only instance of this class.

public sealed class DateTimeFormatInfo : ICloneable, IFormatProvider {
// Public Constructors
   public DateTimeFormatInfo( );
// Public Static Properties
   public static DateTimeFormatInfo CurrentInfo{get; }
   public static DateTimeFormatInfo InvariantInfo{get; }
// Public Instance Properties
   public string[ ] AbbreviatedDayNames{set; get; }
   public string[ ] AbbreviatedMonthNames{set; get; }
   public string AMDesignator{set; get; }
   public Calendar Calendar{set; get; }
   public CalendarWeekRule CalendarWeekRule{set; get; }
   public string DateSeparator{set; get; }
   public string[ ] DayNames{set; get; }
   public DayOfWeek FirstDayOfWeek{set; get; }
   public string FullDateTimePattern{set; get; }
   public bool IsReadOnly{get; }
   public string LongDatePattern{set; get; } ...

Get C# in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.