We have dates in Hijri format on documents, i.e. 1442-11-29. How can we convert the date from Hijri to Gregorian date automatically?
There are no built-in options to automatically convert the dates from one calendar to another. However, it is possible to do that with the autocorrection script.
- Go to the date field properties > Data tab > AutoCorrect options > Edit... > Enable Use script check box > Edit...
- Below is a very simple sample script that requires to be adjusted according to specific requirements:
CultureInfo arCI = new CultureInfo("ar-SA");
string hijriDate = Value.Text;
DateTime convDate = DateTime.ParseExact(hijriDate, "yyyy-MM-dd", arCI.DateTimeFormat, DateTimeStyles.AllowInnerWhite);
Value.Text = convDate.ToString("dd/MM/yyyy");