Home  |  Delphi .net Home  |  System.Globalization.DateTimeFormatInfo  |  GetMonthName Method
  
GetMonthName  
Method  
Gets the full name for a Month of the Year
DateTimeFormatInfo Class
System.Globalization NameSpace
CF1.  Function GetMonthName ( Month : Integer ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
Converts the Month number (1..12) into the appropriate full month string.
Microsoft MSDN Links
System.Globalization
System.Globalization.DateTimeFormatInfo
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
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.GetMonthName(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.GetMonthName(month));

  Console.ReadLine;
end.
   British Month  1 = January
   British Month  2 = February
   British Month  3 = March
   British Month  4 = April
   British Month  5 = May
   British Month  6 = June
   British Month  7 = July
   British Month  8 = August
   British Month  9 = September
   British Month 10 = October
   British Month 11 = November
   British Month 12 = December
  
   French Month  1 = janvier
   French Month  2 = f?vrier
   French Month  3 = mars
   French Month  4 = avril
   French Month  5 = mai
   French Month  6 = juin
   French Month  7 = juillet
   French Month  8 = ao?t
   French Month  9 = septembre
   French Month 10 = octobre
   French Month 11 = novembre
   French Month 12 = d?cembre
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author