Normal Topic Need Code How To Convert Dates To Spanish (Read 976 times)
josebetzy
Member
*
Offline


Hmmm. How? Cómo?

Posts: 33
Location: Las Piedras, Puerto Rico
Joined: Dec 15th, 2003
Need Code How To Convert Dates To Spanish
Feb 21st, 2004 at 2:59pm
Print Post Print Post  
I wish to thank the Forum for opening up the new section. Without a doubt, it is going to help many of us.

In QA I would enter a date in an element and in another element I would convert that by using the internal lookup table.

Example: in element ADate I would enter the date Feb 21, 2004. Now in element SDate I had logic that would look up the month of ADate (Feb) and in the lookup table it would get febrero, and the remaining logic would get the date number (21) and year (2004) from ADate so that the resulting text would read ... 21 de febrero de 2004.

This allowed me to use two different date types for letters, etc, either English or Spanish.

  

Jose L. Muñoz
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Need Code How To Convert Dates To Spanish
Reply #1 - Feb 21st, 2004 at 4:50pm
Print Post Print Post  
How about this?
Code
Select All
Function GetSpanishMonth(vMonth as Int) As String
var vSNames as Array[12] of String
var vReturn as String

	// Initialize the return value
	vReturn = ""

	// Populate month names
	vSNames[1] = "Enero"
	vSNames[2] = "Febrero"
	vSNames[3] = "Marcha"
	vSNames[4] = "Abril"
	vSNames[5] = "Pueda"
	vSNames[6] = "Junio"
	vSNames[7] = "Julio"
	vSNames[8] = "Agosto"
	vSNames[9] = "Septiembre"
	vSNames[10] = "Octubre"
	vSNames[11] = "Noviembre"
	vSNames[12] = "Diciembre"

	If vMonth >= 1 And vMonth <= 12 Then
	{
		vReturn = vSNames[vMonth]
	}
	return(vReturn)

End Function

WriteLn(GetSpanishMonth(@Month(Date_Entered))) 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged