Return the date in spanish

Hello Survey Solutions team

I have a variable of type string named NameDay with this syntax:

Question1.Value.AddDays(2).Date.ToString("dddd dd MMMM yyyy")

If Question1 is today (Wednesday 7 August 2019) my variable NameDay return Friday 09 August 2019 but I would like that the value returned was in Spanish like this Viernes 09 Agosto 2019

How I can do it?

The dev team, or other advanced C# users, would need to come in on the syntax. But I think the key is in applying Spanish CultureInfo (as in this SO article). When the “culture” of the tablet switches, many things in the UI change too (e.g., using “.” instead of “,” for thousands). Not clear whether this also switches what month and day strings are displayed. To switch tablet culture, change tablet’s language via Android’s settings.

Thanks for your help Arthur.

Can I make this change through syntax?

I see two potential tracks here–neither of which I’ve tested.

Track one: see if the string changes when the Android’s language changes. This could be tested and implemented without any code. Not sure whether it works.

Track two: have Spanish-language strings displayed via code. The dev team, or more advanced C# users, would need to weigh in on what the code needs to be. This is an area where I’ve not worked.

1 Like

@kv700032, please see the example in public questionnaire:
“Public example User questions and common patterns” section “Day of week (Spanish)”

1 Like

Thank you very much Arthur and Sergiy for your prompt help.

And thanks for giving me more ideas and options on how to do this.