• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3741
  • Last Modified:

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.
0
Mohammad Alsolaiman
Asked:
Mohammad Alsolaiman
  • 9
  • 7
1 Solution
 
Jeffrey CoachmanMIS LiasonCommented:
M_SOLAIMAN,

I google and googled.

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:
http://links.jstor.org/sici?sici=0041-977X(1992)55%3A2%3C328%3AHACPTC%3E2.0.CO%3B2-N

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
 
Mohammad Alsolaimanapplication 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
 
Jeffrey CoachmanMIS 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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Mohammad Alsolaimanapplication programmerAuthor Commented:
Hi JeffCoachman
several times i try to open this link but i could not!
0
 
Jeffrey CoachmanMIS LiasonCommented:
M_SOLAIMAN,

What happens when you click on the link?
0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
i recive login page
You must login to access the file you requested
Signin using your Experts-Exchange username and password. These account details are not stored permanently. Your account username is stored in your session data for ease of use so that you can tell who you are logged in as. Your password is not stored. Once your username/password combination has been verified, your password is purged from memory.

login.JPG
0
 
Jeffrey CoachmanMIS LiasonCommented:
M_SOLAIMAN,

Ok so what was the problem?

When you type in your username and password, then click "Login" what happens?

JeffCoachman
0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
thanks alot
i can login now
i do download the file
i'll try it in sha'allah
0
 
Mohammad Alsolaimanapplication 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
 
Jeffrey CoachmanMIS 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
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
Hi JeffCoachman
may this link can clear what ineed!
http://www.microsoft.com/middleeast/msdn/ArabicCalendar.aspx#_Introduction
0
 
Jeffrey CoachmanMIS 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
 
Mohammad Alsolaimanapplication 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
 
Jeffrey CoachmanMIS LiasonCommented:
0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
wonderful
0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
thanks very mutch for Patience on me up to end
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now