<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5782401343226156989</id><updated>2011-04-21T19:48:10.041-07:00</updated><title type='text'>الگوریتم تبدیل تاریخ میلادی به هجری قمری و بالعکس</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hijritomiladi.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5782401343226156989/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://hijritomiladi.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mostafablogger</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5782401343226156989.post-3171068645556761260</id><published>2008-02-22T21:52:00.000-08:00</published><updated>2008-02-22T21:54:38.029-08:00</updated><title type='text'>الگوریتم تبدیل تاریخ میلادی به هجری قمری و بالعکس</title><content type='html'>&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;typedef&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;unsigned&lt;/span&gt; &lt;span style="color: blue;"&gt;char&lt;/span&gt;&lt;span style=""&gt;       &lt;/span&gt;BYTE;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;typedef&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;struct&lt;/span&gt; tagDATE11 {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;BYTE&lt;span style=""&gt;            &lt;/span&gt;dtDay;&lt;span style=""&gt;      &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;BYTE &lt;span style=""&gt;     &lt;/span&gt;dtMonth;&lt;span style=""&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;unsigned&lt;/span&gt; &lt;span style="color: blue;"&gt;short&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;dtYear;&lt;span style=""&gt;     &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;} DATE1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;void&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; ConvertGregDateToHijri(DATE1 *, DATE1 *);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;void&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; ConvertHijriDateToGreg(DATE1 *, DATE1 *);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Converts a Hijri M to # of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; HM2Days(&lt;span style="color: blue;"&gt;long&lt;/span&gt; m)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; mdays[&lt;span style="color: red;"&gt;13&lt;/span&gt;] = {&lt;span style="color: red;"&gt;0&lt;/span&gt;,&lt;span style="color: red;"&gt;30&lt;/span&gt;,&lt;span style="color: red;"&gt;59&lt;/span&gt;,&lt;span style="color: red;"&gt;89&lt;/span&gt;,&lt;span style="color: red;"&gt;118&lt;/span&gt;,&lt;span style="color: red;"&gt;148&lt;/span&gt;,&lt;span style="color: red;"&gt;177&lt;/span&gt;,&lt;span style="color: red;"&gt;207&lt;/span&gt;,&lt;span style="color: red;"&gt;236&lt;/span&gt;,&lt;span style="color: red;"&gt;266&lt;/span&gt;,&lt;span style="color: red;"&gt;295&lt;/span&gt;,&lt;span style="color: red;"&gt;325&lt;/span&gt;,&lt;span style="color: red;"&gt;355&lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (mdays[m-&lt;span style="color: red;"&gt;1&lt;/span&gt;]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns 1 if Gregorian year is a leap year&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; IsGYLeap(&lt;span style="color: blue;"&gt;long&lt;/span&gt; y)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; ((y%&lt;span style="color: red;"&gt;4&lt;/span&gt; == &lt;span style="color: red;"&gt;0&lt;/span&gt;) &amp;amp;&amp;amp; ((y%&lt;span style="color: red;"&gt;100&lt;/span&gt; &gt; &lt;span style="color: red;"&gt;0&lt;/span&gt;) || (y%&lt;span style="color: red;"&gt;400&lt;/span&gt; == &lt;span style="color: red;"&gt;0&lt;/span&gt;)));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Converts a Gregorian M to # of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; GM2Days(&lt;span style="color: blue;"&gt;long&lt;/span&gt; m)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; mdays[&lt;span style="color: red;"&gt;13&lt;/span&gt;] = {&lt;span style="color: red;"&gt;0&lt;/span&gt;,&lt;span style="color: red;"&gt;31&lt;/span&gt;,&lt;span style="color: red;"&gt;59&lt;/span&gt;,&lt;span style="color: red;"&gt;90&lt;/span&gt;,&lt;span style="color: red;"&gt;120&lt;/span&gt;,&lt;span style="color: red;"&gt;151&lt;/span&gt;,&lt;span style="color: red;"&gt;181&lt;/span&gt;,&lt;span style="color: red;"&gt;212&lt;/span&gt;,&lt;span style="color: red;"&gt;243&lt;/span&gt;,&lt;span style="color: red;"&gt;273&lt;/span&gt;,&lt;span style="color: red;"&gt;304&lt;/span&gt;,&lt;span style="color: red;"&gt;334&lt;/span&gt;,&lt;span style="color: red;"&gt;365&lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; mdays[m-&lt;span style="color: red;"&gt;1&lt;/span&gt;];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns total # of days for a Gregorian year&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; GY2nDays(&lt;span style="color: blue;"&gt;long&lt;/span&gt; y)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;y = y - &lt;span style="color: red;"&gt;1&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (y*&lt;span style="color: red;"&gt;365L&lt;/span&gt; + y/&lt;span style="color: red;"&gt;4&lt;/span&gt; - y/&lt;span style="color: red;"&gt;100&lt;/span&gt; + y/&lt;span style="color: red;"&gt;400&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns 1 if hijri year is a leap year&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; IsHYLeap(&lt;span style="color: blue;"&gt;long&lt;/span&gt; y)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; mdays[&lt;span style="color: red;"&gt;11&lt;/span&gt;]={&lt;span style="color: red;"&gt;2&lt;/span&gt;,&lt;span style="color: red;"&gt;5&lt;/span&gt;,&lt;span style="color: red;"&gt;7&lt;/span&gt;,&lt;span style="color: red;"&gt;10&lt;/span&gt;,&lt;span style="color: red;"&gt;13&lt;/span&gt;,&lt;span style="color: red;"&gt;15&lt;/span&gt;,&lt;span style="color: red;"&gt;18&lt;/span&gt;,&lt;span style="color: red;"&gt;21&lt;/span&gt;,&lt;span style="color: red;"&gt;24&lt;/span&gt;,&lt;span style="color: red;"&gt;26&lt;/span&gt;,&lt;span style="color: red;"&gt;29&lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; i;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;y %= &lt;span style="color: red;"&gt;30&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;for&lt;/span&gt; (i=&lt;span style="color: red;"&gt;0&lt;/span&gt;; i&lt;&lt;span style="color: red;"&gt;11&lt;/span&gt;; i++) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (y == mdays[i])&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: red;"&gt;1&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns total # of days for a Hijri year&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; HY2nDays(&lt;span style="color: blue;"&gt;long&lt;/span&gt; y)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;span style=""&gt;   &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; y30, yleft;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; result;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;y30&lt;span style=""&gt;       &lt;/span&gt;= ((y-&lt;span style="color: red;"&gt;1&lt;/span&gt;) / &lt;span style="color: red;"&gt;30&lt;/span&gt;) * &lt;span style="color: red;"&gt;30&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;yleft&lt;span style=""&gt; &lt;/span&gt;= y - y30 - &lt;span style="color: red;"&gt;1&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;result&lt;span style=""&gt;    &lt;/span&gt;= ((y30 * &lt;span style="color: red;"&gt;10631L&lt;/span&gt;) / &lt;span style="color: red;"&gt;30L&lt;/span&gt;) + &lt;span style="color: red;"&gt;227013L&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;while&lt;/span&gt; (yleft)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;result += &lt;span style="color: red;"&gt;354L&lt;/span&gt; + IsHYLeap(yleft--);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; result;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns Hijri year for a total # of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; nDays2HY(&lt;span style="color: blue;"&gt;long&lt;/span&gt; d)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; hy = (((d - &lt;span style="color: red;"&gt;227013L&lt;/span&gt;) * &lt;span style="color: red;"&gt;30L&lt;/span&gt; / &lt;span style="color: red;"&gt;10631L&lt;/span&gt;) + &lt;span style="color: red;"&gt;1&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (d &lt;= HY2nDays(hy))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;hy--;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (d &gt; HY2nDays(hy+&lt;span style="color: red;"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;hy++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; hy;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns the Hijri month number corresponding to a certain number of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; nDays2HM(&lt;span style="color: blue;"&gt;long&lt;/span&gt; ndays)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; i = &lt;span style="color: red;"&gt;1&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; d = (ndays - HY2nDays(nDays2HY(ndays)));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;while&lt;/span&gt; (d &gt; HM2Days(i))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;i++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (i - &lt;span style="color: red;"&gt;1&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Converts # of days to a Gregorian year&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; nDays2GY(&lt;span style="color: blue;"&gt;long&lt;/span&gt; days)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; d = (days * &lt;span style="color: red;"&gt;400L&lt;/span&gt; / &lt;span style="color: red;"&gt;146097L&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (days &gt; GY2nDays(d+&lt;span style="color: red;"&gt;2&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (d+&lt;span style="color: red;"&gt;2&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (days &gt; GY2nDays(d+&lt;span style="color: red;"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (d+&lt;span style="color: red;"&gt;1&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (d);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns 1 if the number of days corresponds to a leap Gregorian year&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; IsnDaysLeap(&lt;span style="color: blue;"&gt;long&lt;/span&gt; days)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; y = nDays2GY(days);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (IsGYLeap(y) &amp;amp;&amp;amp; (days - GY2nDays(y) &gt; &lt;span style="color: red;"&gt;59&lt;/span&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns the Gregorian month number corresponding to a certain number of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; nDays2GM(&lt;span style="color: blue;"&gt;long&lt;/span&gt; ndays)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; i = &lt;span style="color: red;"&gt;1&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt; d = (ndays - GY2nDays(nDays2GY(ndays)) - IsnDaysLeap(ndays));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;while&lt;/span&gt; (d &gt; GM2Days(i))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;i++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (i - &lt;span style="color: red;"&gt;1&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Returns the Hijri day corresponding to a certain number of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; nDays2HD(&lt;span style="color: blue;"&gt;long&lt;/span&gt; ndays)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (ndays - HY2nDays(nDays2HY(ndays)) - HM2Days(nDays2HM(ndays)));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Converts a hijri M/D/Y to total # of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; HDMY2nDays(&lt;span style="color: blue;"&gt;long&lt;/span&gt; d, &lt;span style="color: blue;"&gt;long&lt;/span&gt; m, &lt;span style="color: blue;"&gt;long&lt;/span&gt; y)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (HY2nDays(y) + HM2Days(m) + d);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Converts a Gregorian M/D/Y to total # of days&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; GDMY2nDays(&lt;span style="color: blue;"&gt;long&lt;/span&gt; d, &lt;span style="color: blue;"&gt;long&lt;/span&gt; m, &lt;span style="color: blue;"&gt;long&lt;/span&gt; y)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;span style=""&gt;   &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; ((IsGYLeap(y) &amp;amp;&amp;amp; (m &gt; &lt;span style="color: red;"&gt;2&lt;/span&gt;)) + GY2nDays(y) + GM2Days(m) + d);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// returns the Gregorian day corresponding to a certain number of &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;static&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; nDays2GD(&lt;span style="color: blue;"&gt;long&lt;/span&gt; ndays)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; (ndays - GDMY2nDays(&lt;span style="color: red;"&gt;1&lt;/span&gt;, nDays2GM(ndays), nDays2GY(ndays)) + &lt;span style="color: red;"&gt;1&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;//Convert Gregorian Date to Hijri Date&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;void&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; ConvertGregDateToHijri(DATE1 *pDGreg, DATE1 *pDHijri)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;lDate;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;ASSERT( pDHijri &amp;amp;&amp;amp; pDGreg );&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;lDate = GDMY2nDays((&lt;span style="color: blue;"&gt;long&lt;/span&gt;)pDGreg-&gt;dtDay, (&lt;span style="color: blue;"&gt;long&lt;/span&gt;)pDGreg-&gt;dtMonth, (&lt;span style="color: blue;"&gt;long&lt;/span&gt;)pDGreg-&gt;dtYear);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;pDHijri-&gt;dtMonth = (BYTE)nDays2HM(lDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;pDHijri-&gt;dtYear&lt;span style=""&gt;  &lt;/span&gt;= (&lt;span style="color: blue;"&gt;unsigned&lt;/span&gt; &lt;span style="color: blue;"&gt;short&lt;/span&gt;)nDays2HY(lDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;pDHijri-&gt;dtDay&lt;span style=""&gt;   &lt;/span&gt;= (BYTE)nDays2HD(lDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;//Convert Hijri Date to Gregorian&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;void&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; ConvertHijriDateToGreg(DATE1 *pDHijri, DATE1 *pDGreg)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style="color: blue;"&gt;long&lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;lDate = &lt;span style="color: red;"&gt;0&lt;/span&gt;, x = &lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;ASSERT( pDHijri &amp;amp;&amp;amp; pDGreg );&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;lDate = HDMY2nDays((&lt;span style="color: blue;"&gt;long&lt;/span&gt;)pDHijri-&gt;dtDay, (&lt;span style="color: blue;"&gt;long&lt;/span&gt;)pDHijri-&gt;dtMonth, (&lt;span style="color: blue;"&gt;long&lt;/span&gt;)pDHijri-&gt;dtYear);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;pDGreg-&gt;dtDay&lt;span style=""&gt;   &lt;/span&gt;= (BYTE)nDays2GD(lDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;pDGreg-&gt;dtMonth&lt;span style=""&gt; &lt;/span&gt;= (BYTE)nDays2GM(lDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;     &lt;/span&gt;pDGreg-&gt;dtYear&lt;span style=""&gt;  &lt;/span&gt;= (&lt;span style="color: blue;"&gt;unsigned&lt;/span&gt; &lt;span style="color: blue;"&gt;short&lt;/span&gt;)nDays2GY(lDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align: right;" class="MsoNormal" dir="rtl"&gt;&lt;span dir="ltr"&gt;&lt;o:p&gt; با تشکر&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: right;" class="MsoNormal" dir="rtl"&gt;&lt;span dir="ltr"&gt;&lt;o:p&gt;هاشمی - زمستان 1386&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5782401343226156989-3171068645556761260?l=hijritomiladi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hijritomiladi.blogspot.com/feeds/3171068645556761260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5782401343226156989&amp;postID=3171068645556761260' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5782401343226156989/posts/default/3171068645556761260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5782401343226156989/posts/default/3171068645556761260'/><link rel='alternate' type='text/html' href='http://hijritomiladi.blogspot.com/2008/02/blog-post.html' title='الگوریتم تبدیل تاریخ میلادی به هجری قمری و بالعکس'/><author><name>Mostafablogger</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
