Need to convert integer to month name (English and French) in VB.Net
Posted on 2012-12-30
I need to convert a month integer into a month name, for both French and English, in VB.Net.
I would prefer to use some type of included Globalization parameters (such as CultureInfo.CreateSpecificCulture("fr-FR")) to do the conversion, rather than doing a "select case" and just listing all the month names in every language - since I may add a 3rd language soon to my site and want to keep my code clean.
For instance to format dates, I am currently using:
FrenchDate = mydatetime.ToString("dddd, 'le ' d MMMM yyyy, ' à ' h'h'mm", CultureInfo.CreateSpecificCulture("fr-FR"))
... but I cannot seem to find an equivalent I can use for an integer.
My integers are not preceeded by zeros (ie: they are 1,2,3,4,5,6,7,8,9,10,11,12) and I would like the full month name (ie: January or Janvier)