How to convert a date string in the Hijri calendar (1385-09-01) into a standard date format. The Hijri calendar is a lunar calendar used in Islamic cultures, and its dates are different from the Gregorian calendar.
Try this
New DateTime(
New System.Globalization.HijriCalendar().ToDateTime(
Convert.ToInt32(Input.Split("-"c)(0)),
Convert.ToInt32(Input.Split("-"c)(1)),
Convert.ToInt32(Input.Split("-"c)(2)),
0, 0, 0, 0
).Ticks
).ToString("yyyy-MM-dd")
Regards,
1 Like
Had you checked out the following?
Have we understood correctly that you want convert a Hiijri Date 1385-09-01 (YMD) into its mapping gregorian calendar date?
The given date 1385-09-01 is in string format, but I want to convert it into the Hijri date format.
Try this
New DateTime(
Convert.ToInt32(Input.Split("-"c)(0)), ' Hijri Year
Convert.ToInt32(Input.Split("-"c)(1)), ' Hijri Month
Convert.ToInt32(Input.Split("-"c)(2)), ' Hijri Day
New System.Globalization.HijriCalendar()
).ToString("yyyy-MM-dd")
hijriFormatted = (New DateTime((New PersianCalendar()).ToDateTime(1385, 9, 1, 0, 0, 0, 0).Ticks, New HijriCalendar())).ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

