Description:we have a multilingual website in which we have event start date and end date which is correctly displayed for English language version of the page but when we go to its Arabic version of the page, it basically convert the date to Hijri calendar date.
Currently we are using following code in which we are just getting the dates from database and format it as shown
string startDate= sourceEvent?.Fields.EventStart.ToString("dd.MM.yy");
string endDate= sourceEvent?.Fields.EventEnd.ToString("dd.MM.yy");
Posted by: Umer khan | Posted on: May 30, 2022
3
First of all you need to use the CultureInfo.InvariantCulture which make sure that you will have same date with both English and Arabic.
Secondly you need create the following method to convert the English digits to Arabic digits in case we have Arabic culture
So your final code will look like the following one, where you can call the ConvertNumerals method.
Replied by: Emerging Expert | Replied on: Jun 01, 2022