Date transformation

Good evening,
I want to display a reference period starting from the last 10 days up to the survey date using long date formats.
To do this, I created a variable “start” that represents the start of the reference period with the following expression:
date.Value.AddDays(-10).ToString(“dddd MMMM dd yyyy” )

When I call this variable in my questions, it displays correctly in English. The equation I want to solve is to display this date in French. For example, I want to display " lundi 14 avril 2025" in the question instead of “Monday, April 14, 2025”.
Thanks in advance.

The dev team probably has the right answer here. But I think that two things are probably true. First, Survey Solutions will use the locale of your device to determine the date display format. For example, if you’re testing in the browser, you can change the language/locale of the browser and see what happens. Second–dev team can probably point in the right direction–there might be functions to in C# to impose a locale. That’s outside of my area of experience/knowledge.

Hello @STEPHY ,

see: https://designer.mysurvey.solutions/q/details/04b421596f0443e88cd99ec0538d89ff/

Nice example!

To what extent could C#'s culture formatting functions be used here? See this SO post, for example.

This is a nice question that I see on a somewhat regular basis, and I’ve never had time to dig into it adequately.

Thank you all for your contributions.
@sergiy, I tried to replicate the steps in the questionnaire example you shared, and it worked perfectly.
To display the months as strings, I had to use a similar approach to the one used to display the days as strings, as described for the “tomorrowStrEsp” variable in the example you shared.
However, I had to order the months starting with December.
Thank you so much.

This doesn’t look right to me.

By placing Sunday in the beginning of the list, I match the numbering used for DayOfWeek Enum as described in its documentation, specifically code for Sunday is 0 (zero).

The code for December, however, is not zero (from DateTime.Month), but 12. Correspondingly, simply rearranging the months will not be correct.

You can test the questionnaire for dates in each month and see where it is failing. There is an easy fix, of course to subtract 1 or introduce a fake month.

Dear @sergiy,
Thank you very much. I reorganized by classifying the months from January to December and subtracting 1 as you suggested, and it works.
I’ll come back if there are any limitations in this regard.
Thank you for your great help.

Sincerely,