DateTimeFormatInfo.AbbreviatedMonthGenitiveNames Property

Gets or sets a string array of abbreviated month names associated with the current DateTimeFormatInfo object.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Property AbbreviatedMonthGenitiveNames As String()

Property Value

Type: System.String ()
A string array of abbreviated month names.

ExceptionCondition
ArgumentException

In a set operation, the array is multidimensional or has a length that is not exactly 13.

ArgumentNullException

In a set operation, the value array or one of the elements of the value array is Nothing.

InvalidOperationException

The DateTimeFormatInfo object is read-only.

In some languages, a month name that is part of a date appears in the genitive case. For example, a date in the Russian (Russia) or "ru-RU" culture consists of the day number and the genitive month name, such as 1 Января (1 January).

In a set operation, the array must be one-dimensional and must have exactly 13 elements, because Calendar objects accommodate calendars with 13 months. For 12-month calendars, the thirteenth element should be String.Empty.

If you set the AbbreviatedMonthGenitiveNames property, you must also set the AbbreviatedMonthNames property.

The following example demonstrates several methods and properties that specify date and time format patterns, native calendar name, and full and abbreviated month and day names.



' This code example demonstrates the DateTimeFormatInfo 
' MonthGenitiveNames, AbbreviatedMonthGenitiveNames, 
' ShortestDayNames, and NativeCalendarName properties, and
' the GetShortestDayName() and SetAllDateTimePatterns() methods.

Imports System.Globalization

Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      Dim name As String = ""

      ' Get the en-US culture.
      Dim ci As New CultureInfo("en-US")
      ' Get the DateTimeFormatInfo for the en-US culture.
      Dim dtfi As DateTimeFormatInfo = ci.DateTimeFormat

      ' Display the effective culture.
      outputBlock.Text &= String.Format("This code example uses the {0} culture.", _
                                        ci.Name) & vbCrLf

      ' Display month genitive names.
      outputBlock.Text &= vbCrLf & "MonthGenitiveNames..." & vbCrLf
      Dim monthNamesDisplay As String = ""
      For Each name In dtfi.MonthGenitiveNames
         If Not String.IsNullOrEmpty(monthNamesDisplay) Then _
            monthNamesDisplay &= ", "
         monthNamesDisplay &= String.Format("'{0}'", name)
      Next 
      outputBlock.Text &= monthNamesDisplay & vbCrLf & vbCrLf

      ' Display abbreviated month genitive names.
      monthNamesDisplay = ""
      outputBlock.Text &= vbCrLf & "AbbreviatedMonthGenitiveNames..." & vbCrLf
      For Each name In dtfi.AbbreviatedMonthGenitiveNames
         If Not String.IsNullOrEmpty(monthNamesDisplay) Then _
            monthNamesDisplay &= ", "
         monthNamesDisplay &= String.Format("'{0}'", name)
      Next 
      outputBlock.Text &= monthNamesDisplay & vbCrLf & vbCrLf

      ' Display shortest day names.
      outputBlock.Text &= vbCrLf & "ShortestDayNames..." & vbCrLf
      Dim dayNamesDisplay As String = ""
      For Each name In dtfi.ShortestDayNames
         If Not String.IsNullOrEmpty(dayNamesDisplay) Then _
            dayNamesDisplay &= ", "
         dayNamesDisplay &= String.Format("'{0}'", name)
      Next 
      outputBlock.Text &= dayNamesDisplay & vbCrLf & vbCrLf
   End Sub 
End Class 
' This code example produces the following results:
' 
' This code example uses the en-US culture.
' 
' MonthGenitiveNames...
' 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ''
' 
' AbbreviatedMonthGenitiveNames...
' 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', ''
' 
' ShortestDayNames...
' 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft