Note that there are some explanatory texts on larger screens.

plurals
  1. POLosing a day when converting a Gregorian date to Um al Qura
    primarykey
    data
    text
    <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="nofollow">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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload