Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Format() to return another language

Status
Not open for further replies.

Chucklez

Programmer
Jul 25, 2002
104
US
I have the following code:
Code:
strCutOffDate = UCase(Format(strCutOffDate, "dddd mmm dd, yyyy"))

And I need to retrieve the date format in English AND Spanish. Is there a 'SetEnvironment' command or something similar that I cant find that I could use, or do I need to actually go thru and make several case statements to replace the English verbage into Spanish?

Monday = Lunes
Tuesday = Martes
...
January = Enero
February = Febrero

etc. etc.
 
Chucklez,
Here's a start. thread707-959539?

The [tt]Locale[/tt] for Spanish (Spain, Modern Sort) is 3082.


CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
How are ya Chucklez . . .

Perhaps the following will do. Copy/paste the following to a module in the modules window:
Code:
[blue]Public Function FmtDate(usrDate, Eng As Boolean) As String
   [green]'Eng: True = English
   '     False = Spanish[/green]
   Dim Pack As String, Dte As Date

   Dte = CDate(usrDate)
   
   If Eng Then [green]'English[/green]
      Pack = UCase(Format(Dte, "dddd mmm dd, yyyy"))
   Else [green]'Spanish[/green]
      Pack = Choose(Weekday(Dte), "domingo", "lunes", _
                                  "martes", "miércoles", _
                                  "jueves", "viernes", _
                                  "sábado") & " " & _
             Choose(Month(Dte), "enero", "febrero", _
                                "marzo", "abril", _
                                "mayo", "junio", _
                                "julio", "agosto", _
                                "septiembre", "octubre", _
                                "noviembre", "diciembre") & " " & _
             Format(Day(Dte), "00") & ", " & _
             Year(Dte)
   End If

   FmtDate = UCase(Pack)
   
End Function[/blue]
Your call to the function becomes:
Code:
[blue]strCutOffDate = FmtDate(strCutOffDate, False)[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top