This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook can be used to add a custom date format in your Global Settings for Date Formats. The first date format is the PHP date format, which is 'j M, Y' in the example below. Get more information on PHP date formats. The second date format will be the Datepicker format which is d M, yy. This format will control how the date is displayed in the Date field. Get more information on Datepicker compatible formats. The Datepicker date format must correspond to the appropriate PHP date format.
Usage
add_filter('frm_datepicker_formats', 'add_custom_frm_format'); function add_custom_frm_format($formats)
Parameters
- $formats (array)
Examples
Change Date Format
After adding the custom code below to your site, you can update the Date Format for your forms in your Global Settings. The first option is for the PHP format, and the second is the jQuery datepicker format. See the datepicker options.
add_filter('frm_datepicker_formats', 'add_custom_frm_format');
function add_custom_frm_format($formats) {
$formats['j M, Y'] = 'd M, yy'; //change PHP and Datepicker formats
return $formats;
}