1. Home
  2. Snippets
  3. Create additional formats for the Date field date picker

Create additional formats for the Date field date picker

Heads up!

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.

For extra guidance, please see WPBeginner's tutorial on adding custom code.


The Date Time field date picker provides 3 different formats to choose from. Additional formats can be made available with a filter.

The snippet below adds a new format “Wednesday, 7th December 2016”. Please note that the PHP and JS date characters may be different, so refer to the links in the comments.

Lastly, all dates are also converted and stored in a UNIX time stamp (in addition to the readable format). Depending on the date format, it could affect the ability for PHP to create the UNIX time stamp correctly. In most cases this is not an issue, but still worth noting.

 * Add additional formats for the Date field date picker.
 * @param array $formats
 * @return array
function wpf_dev_date_field_formats( $formats ) {

	// Item key is JS date character - see https://flatpickr.js.org/formatting/
	// Item value is in PHP format - see http://php.net/manual/en/function.date.php

	// Adds new format Wednesday, 7th December 2016
	$formats['l, J F Y'] = 'l, jS F Y';

	return $formats;
add_filter( 'wpforms_datetime_date_formats', 'wpf_dev_date_field_formats' );
Updated on April 12, 2019

Was this article helpful?