当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET GregorianCalendarTypes枚举代码示例

本文整理汇总了VB.NET中System.Globalization.GregorianCalendarTypes枚举的典型用法代码示例。如果您正苦于以下问题:VB.NET GregorianCalendarTypes枚举的具体用法?VB.NET GregorianCalendarTypes怎么用?VB.NET GregorianCalendarTypes使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。


在下文中一共展示了GregorianCalendarTypes枚举的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: SamplesCultureInfo

' 导入命名空间
Imports System.Globalization

Public Class SamplesCultureInfo

   Public Shared Sub Main()

      ' Gets the calendars supported by the ar-SA culture.
      Dim myOptCals As Calendar() = New CultureInfo("ar-SA").OptionalCalendars

      ' Checks which ones are GregorianCalendar then determines the GregorianCalendar version.
      Console.WriteLine("The ar-SA culture supports the following calendars:")
      Dim cal As Calendar
      For Each cal In  myOptCals
         If cal.GetType() Is GetType(GregorianCalendar)  Then
            Dim myGreCal As GregorianCalendar = CType(cal, GregorianCalendar)
            Dim calType As GregorianCalendarTypes = myGreCal.CalendarType
            Console.WriteLine("   {0} ({1})", cal, calType)
         Else
            Console.WriteLine("   {0}", cal)
         End If
      Next cal

   End Sub

End Class
开发者ID:VB.NET开发者,项目名称:System.Globalization,代码行数:26,代码来源:GregorianCalendarTypes

输出:

The ar-SA culture supports the following calendars:
System.Globalization.HijriCalendar
System.Globalization.GregorianCalendar (USEnglish)
System.Globalization.GregorianCalendar (MiddleEastFrench)
System.Globalization.GregorianCalendar (Arabic)
System.Globalization.GregorianCalendar (Localized)
System.Globalization.GregorianCalendar (TransliteratedFrench)

示例2: SamplesGregorianCalendar

' 导入命名空间
Imports System.Globalization

Public Class SamplesGregorianCalendar

   Public Shared Sub Main()
      ' Creates and initializes three different CultureInfo.
      Dim myCIdeDE As New CultureInfo("de-DE", False)
      Dim myCIenUS As New CultureInfo("en-US", False)
      Dim myCIfrFR As New CultureInfo("fr-FR", False)
      Dim myCIruRU As New CultureInfo("ru-RU", False)

      ' Creates a Localized GregorianCalendar.
      ' GregorianCalendarTypes.Localized is the default when using the GregorianCalendar constructor without parameters.
      Dim myCal = New GregorianCalendar()

      ' Sets the DateTimeFormatInfo.Calendar property to a Localized GregorianCalendar.
      ' Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR,
      myCIruRU.DateTimeFormat.Calendar = myCal

      ' Creates a DateTime.
      Dim myDT As New DateTime(2002, 1, 3, 13, 30, 45)

      ' Displays the DateTime.
      Console.WriteLine("de-DE: {0}", myDT.ToString("F", myCIdeDE))
      Console.WriteLine("en-US: {0}", myDT.ToString("F", myCIenUS))
      Console.WriteLine("fr-FR: {0}", myDT.ToString("F", myCIfrFR))
      Console.WriteLine("ru-RU: {0}", myDT.ToString("F", myCIruRU))
   End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Globalization,代码行数:30,代码来源:GregorianCalendarTypes

输出:

de-DE: Donnerstag, 3. Januar 2002 13:30:45
en-US: Thursday, January 03, 2002 1:30:45 PM
fr-FR: jeudi 3 janvier 2002 13:30:45
ru-RU: 3 января 2002 г. 13:30:45


注:本文中的System.Globalization.GregorianCalendarTypes枚举示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。