Access auto Hijri to Gregorian date conversion

I have a form in access that I use to automatically fill in a variety of word files.

so I have a "joining date" box with a date picker in Gregorian.

I also have a "Hijri joining date", that I want to be automatically populated with the Hijri date that corresponds to the entered Gregorian "joining date".

however I can not for the life of me figure out a code that I can get to work.

please keep in mind that I am a relative beginner to both access/vba and coding in general.

First, you need to understand how Access stores dates. They are stored as a double precision number where the Integer portion is the number of days since 12/31/1899. The decimal portion is a fraction of a day (i.e. 6AM is .25)

This site provides the conversion formula: How Do You Convert A Gregorian Year To Hijri? • Arabic For Nerds (arabic-for-nerds.com)

The formula is: (Year Gregorian– 622) × 1.03

However, you might need to convert the date to a string to display it properly.

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Microsoft Access MVP since 2007

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thank you but not exactly what im looking for. that only shows the year not the exact date

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Sorry, didn't get that. Try this previous answer: https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-convert-gregorian-date-to-hijri-date-in/555dd568-ed5a-48d5-bc6c-db3e1a39f356

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Microsoft Access MVP since 2007

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

no worries I appreciate the effort. I did try that previous answer already with no success.

the website mentioned doesn't seem to be working i only ever get "This site can’t be reached"

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If your dates are stored as DateTime, you can compare them directly, as the numeric value of a date is fixed, only the possible formatted results are different:

VBA.Calendar = vbCalHijri

? Date

1442-12-27

? CDbl(Date)

44413

VBA.Calendar = vbCalGreg

? Date

2021-08-05

? CDbl(Date)

44413

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated November 3, 2021 Views 493 Applies to: