title: Losing a day when converting a Gregorian date to Um al Qura
body: <p>I am having an issue when getting the day, month and year components of a C# DateTime object using the Um al Qura calendar.</p>
  
  <p>The snippet of code is:</p>
  
  <pre><code>DateTime date = new DateTime(2013, 6, 24);
  UmAlQuraCalendar umAlQuraCalendar = new UmAlQuraCalendar();
  int year = umAlQuraCalendar.GetYear(date);
  int month = umAlQuraCalendar.GetMonth(date);
  int day = umAlQuraCalendar.GetDayOfMonth(date);
  </code></pre>
  
  <p>After running this, year is 1434 and month is 8, which are both correct. However, day is 14 which is wrong (according to here: <a href="http://www.al-habib.info/islamic-calendar/islamic-calendar-ummulqura-2013.htm" rel="noreferrer">http://www.al-habib.info/islamic-calendar/islamic-calendar-ummulqura-2013.htm</a>)</p>
  
  <p>If I change the code to:</p>
  
  <pre><code>DateTime date = new DateTime(2013, 6, 24, 0, 0, 0, 1); // i.e. One millisecond after midnight
  UmAlQuraCalendar umAlQuraCalendar = new UmAlQuraCalendar();
  int year = umAlQuraCalendar.GetYear(date);
  int month = umAlQuraCalendar.GetMonth(date);
  int day = umAlQuraCalendar.GetDayOfMonth(date); 
  </code></pre>
  
  <p>Then day is 15, which is correct.</p>
  
  <p>To make matters weirder, this code is in the depths of a large application: the C# code is called from a VB6 exe.</p>
  
  <p>If I extract the first snippet above to a standalone C# project (.NET 2.0), then day is 15, which is correct.</p>
  
  <p>I've checked everything I can think of that might be different between the two projects: .NET version, Platform target (x86), but can't see anything obvious.</p>
  
  <p>Any thoughts greatly appreciated.</p>