Wrong date in converting Gregorian to Hijri Calendar

  • Thread starter Thread starter James063
  • Start date Start date
J

James063

Guest
Hi All,

I am trying to convert Gregorian calendar date value to Hijri one.

The test date is 10th May, 2013. The result is "01/07/1434" not "30/06/1434". I am confused...

My test code is:

private static void Test(){
DateTime dt;
System.Globalization.DateTimeFormatInfo HijriDTFI;
try{
dt = Convert.ToDateTime("5/10/2013");
HijriDTFI = new System.Globalization.CultureInfo("ar-EG", false).DateTimeFormat;
HijriDTFI.Calendar = new System.Globalization.HijriCalendar();
HijriDTFI.ShortDatePattern = "dd/MM/yyyy";
MessageBox.Show(dt.Date.ToString("f", HijriDTFI));
} catch (Exception e){
MessageBox.Show(e.ToString());
}
}

Is it a defect in Microsoft??


Regards,

James


James

Continue reading...
 
Back
Top