News for hackers. Stuff that matters.
Re:JDateTime - Iranian (Shamsi) Date for PHP by amir on Saturday February 23, 2013 @02:31PM (#5271099)
You know you can do this:

    $idf = new IntlDateFormatter('fa_IR@calendar=persian',
        IntlDateFormatter::FULL,
        IntlDateFormatter::FULL,"Asia/Tehran",
        IntlDateFormatter::TRADITIONAL);
right?

PHP has a wrapper for ICU.

Re:JDateTime - Iranian (Shamsi) Date for PHP by sallar on Saturday February 23, 2013 @03:30PM (#5271342)
Sure, but it's PHP 5 >= 5.3.0. jDateTime requires 5.2. IntlDateFormatter did not exist at the time of writing this code.
Re:JDateTime - Iranian (Shamsi) Date for PHP by revelation on Saturday February 23, 2013 @01:46PM (#5270892)
Thank god they finally introduced all this classes and inheritance kerfuffle in PHP, so we can now manually handle Iranian dates by calling "toJalali" on a pseudo-singleton "jDateTime" class.

In all seriousness, I wanted to punch myself in the face when I had to instantiate a "GregorianCalendar" in Java, but the general idea has a lot of merit, even if the implementation is terrible.

Re:JDateTime - Iranian (Shamsi) Date for PHP by maxcan on Saturday February 23, 2013 @02:28PM (#5271090)
not to be confused with JDate.com..
Re:JDateTime - Iranian (Shamsi) Date for PHP by dfc on Saturday February 23, 2013 @03:25PM (#5271315)
That was my reaction as well. Maybe it is because I am from New York, but when I see JDateTime I did not think of Iranian time conversions.
Re:JDateTime - Iranian (Shamsi) Date for PHP by chimeracoder on Saturday February 23, 2013 @06:37PM (#5271966)
Are you from Great Neck[0]? That would be doubly confusing....!

[0] http://en.wikipedia.org/wiki/Great_Neck,_New_York

Re:JDateTime - Iranian (Shamsi) Date for PHP by dfc on Saturday February 23, 2013 @06:40PM (#5271974)
I dont get it?
Re:JDateTime - Iranian (Shamsi) Date for PHP by chimeracoder on Saturday February 23, 2013 @06:51PM (#5272003)
It's a joke - Great Neck has an extremely large population of Iranian Jews.
Re:JDateTime - Iranian (Shamsi) Date for PHP by sallar on Saturday February 23, 2013 @03:31PM (#5271347)
I've never seen JDate.com, I'm sorry for the confusion.
Re:JDateTime - Iranian (Shamsi) Date for PHP by phishphood on Saturday February 23, 2013 @06:20PM (#5271918)
don't know much about how Iranian dates work so I peeked inside the code to see the actual conversion.

Line 482 - $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

Umm, what about leap years, you know the ones that have 29 days in February?

Re:JDateTime - Iranian (Shamsi) Date for PHP by dan1234 on Saturday February 23, 2013 @06:35PM (#5271957)
Looks as if lines 489 onwards are for detecting leap years.
Re:JDateTime - Iranian (Shamsi) Date for PHP by afshinmeh on Saturday February 23, 2013 @03:28PM (#5271332)
upvote, you rock Sallar :)