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
Use this code example to add a date format option in the Global Settings. This setting will be applied to the default date format for all date fields in your forms. Read more on the date formats using the jQuery datepicker and PHP date format.
Replace 'j M, Y' with the PHP date format. Replace 'd M, yy' with the jQuery date format.
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;
}
For example, if you want to display the date format as Sat Mar 7, change line 3 to:
$formats['D M j'] = 'D M d';