To MVP And Access Eng..

1

1

Thank you for your help and answer:
Is There any Way to Convert Gregorian date To Hijri Date…
Thank you for your help and answer!
 
A

Albert D. Kallal

The ability of Hijri date is built into windows.

You can do nothing, and just change your regional settings, and all dates
will display as Hijri. This will mean that you also must ENTER all dates as
Hijri also.

You need to actually display a given date as Hijri, and NOT change your
regional settings you can use a function like:

Function strHijri(dtWestDate As Date) As String

' returns a date in Hijri format for a given western date

VBA.Calendar = vbCalHijri

strHijri = Date

VBA.Calendar = vbCalGreg

End Function

Thus, msgbox strHijri(date()) for today will return:

06/12/1424
 
A

Albert D. Kallal

Just put the follwing code in the after update of the text box
txtGregorianbox


me!txtHijri = strHijri(me!txtGregorian)

So, the above will be placed in the form.

You also have to paste my sample code function into a standard code module


That code is:

Public Function strHijri(dtWestDate As Date) As String

' returns a date in Hijri format for a given western date

VBA.Calendar = vbCalHijri

strHijri = dtWestDate

VBA.Calendar = vbCalGreg

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top