3 ms·
JDateTime - Iranian (Shamsi) Date for PHP
jDateTime is a PHP wrapper for DateTime class enabling developers to use Iranian date/time in their projects.
- revelation 14y agoThank 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.
- maxcan 14y agonot to be confused with JDate.com..
- dfc 14y agoThat 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.
- chimeracoder 14y agoAre you from Great Neck[0]? That would be doubly confusing....! [0] http://en.wikipedia.org/wiki/Great_Neck,_New_York http://en.wikipedia.org/wiki/Great_Neck,_New_York
- dfc 14y agoI dont get it?
- chimeracoder 14y agoIt's a joke - Great Neck has an extremely large population of Iranian Jews.
- sallar 14y agoI've never seen JDate.com, I'm sorry for the confusion.
- amir 14y agoYou 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.
- sallar 14y agoSure, but it's PHP 5 >= 5.3.0. jDateTime requires 5.2. IntlDateFormatter did not exist at the time of writing this code.
- afshinmeh 14y agoupvote, you rock Sallar :)
- phishphood 14y agodon'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?
- dan1234 14y agoLooks as if lines 489 onwards are for detecting leap years.