<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>WordPress &#8250; Support Topic: How to convert a post's date/year from Gregorian calendar to Hebrew calendar?</title>
<link>http://wordpress.org/support/</link>
<description>WordPress &#8250; Support Topic: How to convert a post's date/year from Gregorian calendar to Hebrew calendar?</description>
<language>en</language>
<pubDate>Thu, 26 Nov 2009 13:38:53 +0000</pubDate>

<item>
<title>Copernicus on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1108540</link>
<pubDate>Thu, 18 Jun 2009 15:24:54 +0000</pubDate>
<dc:creator>Copernicus</dc:creator>
<guid isPermaLink="false">1108540@http://wordpress.org/support/</guid>
<description>&#60;p&#62;That worked perfectly! Thank you MichaelH.&#60;br /&#62;
The only thing I had to change to get it working was the addition of a &#34;;&#34; before the &#34;echo.&#34;&#60;/p&#62;
&#60;p&#62;So, now, the entire snippet reads:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#38;lt;p&#38;gt;{php:$datestring=jdtojewish(gregoriantojd({date:n,j,Y})); echo substr($datestring, -4);}&#38;lt;/p&#38;gt;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Thanks again, this was a huge help!
&#60;/p&#62;</description>
</item>
<item>
<title>MichaelH on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1080674</link>
<pubDate>Fri, 22 May 2009 12:55:03 +0000</pubDate>
<dc:creator>MichaelH</dc:creator>
<guid isPermaLink="false">1080674@http://wordpress.org/support/</guid>
<description>&#60;p&#62;At the very least couldn't you do something like:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$datestring = jdtojewish(gregoriantojd({date:n,j,Y}))
echo substr($datestring, -4);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>Copernicus on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1080207</link>
<pubDate>Thu, 21 May 2009 21:47:38 +0000</pubDate>
<dc:creator>Copernicus</dc:creator>
<guid isPermaLink="false">1080207@http://wordpress.org/support/</guid>
<description>&#60;p&#62;&#60;strong&#62;Follow-up&#60;/strong&#62; (posted for the benefit of anyone else that might seek a similar solution):&#60;/p&#62;
&#60;p&#62;I'm embarrassed to say that, after all of that work, the code snippet I had did not accurately transliterate the years (for example 12/15/2006 became 5766 instead of 5767).&#60;/p&#62;
&#60;p&#62;Thus, I found another way utilizing a combination of what I learned from MichaelH (above) and &#60;a href=&#34;http://rmarsh.com/plugins/recent-posts/&#34;&#62;Rob Marsh's &#34;Recent Posts&#34; plugin&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;Now, I employ the following code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php if (function_exists(&#38;#39;recent_posts&#38;#39;)) recent_posts(&#38;#39;included_cats=1&#38;amp;amp;limit=10&#38;amp;amp;output_template=&#38;lt;p&#38;gt;&#38;lt;a href=&#38;quot;{url}&#38;quot;&#38;gt;{php:echo(jdtojewish(gregoriantojd({date:n,j,Y})));}&#38;lt;/a&#38;gt;&#38;lt;/p&#38;gt;&#38;#39;); ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and it displays the posts (in the sample above, the category of interest has the category ID of &#34;1&#34;) with the proper Hebrew date as a link.&#60;/p&#62;
&#60;p&#62;Unfortunately, it displays the FULL date (MM/DD/YYYY) instead of just the year (which is what I require in my specific project)... but at least it works. As a note, the jdtojewish PHP function needs the full date in MM,DD,YYYY format to transliterate properly into a Hebrew year.&#60;/p&#62;
&#60;p&#62;If I had better chops, I could probably figure out how to use the above code AND make it only display the year. For now, I do not have those chops.&#60;/p&#62;
&#60;p&#62;Thanks again to MichaelH for the help.
&#60;/p&#62;</description>
</item>
<item>
<title>Copernicus on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1080174</link>
<pubDate>Thu, 21 May 2009 20:58:47 +0000</pubDate>
<dc:creator>Copernicus</dc:creator>
<guid isPermaLink="false">1080174@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Thanks again, Michael, for all your help!&#60;br /&#62;
It turns out, for whatever reason, I needed to have the code&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$gregorianMonth = mysql2date(&#38;quot;n&#38;quot;, $post-&#38;gt;post_date);
$gregorianDay = mysql2date(&#38;quot;j&#38;quot;, $post-&#38;gt;post_date);
$gregorianYear = mysql2date(&#38;quot;Y&#38;quot;, $post-&#38;gt;post_date);
$jdDate = gregoriantojd($gregorianMonth,$gregorianDay,$gregorianYear);
$hebrewMonthName = jdmonthname($jdDate,4);
$hebrewDate = jdtojewish($jdDate);
list($hebrewMonth, $hebrewDay, $hebrewYear) = split(&#38;#39;/&#38;#39;,$hebrewDate);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;in BOTH loops.&#60;/p&#62;
&#60;p&#62;Adding the code to both has it now working!&#60;/p&#62;
&#60;p&#62;There's probably a more efficient way to do this, but at this point, I'm just happy that it works.&#60;/p&#62;
&#60;p&#62;Thank you!
&#60;/p&#62;</description>
</item>
<item>
<title>MichaelH on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1079756</link>
<pubDate>Thu, 21 May 2009 13:06:50 +0000</pubDate>
<dc:creator>MichaelH</dc:creator>
<guid isPermaLink="false">1079756@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Just as a note, I didn't confirm that your code to create the Hebrew date works...&#60;/p&#62;
&#60;p&#62;You have three different post loops there but only show date conversion logic in the first loop.  &#60;/p&#62;
&#60;p&#62;If that isn't the issue you may need to paste your complete template to a pastebin &#60;a href=&#34;http://wordpress.pastebin.ca/&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.pastebin.ca/&#60;/a&#62; and report the link back here.
&#60;/p&#62;</description>
</item>
<item>
<title>Copernicus on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1079486</link>
<pubDate>Thu, 21 May 2009 03:22:52 +0000</pubDate>
<dc:creator>Copernicus</dc:creator>
<guid isPermaLink="false">1079486@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Oh, man, Michael, thank you for the great start.&#60;/p&#62;
&#60;p&#62;I'm definitely getting closer, but can't get it to work just yet.&#60;/p&#62;
&#60;p&#62;So far, I have:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&#38;gt;
&#38;lt;?php
$gregorianMonth = mysql2date(&#38;quot;n&#38;quot;, $post-&#38;gt;post_date);
$gregorianDay = mysql2date(&#38;quot;j&#38;quot;, $post-&#38;gt;post_date);
$gregorianYear = mysql2date(&#38;quot;Y&#38;quot;, $post-&#38;gt;post_date);

$jdDate = gregoriantojd($gregorianMonth,$gregorianDay,$gregorianYear);
$hebrewMonthName = jdmonthname($jdDate,4);
$hebrewDate = jdtojewish($jdDate);
list($hebrewMonth, $hebrewDay, $hebrewYear) = split(&#38;#39;/&#38;#39;,$hebrewDate);
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Then, in calling the posts, I am using either:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
global $post;
$myposts = get_posts(&#38;#39;numberposts=99&#38;amp;amp;category=40&#38;#39;);
foreach($myposts as $post) :
?&#38;gt;
&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink(); ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_time(Y); ?&#38;gt;&#38;lt;/a&#38;gt;
&#38;lt;?php endforeach; ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;or&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
global $post;
$myposts = get_posts(&#38;#39;numberposts=99&#38;amp;amp;category=40&#38;#39;);
foreach($myposts as $post) :
?&#38;gt;
&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink(); ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_time($hebrewYear); ?&#38;gt;&#38;lt;/a&#38;gt;
&#38;lt;?php endforeach; ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The first bit of code accurately displays the Gregorian year of each post (for example 2006 &#38;amp; 2009 for two sample posts). The second bit of code displays the Hebrew year - BUT it's only the current Hebrew year, not the Hebrew year of the post (both of them showing up as 5769 rather than 5767 and 5769).&#60;/p&#62;
&#60;p&#62;Does anything in the above set-up jump out as responsible for that problem?&#60;/p&#62;
&#60;p&#62;Thanks again for the help!
&#60;/p&#62;</description>
</item>
<item>
<title>MichaelH on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1079394</link>
<pubDate>Thu, 21 May 2009 00:15:40 +0000</pubDate>
<dc:creator>MichaelH</dc:creator>
<guid isPermaLink="false">1079394@http://wordpress.org/support/</guid>
<description>&#60;p&#62;In a &#60;a href=&#34;http://codex.wordpress.org/The_Loop&#34;&#62;loop&#60;/a&#62;, these variables for your routine:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$gregorianMonth = mysql2date(&#38;quot;n&#38;quot;, $post-&#38;gt;post_date);
$gregorianDay = mysql2date(&#38;quot;j&#38;quot;, $post-&#38;gt;post_date);
$gregorianYear = mysql2date(&#38;quot;Y&#38;quot;, $post-&#38;gt;post_date);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>Copernicus on "How to convert a post's date/year from Gregorian calendar to Hebrew calendar?"</title>
<link>http://wordpress.org/support/topic/272478#post-1079262</link>
<pubDate>Wed, 20 May 2009 21:57:35 +0000</pubDate>
<dc:creator>Copernicus</dc:creator>
<guid isPermaLink="false">1079262@http://wordpress.org/support/</guid>
<description>&#60;p&#62;For a project I'm working on, we wish to convert the date of posts within a single category from the Gregorian calendar year (2009, for example) to the Hebrew calendar year (5769, in this case).&#60;/p&#62;
&#60;p&#62;Does anyone know how to do this? I found the PHP snippet below, but have no idea how to call it within WordPress so that it would convert the date output with a post to read in the Hebrew year.&#60;/p&#62;
&#60;p&#62;Any &#38;amp; all help is appreciated!&#60;/p&#62;
&#60;p&#62;Sample code snippet that &#60;strong&#62;seems&#60;/strong&#62; to do what we're looking for:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
$gregorianMonth = date(n);
$gregorianDay = date(j);
$gregorianYear = date(Y);

$jdDate = gregoriantojd($gregorianMonth,$gregorianDay,$gregorianYear);

$hebrewMonthName = jdmonthname($jdDate,4);

$hebrewDate = jdtojewish($jdDate);

list($hebrewMonth, $hebrewDay, $hebrewYear) = split(&#38;#39;/&#38;#39;,$hebrewDate);

echo &#38;quot;$hebrewDay $hebrewMonthName $hebrewYear&#38;quot;;

?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>

</channel>
</rss>
