I've just finished the new version of the Hebrew Dates code.
All thanks to Moishy at Access World Forums for some really useful feedback on the original.
The new version can be downloaded for free via:
Here's a description of the functionality
clsHebrewDate Class PROPERTIES .HDay Read/Write (long) stores the value of the current Hebrew day When set, the Gregorian Date will automatically be updated. .HMonth Read/Write (long) stores the value of the current Hebrew month When set, the Gregorian Date will automatically be updated. .HYear Read/Write (long) stores the value of the current Hebrew year When set, the Gregorian Date will automatically be updated. .HDaysInMonth Read Only (integer) returns the number of days in current Hebrew month. .GDate Read/Write (date) stores the value of the current Gregorian Date When set, the Hebrew Date will automatically be updated. .GAfterSunset Read/Write (boolean) used to mark the Gregorian date as occuring after sunset. NB: Gregorian days start at midnight but Hebrew days start after sunset TRUE = After sunset FALSE = Before sunset When set, the Hebrew Date will automatically be updated. .IsHLeapyear Read Only (boolean) Returns TRUE if the current Hebrew Year is a Hebrew leapyear NB: Hebrew leap years include a whole extra month (Adar II) and occur in a pattern that follows a 19 year cycle (see below) .IsValid Read Only (boolean) Returns TRUE if the current Hebrew Date is valid METHODS .Copy() Function returns clsHebrewDate type Creates and returns a new copy of the current instance of the clsHebrewDate class. .SetHebrewDate() Sets the Hebrew date and automatically updates the Gregorian date. .YahrzeitStep( [, ]) Alters the current Hebrew Date moving it forward or backward x years according to the value of YearStep in accordance with the selected algorithm selected by CalcStyle. NB: You should always calculate additional Yahrzeit dates from the orginal date of the aneversary. DO NOT be tempted to calc a Yahrzeit from a previous Yahrzeit! This will lead to errors! YearStep: integer value can be positive or negative CalcStyle: (OPTIONAL) 1: Traditional (DEFAULT) 2: Reform 3: CatchAll Module modHebrewDate Function's GetHebrewMonthsList(bLeapYear As Boolean) As Variant returns a list of month numbers and their names delimited with semicolons this is particularly useful for generating combobox dropdown lists NB: Hebrew leap years have a extra month, hence the need for bLeapYear to specify if the list should generate months for a leap year FormatHDate(myDate As clsHebrewDate, myFormat As Variant) As Variant Format hebrew date and output as a variant string. Variant string is needed so unicode letters can be used i.e. for Hebrew text the format parameters are based on the ones uses in PHP. See http://php.net/manual/en/function.date.php Format codes: Misc \ escape character Day d Date, 2 digits with leading zeros (00..30) f Textual representation of date as stored in the language table (HDate01..HDate30) j Date as number without leading zeros (1..30) l NB: this is a lowercase letter L Textual representation of the day of the week as stored in the language table (HDay1..HDay7) S English ordinal suffix for the day of the month, 2 characters (st, nd, rd, th) w returns 1..7 where 1=Sunday (Yom Rishon) Month F Textual representation of a month as stored in the language table (HMonth01..05, HMonth07..13, HMonth06Leap, HMonth07Leap) m Numeric representation of a month, with leading zeros (01..13) n Numeric representation of a month, without leading zeros (1..13) t Number of days in the given month (29..30) Year L Whether it's a leap year (1=yes 0=no) Y A full numeric representation of a year, all digits (eg 5758) y A two digit representation of a year (eg 58) Time a Textual representation of time of day in the Gregorian Date part as stored in Language Table (GTimeNight, GTimeDay) Sub's SetHebrewDateFromGUI(ByRef MyHebrewDate As clsHebrewDate) Shows a hebrew date picker dialog box and returns any selected date back to the carable passed to MyHebrewDate NB: if you prefer the dialog box to display in Right to Left mode and have days that change according to the hebrew rather than the gregorian calendar (i.e. at sunset rather than midnight) edit the dlgHebDatePick13/14 form and set Const CDisplayRTL = True
9 comments:
Hello Is it possible to Hebrew Date field displays the date in Hebrew letters example כב אדר תשעב
And the number is what appears now Sunday the 7th of Adar 5773 table translated into Hebrew and is still displayed numbers and letters.
Thank you very much .
The version above uses the Internationalisation module I wrote a whie back( http://www.access-programmers.co.uk/forums/showthread.php?t=221467 ) to do just this.
You just need to edit the data translation table in the example database.
There is one caveat however - the year.
Writing the year using Hebrew letters is possible. The basic calculation is relatively easy (see: http://en.wikipedia.org/wiki/Hebrew_numerals). However, some years will actually form words that shouldn't be written (see: http://en.wikipedia.org/wiki/Hebrew_numerals#Key_exceptions).
Writing the code for this is a little more complicated. you'll need to check for inappropriate words and generate alternatives that are not themselves inappropriate.
This has not been done yet.
All the best
Marc
it's seems like a excellet code but
It does not work for me and I get error messages like "invalid use of null"
Hi Marc,
Thanks so much for this. I was looking for something to convert Hebrew dates for a database I was building and this works great. Then since I can change the way it stores the date, I can even make it easy to compare (I did it by saving the dates as numerical yyyymmdd and then comparing which is larger, but I can see how to do it a couple other ways as well).
I wanted to reach out to you about the licensing. The database I've designed allows our minyan to plan our torah readings and services well in advance. I'd like to make it more widely available than just my Minyan, but wanted to check with you before I did so due to the licensing.
Thanks,
Michael
Hi Michael,
Thanks for the feedback! I'm glad you found the code useful.
Feel free to use the code in your projects - that's what its there for.
The general copyright for the code and anything else on this site can be found here:
http://marcozin.blogspot.co.uk/p/copyright.html
In basic terms it says you can use the code both commercially and non-commercially without charge as long as you provide a link back to this site in return.
If this doesn't suit your requirements we can discuss other arrangements (I'm open to any suggestions you my have).
Lastly, (if you're happy to) I'd love to see what you have created!
Kind regards
Marc
Hi Marc,
I was delighted to find this post and hope that I may be able to use your code to replace the Calendar Maven Active-X control that is at the heart of our Synagogue database system at Menorah.
Our database is an Access 2003 application. The Calendar Maven control is obsolete 16-bit code and will not run on modern 64-bit operating systems. Hence the need for a replacement!
Unsurprisingly your sample database will not open in Access 2003! I should be grateful for your advice as to my best upgrade path at this stage. Should I purchase Access 2013 (the current version)? Noting that your code was written for Access 2010, I just want to be sure that it will run on Access 2013 - and of course I shall also need to run or convert my old 2003 application. Or would it be better to find a copy of Access 2010?
All the best-
Robert S.
Hi Robert,
Lovely to hear from you.
I haven't looked at that code in a while but it should work equally as well in 2010 & 2013.
In fact the Class Module code should work in 2003 as well, you'd just need to tweak the calendar dialogue form.
Can I ask what specific functions you are after to use in your Shul DB? Is it just a Hebrew date picker or do you need other calculations as well?
Also, please feel free to let me know if you notice any bugs or have any suggestions for improving it.
Speak to you soon
Marc
PS MRJ have my contact details if you want to email me.
Hi Marc,
Many thanks - sorry to be slow in replying - I thought I would get an email notification but didn't - have only just seen your added comment!
Our shul DB uses hebrew date conversion mainly for calculating yahrzeits. Also for "earliest bar/bat mitzvah dates".
I have installed Access 2013.
Will be in touch by email...
All the best-
Robert.
Hi - I hope you are still monitoring the blogspot. I'm trying to figure out a way to have "today's date" print on a MS Access Report automatically in Hebrew (hebrew date, with hebrew letters right to left). I downloaded one of your classes ( could be it's the original older version) but before I can even look through it, I'm getting an error that it won't work in 64bit. Does your class do what I'm looking for? Thanks!
Post a Comment