Question
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?
Answer
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:
using System;
using System.Globalization;
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");
Comments
0 comments
Please sign in to leave a comment.