DateTimeFormatInfo 成员

定义如何根据区域性设置 DateTime 值的格式并显示这些值。

下表列出了由 DateTimeFormatInfo 类型公开的成员。

公共构造函数

  名称 说明
Public method Supported by the .NET Compact Framework DateTimeFormatInfo 初始化不依赖于区域性的(固定的)DateTimeFormatInfo 类的新可写实例。

页首

公共属性

  名称 说明
Public property Supported by the .NET Compact Framework AbbreviatedDayNames 获取或设置类型 String 的一维数组,它包含周中各天的特定于区域性的缩写名称。
Public property Supported by the .NET Compact Framework AbbreviatedMonthGenitiveNames 获取或设置与当前 DateTimeFormatInfo 对象关联的月份缩写名称的字符串数组。
Public property Supported by the .NET Compact Framework AbbreviatedMonthNames 获取或设置类型 String 的一维数组,它包含各月的特定于区域性的缩写名称。
Public property Supported by the .NET Compact Framework AMDesignator 获取或设置表示处于“上午”(中午前)的各小时的字符串指示项。
Public property Supported by the .NET Compact Framework Calendar 获取或设置用于当前区域性的日历。
Public property Supported by the .NET Compact Framework CalendarWeekRule 获取或设置一个值,该值指定使用哪一规则确定该年的第一个日历周。
Public property Static Supported by the .NET Compact Framework CurrentInfo 获取基于当前区域性对值进行格式设置的只读 DateTimeFormatInfo
Public property Supported by the .NET Compact Framework DateSeparator 获取或设置分隔日期中各组成部分的字符串;即,年、月、日。
Public property Supported by the .NET Compact Framework DayNames 获取或设置类型 String 的一维数组,它包含周中各天的特定于区域性的完整名称。
Public property Supported by the .NET Compact Framework FirstDayOfWeek 获取或设置该周的第一天。
Public property Supported by the .NET Compact Framework FullDateTimePattern 获取或设置长日期和长时间值的格式模式,该模式与“F”格式字符关联。
Public property Static Supported by the .NET Compact Framework InvariantInfo 获取不依赖于区域性的(固定的)默认只读 DateTimeFormatInfo
Public property Supported by the .NET Compact Framework IsReadOnly 获取一个值,该值指示 DateTimeFormatInfo 是否为只读。
Public property Supported by the .NET Compact Framework LongDatePattern 获取或设置长日期值的格式模式,该模式与“D”格式字符关联。
Public property Supported by the .NET Compact Framework LongTimePattern 获取或设置长时间值的格式模式,该模式与“T”格式字符关联。
Public property Supported by the .NET Compact Framework MonthDayPattern 获取或设置月份和日期值的格式模式,该模式与“m”和“M”格式字符关联。
Public property Supported by the .NET Compact Framework MonthGenitiveNames 获取或设置与当前 DateTimeFormatInfo 对象关联的月份名称的字符串数组。
Public property Supported by the .NET Compact Framework MonthNames 获取或设置类型 String 的一维数组,该数组包含月份的特定于区域性的完整名称。
Public property NativeCalendarName 获取与当前 DateTimeFormatInfo 对象关联的本地日历名称。
Public property Supported by the .NET Compact Framework PMDesignator 获取或设置表示处于“下午”(中午后)的各小时的字符串指示项。
Public property Supported by the .NET Compact Framework RFC1123Pattern 获取时间值的格式模式,该格式模式基于 Internet 工程任务组 (IETF) 注释要求 (RFC) 1123 规范并且与“r”和“R”格式字符关联。
Public property Supported by the .NET Compact Framework ShortDatePattern 获取或设置短日期值的格式模式,该格式模式与“d”格式字符关联。
Public property Supported by the .NET Compact Framework ShortestDayNames 获取或设置与当前 DateTimeFormatInfo 对象关联的最短唯一日期缩写名称的字符串数组。
Public property Supported by the .NET Compact Framework ShortTimePattern 获取或设置短时间值的格式模式,该格式模式与“t”格式字符关联。
Public property Supported by the .NET Compact Framework SortableDateTimePattern 获取可排序的日期和时间值的格式模式,该格式模式与“s”格式字符关联。
Public property Supported by the .NET Compact Framework TimeSeparator 获取或设置分隔时间组成部分的字符串;即,小时、分钟和秒钟。
Public property Supported by the .NET Compact Framework UniversalSortableDateTimePattern 获取通用可排序的日期和时间值的格式模式,该格式模式与“u”格式字符关联。
Public property Supported by the .NET Compact Framework YearMonthPattern 获取或设置年份和月份值的格式模式,该格式模式与“y”和“Y”格式字符关联。

页首

公共方法

  名称 说明
Public method Supported by the .NET Compact Framework Clone 创建 DateTimeFormatInfo 的浅表副本。
Public method Supported by the .NET Compact Framework Equals  已重载。 确定两个 Object 实例是否相等。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework GetAbbreviatedDayName 基于与当前 DateTimeFormatInfo 对象关联的区域性,返回周中指定天的特定于区域性的缩写名称。
Public method Supported by the .NET Compact Framework GetAbbreviatedEraName 返回包含指定纪元的缩写名称的字符串(如果缩写名称存在)。
Public method Supported by the .NET Compact Framework GetAbbreviatedMonthName 基于与当前 DateTimeFormatInfo 对象关联的区域性,返回指定月份的特定于区域性的缩写名称。
Public method Supported by the .NET Compact Framework GetAllDateTimePatterns 已重载。 返回可用于对 DateTime 值进行格式设置的标准模式。
Public method Supported by the .NET Compact Framework GetDayName 基于与当前 DateTimeFormatInfo 对象关联的区域性,返回周中指定天的特定于区域性的完整名称。
Public method Supported by the .NET Compact Framework GetEra 返回表示指定纪元的整数。
Public method Supported by the .NET Compact Framework GetEraName 返回包含指定纪元名称的字符串。
Public method Supported by the .NET Compact Framework GetFormat 返回指定类型的对象,它提供 DateTime 格式化服务。
Public method Supported by the .NET Compact Framework GetHashCode  用作特定类型的哈希函数。GetHashCode 适合在哈希算法和数据结构(如哈希表)中使用。 (从 Object 继承。)
Public method Static Supported by the .NET Compact Framework GetInstance 返回与指定 IFormatProvider 关联的 DateTimeFormatInfo
Public method Supported by the .NET Compact Framework GetMonthName 基于与当前 DateTimeFormatInfo 对象关联的区域性,返回指定月中特定于区域性的完整名称。
Public method GetShortestDayName 获取与当前 DateTimeFormatInfo 对象关联的周中指定天的最短日期名缩写。
Public method Supported by the .NET Compact Framework GetType  获取当前实例的 Type。 (从 Object 继承。)
Public method Static Supported by the .NET Compact Framework ReadOnly 返回只读的 DateTimeFormatInfo 包装。
Public method Static Supported by the .NET Compact Framework ReferenceEquals  确定指定的 Object 实例是否是相同的实例。 (从 Object 继承。)
Public method SetAllDateTimePatterns 设置可对 DateTime 值进行格式设置的所有标准模式。
Public method Supported by the .NET Compact Framework ToString  返回表示当前 ObjectString。 (从 Object 继承。)

页首

请参见

参考

DateTimeFormatInfo 类
System.Globalization 命名空间
DateTime
Calendar 类
CultureInfo 类

其他资源

格式化类型
格式化概述
标准 DateTime 格式字符串
自定义 DateTime 格式字符串