Home  |  Delphi .net Home  |  System.Globalization.DateTimeFormatInfo  |  GetAbbreviatedMonthName Method
GetAbbreviatedMonthName  
Method  
Gets the abbreviated name for a Month of the Year
DateTimeFormatInfo Class
System.Globalization NameSpace
CF1.  Function GetAbbreviatedMonthName ( Month : Integer; ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
Converts the Month number (1..12) into the appropriate abbreviated month string.
Microsoft MSDN Links
System.Globalization
System.Globalization.DateTimeFormatInfo
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Globalization;

var
  britishCulture : System.Globalization.CultureInfo;
  frenchCulture  : System.Globalization.CultureInfo;

  month          : Integer;
  dateTimeFormat : System.Globalization.DateTimeFormatInfo;

begin
  // Set up British and French cultures and calendars
  britishCulture := CultureInfo.Create('en-GB');
  frenchCulture  := CultureInfo.Create('fr-FR');

  // Display the British calendar months
  dateTimeFormat := britishCulture.DateTimeFormat;

  for month := 1 to 12 do
    Console.WriteLine('British Month {0,2} = {1}',
              month.ToString,
              dateTimeFormat.GetAbbreviatedMonthName(month));

  // Display the French calendar months
  Console.WriteLine;
  dateTimeFormat := frenchCulture.DateTimeFormat;

  for month := 1 to 12 do
    Console.WriteLine('French Month {0,2} = {1}',
              month.ToString,
              dateTimeFormat.GetAbbreviatedMonthName(month));

  Console.ReadLine;
end.
Show full unit code
  British Month  1 = Jan
  British Month  2 = Feb
  British Month  3 = Mar
  British Month  4 = Apr
  British Month  5 = May
  British Month  6 = Jun
  British Month  7 = Jul
  British Month  8 = Aug
  British Month  9 = Sep
  British Month 10 = Oct
  British Month 11 = Nov
  British Month 12 = Dec
  
  French Month  1 = janv.
  French Month  2 = f?vr.
  French Month  3 = mars
  French Month  4 = avr.
  French Month  5 = mai
  French Month  6 = juin
  French Month  7 = juil.
  French Month  8 = ao?t
  French Month  9 = sept.
  French Month 10 = oct.
  French Month 11 = nov.
  French Month 12 = d?c.
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author