Search code examples
c#date-formatrtl-language

How to build string that contains RTL(Hebrew) word in the middle?


I've tried to create a string that contains a month in the middle of the date for example:

2020 במרץ 30

This word I want to locate in the middle: 'במרץ'

I know that I can create a label or textbox and located where I want it. but I want to find a solution to this problem.

tried working with StringBuilder but without success

dateBuilder = stringBuilder.AppendFormat("{0} {1} {2}", year, month, day).ToString();

Thanks :)


Solution

  • string monthName = new DateTime(year, month, day).ToString("MMMM", new CultureInfo("he-IL"));
    dateBuilder = stringBuilder.AppendFormat(string.Format("{0} {1} {2}", day, monthName, year)).ToString();
    

    enter image description here