mikeage.net Logo

mikeage.net @ ט״ו כסלו תשפ״ג

Hebrew Dates v1.0.3

Based on feedback from KosherJava (on the v1.0.2. release announcement), I've enhanced the currentHebrewDate() API in the Hebrew Dates plugin. It now accepts parameters to control how the date is printed.


HebrewDate provides an API, hebrewDateCurrent($dateFormat,$location) that can be used to display the current Hebrew Date in your favorite theme. If called with no parameters (or an illegal combination of parameters), it displays the current Hebrew Date according to the Character Set configuration above. By setting $dateFormat to a valid PHP date format, and $location to either "before" or "after" (including the quotation marks), it will display the secular day as well ($location controls the placement of the Hebrew Date).

Alternatively, $dateFormat can be set to the special value of "date_format", in which case it will use the default wordpress formatting.

Finally, $dateFormat can be set to the special value of "default". In this case, the $location parameter is ignored, and the function produces the same value that the_time() produces within The Loop.


In the legal cases, it functions according to the rules above. In the illegal cases, it returns the default value (same as if it receives no arguments)

Legal: hebrewDateCurrent():
Legal: hebrewDateCurrent("r","before"):
Legal: hebrewDateCurrent("r","after"):
Illegal: hebrewDateCurrent("r"):
Illegal: hebrewDateCurrent("","after"):
Illegal: hebrewDateCurrent("date_format"):
Legal: hebrewDateCurrent("date_format","after"):
Legal: hebrewDateCurrent("F y H:m","after"):
Legal: hebrewDateCurrent("default"):

The new version is 1.0.3, and is available at the Hebrew Dates release page.

22 Responses to “Hebrew Dates v1.0.3”

  1. KosherJava says:

    Looks great.
    <?php if (function_exists('hebrewDateCurrent')) {hebrewDateCurrent("default");} ?> is much easier to use.

  2. Jacob says:


    I've just started using your version of Hebrew Date. And it works like a charm, but I have a question. I've chosen to display the Gregorian Date and the Hebrew Date. But I also want to use your hebrewDateCurrent-function. However, I can't get it to just display the hebrew date (i'm using my own plugin for the normal spelling). Is there anyway to make it do that?



  3. Mike Miller says:

    Sure: hebrewDateCurrent() with no arguments!

  4. Jacob says:


    My mistake. Without arguments, that function displays the same as my own. But what I want is it to display the current date in full hebrew. Like if you set the options for that plugin to 'Hebrew months' and without the use of Arabic numbers.

    The problem is that I want that kinda display only when using the hebrewDateCurrent() and not under the titles of posts. So, I cannot use the options for that.

    I hope this explanation is somewhat clearer…

  5. Mike Miller says:

    Gotcha. In other words, you want to have a separate set of options for the formatted HebrewDate from hebrewDateCurrent (distinct from those used by the wrapper for post & comment dates).

    Shouldn't be a big deal, but I'm kinda busy at the moment. I'm also working on rewriting much of the code; if you don't see a post from me by, say, Tuesday (post Purim), feel free to bug me again ๐Ÿ˜‰

  6. Jacob says:

    Thanks Mike! A separate set of options would be the preferred thing to have, yes. I'll wait for the new code. As for updating code, I've decided that my plugin could also use a make-over, so, besided the small fix I've added today, I'm going to expand it a little…


  7. […] a more comprehensive plugin like this, I would recommend Hebrew Dates 1.0.3 by Mike Miller. Posted in PHP (No Ratings Yet)  Loading […]

  8. Jacob Fresco says:

    if you don't see a post from me by, say, Tuesday (post Purim), feel free to bug me again

    Bug bug ๐Ÿ˜‰ Just kiddin', I'll see the code when you have time to finish it…

  9. Mike Miller says:

    Glad you remembered, and no, I didn't forget. ๐Ÿ™‚

    That said, it's going to be a (hopefully short) while, though. I have one or two personal things going on these days that are taking up most of my time, and I'm a little reluctant to add too much more new code before cleaning up some of the cruft that's there now.

  10. Jacob Fresco says:

    Fair enough ๐Ÿ˜€ Tonight is my night off, so if I feel like it, I'll see if can do something with my own plugin, using ofcourse some of yours ๐Ÿ˜‰

  11. KosherJava says:

    You might want to have a look at the enhancements I recently made to the Jewish date code in PhpGedView. Have a look at http://svn.sourceforge.net/viewvc/phpgedview/trunk/phpGedView/includes/functions_date_hebrew.php?sortby=date&view=log
    The main change was to use a geresh and gershayim instead of single and double quotes. There are many issues that can come up when using quotes within code, and this solves some of them. Also removed was the span wrapper. The geresh and gershayim use also resolves some directionality issues.

  12. KosherJava says:

    You might want to have a quick look at the Writing Secure WordPress Plugins article. Not sure how applicable it is to the Hebrew date plugin.

  13. […] a more comprehensive plugin like this, I would recommend Hebrew Dates 1.0.3 by Mike Miller. <?php /* Plugin Name: Joodse Datum Plugin URI: http://www.jacobfresco.nl […]

  14. Dolev says:

    I'm using wordpress version 2.7 and I want to use this perfect plug but I got this strange problem
    When the plug is starting I've got the same date in all of my posts.
    The sate I've got is: ร—โ€บ"ร—โ€˜ ร—หœร—โ€˜ร—ยช ร—โ€' ร—ยชร—ยฉ"ร—ล“

    I do not know how to fix it.
    please help me

    Thank you .


  15. Mike Miller says:

    I'm running 2.7, and it appears to be working here.

    22 Teves 5730 corresponds to Jan 1st 1970; aka, unix time 0. For some reason, it's not picking up the proper dates.

    Did you change your date format to something non-standard? Can you try changing it back to the default format, and seeing if it helps?

  16. Dolev says:

    Hi mike.
    I was change my date format to the default and the times that shows isn't working well.
    I'll be happy if you'll look at my blog and say what is the problem:

    the time format in my theme is:

    Thank you

  17. Mike Miller says:

    I'll try to take a look on motzei shabbat.

    In the meantime, can you email me your theme files?

  18. Dolev says:

    Hi mike
    Have you seen my blog?
    thank you

  19. Mike Miller says:

    I did, and I can see that the post dates are logical (but seem wrong), but the comment dates are not. Can you send me your theme files?

  20. Dolev says:

    Yep , I'll send you my theme files

  21. Chip says:

    Hi Mike!

    I just added your great plugin to the homepage of our youth center.
    I would like to know, how we can add a fullstop after the numbers for the day?

    So now it looks like this: "24 Tischrej 5776",
    but it should look like "24. Tischrej 5776".

    Where in the code can I add this fullstop?!

    Thank you in advance about a timely response!

Leave a Reply

Quick Map
Content +
Personal +
Archives +
Site Stuff +
RBS Weather +
Search +
Recent Images

Valid XHTML 1.1!
Printer Friendly Page

Last Modified: September 04, 2006 @ 02:11 CST

Memory(TRUE): 4194304/4194304
Memory(FALSE): 3129240/3139200