|
-
Feb 9th, 2012, 11:35 AM
#1
Thread Starter
Lively Member
Get month names in French?
Hi -- I know that I can get the month name for a date, e.g.:
Dim myMonth As String = MonthName(Month(myDate))
which gives me January, February, etc.
What I need is to *also* get the month name in French, for a bilingual app I'm working on. Note that the app decides the language to display based on values supplied to the program, not the current locale settings.
Is there a simple, canned way to do this or should I use a lookup array for the month names? Or, something else?
-
Feb 9th, 2012, 11:50 AM
#2
Re: Get month names in French?
Supply the CultureInfo you want to use to the program.
Code:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim englishCultureInfo = New Globalization.CultureInfo("en-US")
Dim frenchCultureInfo = New Globalization.CultureInfo("fr-FR")
Dim d = DateTime.Now
MessageBox.Show(GetMonthName(d, englishCultureInfo))
MessageBox.Show(GetMonthName(d, frenchCultureInfo))
End Sub
Private Function GetMonthName(d As DateTime, ci As Globalization.CultureInfo) As String
Return ci.DateTimeFormat.GetMonthName(d.Month)
End Function
-
Feb 9th, 2012, 12:00 PM
#3
Thread Starter
Lively Member
Re: Get month names in French?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|