Title: problem with jalali date
Last modified: October 20, 2016

---

# problem with jalali date

 *  [Omid Reza Vasheghani Farahani](https://wordpress.org/support/users/omidr/)
 * (@omidr)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-jalali-date/)
 * CFDB uses a block of code for the purpose of converting dates to jalali. code
   is located in CF7DBPlugin.php:
 *     ```
       // See if wp-jalali is active and if so, have it convert the date
       // using its 'jdate' function
       else if (is_plugin_active('wp-jalali/wp-jalali.php')) {
       	$jDateFile = WP_PLUGIN_DIR . '/wp-jalali/inc/jalali-core.php';
       	if(@file_exists($jDateFile)) {
       	    include_once($jDateFile);
       		if (function_exists('jdate')) {
       			//return jdate('l, F j, Y');
       			if (CF7DBPlugin::$customDateFormat) {
       				return jdate(CF7DBPlugin::$customDateFormat, $time);
       			}
       			else {
       				return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
       			}
       		}
       	}
       }
       ```
   
 * the above code looks for a file which no longer exists. jdate function is automatically
   loaded and there is no need to include the file containing it. Hence I think 
   changing the above code with the following would be appropriate.
 *     ```
       // See if wp-jalali is active and if so, have it convert the date
       // using its 'jdate' function
       else if (is_plugin_active('wp-jalali/wp-jalali.php')) {
       	if (function_exists('jdate')) {
       		//return jdate('l, F j, Y');
       		if (CF7DBPlugin::$customDateFormat) {
       			return jdate(CF7DBPlugin::$customDateFormat, $time);
       		}
       		else {
       			return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
       		}
       	}
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-jalali-date/#post-8336538)
 * Did you test the code to see if it works?
 *  Thread Starter [Omid Reza Vasheghani Farahani](https://wordpress.org/support/users/omidr/)
 * (@omidr)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-jalali-date/#post-8337426)
 * Yes, I tested it and it works fine.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-jalali-date/#post-8338561)
 * Thank you very much.
 * I’ll additionally consolidate the “if” statements and add that change to my next
   update.
 *     ```
       // See if wp-jalali is active and if so, have it convert the date
       // using its 'jdate' function
       else if (is_plugin_active('wp-jalali/wp-jalali.php') && function_exists('jdate')) {
           if (CF7DBPlugin::$customDateFormat) {
               return jdate(CF7DBPlugin::$customDateFormat, $time);
           } else {
               return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
           }
       }
       ```
   
    -  This reply was modified 9 years, 7 months ago by [Michael Simpson](https://wordpress.org/support/users/msimpson/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘problem with jalali date’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-to-database-extension_ffffff.
   svg)
 * [Contact Form DB](https://wordpress.org/plugins/contact-form-7-to-database-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-to-database-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/reviews/)

## Tags

 * [jalali](https://wordpress.org/support/topic-tag/jalali/)

 * 3 replies
 * 2 participants
 * Last reply from: [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-jalali-date/#post-8338561)
 * Status: not resolved