omfgppc - 2009-01-28

ommmmid wrote: Hi everyone!

Is it possible to change Postbooks calender from Gregorian ( plain january feb marhc calender) to Jalalian (Hejri Shamsi, used in Iran)?

I got the function that converts one to the other, it''s written in PHP, but I can make it with C++ easily too. The question is, is it possible to implement that function somewhere in the source?

I thing this is more of a development problem, but I put it in here for no special reason. Dear Admin plz move this to development section, if it should be there.

Thanks in Advance

Here''s the PHP Code:

[code:1:1b5738d870]
<php> ''فروردین'',
        ''اردیبهشت'',
        ''خرداد'',
        ''تیر'',
        ''مرداد'',
        ''شهریور'',
        ''مهر'',
        ''آبان'',
        ''آذر'',
        ''دی'',
        ''بهمن'',
        ''اسفند''
    );
   
    $convmap = array(
        ''Y'' => $jal_date[0],                // 4 digits year
        ''y'' => substr($jal_date[0]+100, 1), // 2 digits year
        ''m'' => substr($jal_date[1]+100, 1), // month number, with leading zeros
        ''n'' => $jal_date[1],                // month number, without leading zeros
        ''d'' => substr($jal_date[2]+100, 1), // day number, with leading zeros
        ''j'' => $jal_date[2],                // day number, without leading zeros
        ''F'' => $jal_months[$jal_date[1]],   // month name
        ''l'' => $week_days[$week_day],       // A full textual representation of the day of the week
        ''w'' => $week_day,
    );

    return strtr($format, $convmap);
}

echo
    ''<br>'', grn2jal(''1984-02-26'', ''l j F Y''),
    ''<br>'', jal2grn(''1362-12-07'', ''l j F Y''),
    ''<br>'';

echo
    ''<bdo>'', grn2jal(''1984-02-26'', ''Y/n/j''), ''</bdo>'';[/code:1:1b5738d870] -- Read more at http://www.xtuple.org/phpBB2/viewtopic.php?t=3270