# Hijri Calendar

i have a form with a 2 date controle boxs, the user suppose to fill the first field with Gregorian Calendar date
and then i need to brows the Equivalent Hijri Calendar date beside it in the other date controle box.
how can i get the Equivalent Hijri Calendar date? pls.
MS Access "VBA" code.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MIS LiasonCommented:
M_SOLAIMAN,

I could not find a algorythm to convert Gregorian dates to Hijri date.

All I could get was "Year" conversion:
hijri year = [(Gregorian Year  622) x 33] ÷ 32

Seems that there is more to converting the dates than simply adding or subtracting dates.

Sure, there are lots of sites that will do the calculation for you, but none of them "Expose" the formula behind thoes conversions.

This site claims it has the formula, but it will cost you  \$13.00 USD:

I did find a few functions that claims to do it:
Public Function ChangeCalenderDate(InputDate As Date, ToHijri As Boolean, FormatStr As String) As String
Dim OldCalendar As VbCalendar
OldCalendar = Calendar
Calendar = -ToHijri
ChangeCalenderDate = Format(InputDate, FormatStr)
Calendar = OldCalendar
End Function

Function ConvertDateString(ByRef StringIn As String, ByRef OldCalendar As Integer, ByVal NewCalendar As Integer, ByRef NewFormat As String) As String
Dim SavedCal As Integer
Dim d As Date
Dim s As String
SavedCal = Calendar
Calendar = OldCalendar
If IsDate(StringIn) Then
d = CDate(StringIn)
Calendar = NewCalendar
s = CStr(d)
ConvertDateString = Format(s, NewFormat)
ConvertDateString = s
Else
ConvertDateString = ""
End If
Calendar = SavedCal
End Function

But I did not have the patience to figure out how to get them to work.

Perhaps if someone else is more persistient...?

JeffCoachman
0
application programmerAuthor Commented:
sorry
i should have to tell u that the arabic windows have the Gregorian dates Calendar  and  Hijri date Calendar Equivalent .
so all i need is how to obtain it from the windows it self.
sorry again for not clear question.
0
MIS LiasonCommented:
M_SOLAIMAN,

OK, I got it to work.

It was very interesting doing research on this.

Here is a sample:
https://filedb.experts-exchange.com/incoming/ee-stuff/6791-Access--EEQ23150468GregorianToH.zip

JeffCoachman
0
application programmerAuthor Commented:
Hi JeffCoachman
several times i try to open this link but i could not!
0
MIS LiasonCommented:
M_SOLAIMAN,

What happens when you click on the link?
0
application programmerAuthor Commented:
i recive login page
You must login to access the file you requested

0
MIS LiasonCommented:
M_SOLAIMAN,

Ok so what was the problem?

JeffCoachman
0
application programmerAuthor Commented:
thanks alot
i can login now
i'll try it in sha'allah
0
application programmerAuthor Commented:
i do try it
it's very nice program
but is there any code to use the windows calender
becouse we have in the enable windows(arabic windows) ' we have Hijri and Gregorian calenders
0
MIS LiasonCommented:
M_SOLAIMAN,

What do you mean by "use the windows calender".

Your question stated that you had two textboxes, and you wanted to enter the Gregorian date in one, and have the Hijri date show up in the other.

This is what I have done.

Can you explain?

JeffCoachman
0
application programmerAuthor Commented:
Hi JeffCoachman
may this link can clear what ineed!
http://www.microsoft.com/middleeast/msdn/ArabicCalendar.aspx#_Introduction
0
MIS LiasonCommented:
M_SOLAIMAN,

All the information you would need to change your calendar is in your own link.

You don't really need me for that.

If you need to use another calendar, you have to change your Regional Options in windows.
(Under control Panel)

So please got to your Windows control panel and see what other language options are available.

Jeffrey Coachman
0
application programmerAuthor Commented:
this an example from the link i mention before
----------------------
Converting from Hijri to Gregorian

1- Using Datetime.ToString:

The following example converts date from Hijri to Gregorian:

[C#]

DateTime dt = new DateTime(1422, 1,1, new HijriCalendar());
Console.WriteLine(dt.Date.ToString());

The output is:

1/9/2003 or 1/9/2003 (according to your current culture settings)
-----------------------------------
so
is there any sutch VBA function i can use to convert Hijri date to Gregorian or vis versa
like the example above "HijriCalendar()"
sorry for bothering u
0
MIS LiasonCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

application programmerAuthor Commented:
wonderful
0
application programmerAuthor Commented:
thanks very mutch for Patience on me up to end
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.