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 method DateTimeFormatInfo();  
// Public Static Properties
   public static field DateTimeFormatInfo CurrentInfo{get; } 
   public static field DateTimeFormatInfo InvariantInfo{get; } 
// Public Instance Properties
   public field string[] AbbreviatedDayNames{set; get; } 
   public field string[] AbbreviatedMonthNames{set; get; } 
   public field string AMDesignator{set; get; } 
   public field Calendar Calendar{set; get; } 
   public field CalendarWeekRule CalendarWeekRule{set; get; } 
   public field string DateSeparator{set; get; } 
   public field string[] DayNames{set; get; } 
   public field DayOfWeek FirstDayOfWeek{set; get; } 
   public field string FullDateTimePattern{set; get; } public ...

Get C# in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.