Changing default calendar to Jalali calendar

#1

Dear All,
I’m using a program which uses Gregorian calendar. I want to change it to Persian calendar. I asked the software’s programmer, and he answered me in this way:
" Another option is to change the code of classes/model/AppDelegation.php and /classes/model/Application.php files to write Jalali dates to the APP_DELEGATION and APPLICATION tables. For example, you could change $this->setDelDelegateDate(…) to code to insert a Jalali date, but MySQL expects the datetime fields to be written in the format “YYYY-MM-DD HH:MM:SS”. "

I have a php file which can generate Persian calendar easily. It is attached in this topic.
Persian calendar functions:
function mds_date($format, $when=“now”, $persianNumber = 0) ;
parameters:
$format: Format of ouput date
$when: Time of calendar into the second, if it sets “now”, the mds_date function shows current date
$persianNumber: If you want to print numbers into the Persian numbers, set it to 1 else set it to zero
returns:
string of solar date
Example:
<?php
require_once(“PersianCalendar.php”);

echo mds_date(“Y/m/d”, “now”, 1); // ۱۳۸۲/۰۸/۰۵
echo mds_date(“l j F Y”;, make_time(0,0,0,6,30,1998), 1); //پنجشنبه ۱۱ دي ۱۳۴۸
echo mds_date(“l j F Y , i : H”, time(), 0); //سه شنبه 15 مرداد 1387 , 20 : 07
?>

I included Persian calendar to aforementioned path, and used this code:
require_once ‘calendar.php’;
I struggled a lot, but I did not manage to solve my problem.
Of course, I’m new in this forum, and I do not know how can I attach my files!
I would be very very grateful, if you could help me with this issue.
Looking forward to your comments
Kind Regards.

#2

I studied Persian many years ago and i forget all of what i had learned. Persian is a fascinating language, for example, soo, meaning water, is probably the source of the modern English word sewer (with anglicized pronunciation and melodramatic spelling.)

Anyway, this is a tough question for those of us that do not work with Persian language and systems. I used Google to search for any answers and i found an interesting resource at github:

https://github.com/zoghal/Presian-Date-for-MySQL

maybe this is helpful to you?

#3

Thanks for your help

1 Like