Answers.Body: <p>After searching on Jira for the funciton, nothing came up, so searched the codebase from our backup and found the function was in the file: civicrm/civicrm/CRM/Utils/Date.php:1788</p>
  
  <p>It's now gone, along with a lot of other ones!</p>
  
  <p>So I've added the array of date formats to the code to workaround the issue.</p>
  
  <pre><code>//$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
    $actualPHPFormats = array(
      "mm/dd/yy" =&gt; 'm/d/Y',
      "dd/mm/yy" =&gt; 'd/m/Y',
      "yy-mm-dd" =&gt; 'Y-m-d',
      "dd-mm-yy" =&gt; 'd-m-Y',
      "dd.mm.yy" =&gt; 'd.m.Y',
      "M d" =&gt; 'M j',
      "M d, yy" =&gt; 'M j, Y',
      "d M yy" =&gt; 'j M Y',
      "MM d, yy" =&gt; 'F j, Y',
      "d MM yy" =&gt; 'j F Y',
      "DD, d MM yy" =&gt; 'l, j F Y',
      "mm/dd" =&gt; 'm/d',
      "dd-mm" =&gt; 'd-m',
      "yy-mm" =&gt; 'Y-m',
      "M yy" =&gt; 'M Y',
      "M Y" =&gt; 'M Y',
      "yy" =&gt; 'Y',
    );
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T14:20:25.467Z
Answers.LastActivityDate: 2017-11-15T14:20:25.467Z
Answers.UserDisplayName: Darren
Answers.Body: <p>I can't find that function in the latest release so it seems to be fixed since 4.7.27 (latest is 5.0.0)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-17T21:12:19.043Z
Answers.LastActivityDate: 2018-04-17T21:12:19.043Z
Answers.UserDisplayName: user4278
Body: <p>We have just upgraded WP to 4.8.3 and Civi to 4.7.27, now getting the following error from one of our extensions:-</p>
  
  <blockquote>
    <p>Call to undefined method CRM_Core_SelectValues::datePluginToPHPFormats() </p>
  </blockquote>
  
  <p>The offending code snippet is below:-</p>
  
  <pre><code>protected function getFormattedFieldValue($value, $field) {
  if ($field['data_type'] == 'Date' &amp;&amp; !empty($value)) {
  </code></pre>
  
  <blockquote>
  <pre><code>$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
  </code></pre>
  </blockquote>
  
  <pre><code>  $dateFormat = (array) CRM_Utils_Array::value($field['date_format'], $actualPHPFormats);
    $value = CRM_Utils_Date::processDate($value, NULL, FALSE, implode(" ", $dateFormat));
  } elseif (!empty($field['option_group_id']) &amp;&amp; $value) {
    try {
      $value = civicrm_api3('OptionValue', 'getvalue', array(
        'return' =&gt; 'label',
        'option_group_id' =&gt; $field['option_group_id'],
        'value' =&gt; $value,
      ));
    } catch (Exception $e) {
      throw $e;
    }
  }
  return $value;
  </code></pre>
  
  <p>}</p>
  
  <p>Any ideas how I can correct this code? I can't find the function in the docs: <a href="https://doc.symbiotic.coop/dev/civicrm/v47/phpdoc/CRM_Core_SelectValues.html" rel="nofollow noreferrer">https://doc.symbiotic.coop/dev/civicrm/v47/phpdoc/CRM_Core_SelectValues.html</a></p>
  
  <p>Thank you!</p>
  
Tags: <extension><4.7.27>
Title: How to resolve "Call to undefined function" after upgrade to 4.7.27 CRM_Core_SelectValues::datePluginToPHPFormats()
ThreadText: # How to resolve "Call to undefined function" after upgrade to 4.7.27 CRM_Core_SelectValues::datePluginToPHPFormats()
  
  (Asked by: username_0 on 2017-11-15)
  
  We have just upgraded WP to 4.8.3 and Civi to 4.7.27, now getting the following error from one of our extensions:-
  
  Call to undefined method CRM_Core_SelectValues::datePluginToPHPFormats() 
  
  The offending code snippet is below:-
  protected function getFormattedFieldValue($value, $field) {
  if ($field['data_type'] == 'Date' && !empty($value)) {
  
  
  $actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
  
  
    $dateFormat = (array) CRM_Utils_Array::value($field['date_format'], $actualPHPFormats);
    $value = CRM_Utils_Date::processDate($value, NULL, FALSE, implode(" ", $dateFormat));
  } elseif (!empty($field['option_group_id']) && $value) {
    try {
      $value = civicrm_api3('OptionValue', 'getvalue', array(
        'return' => 'label',
        'option_group_id' => $field['option_group_id'],
        'value' => $value,
      ));
    } catch (Exception $e) {
      throw $e;
    }
  }
  return $value;
  
  }
  Any ideas how I can correct this code? I can't find the function in the docs: https://doc.symbiotic.coop/dev/civicrm/v47/phpdoc/CRM_Core_SelectValues.html
  Thank you!
  
  **Tags:** extension, 4.7.27
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-11-15. Score: 1
  
  After searching on Jira for the funciton, nothing came up, so searched the codebase from our backup and found the function was in the file: civicrm/civicrm/CRM/Utils/Date.php:1788
  It's now gone, along with a lot of other ones!
  So I've added the array of date formats to the code to workaround the issue.
  //$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
    $actualPHPFormats = array(
      "mm/dd/yy" => 'm/d/Y',
      "dd/mm/yy" => 'd/m/Y',
      "yy-mm-dd" => 'Y-m-d',
      "dd-mm-yy" => 'd-m-Y',
      "dd.mm.yy" => 'd.m.Y',
      "M d" => 'M j',
      "M d, yy" => 'M j, Y',
      "d M yy" => 'j M Y',
      "MM d, yy" => 'F j, Y',
      "d MM yy" => 'j F Y',
      "DD, d MM yy" => 'l, j F Y',
      "mm/dd" => 'm/d',
      "dd-mm" => 'd-m',
      "yy-mm" => 'Y-m',
      "M yy" => 'M Y',
      "M Y" => 'M Y',
      "yy" => 'Y',
    );
  
  
  ---
  
  ### Answer by username_1 on 2018-04-17. Score: 0
  
  I can't find that function in the latest release so it seems to be fixed since 4.7.27 (latest is 5.0.0)
  
  
  ---
  
  