### [wpforms_datetime_time_formats](https://wpforms.com/developers/wpforms_datetime_time_formats/)

**Published:** October 9, 2023
**Author:** Editorial Team

**Excerpt:** The wpforms_datetime_time_formats filters the time field formats available for the <strong>Date Picker</strong> in the form builder.


**Content:**

## Description

The `wpforms_datetime_time_formats` filters the time field formats available for the **Date Picker** in the form builder.

## Parameters

$time\_formats*(array) (Required)* Time format options.## Source

`wpforms/includes/functions/data-presets.php`

## More Information

The filter is applied to an array containing format options for time fields. These options are provided within the form builder when using the **Date Picker** option.

This filter can be used to add additional format options. The format will determine how the time field selections are displayed to the user, how times appear in entries and notifications, and also how time field selections appear within the database.

By default, WPForms provides two formats for the **Time** field. a **12 H** and a **24 H**.

Please see the [PHP DateTimeInterface reference](https://www.php.net/manual/en/function.date.php "PHP DateTimeInterface reference") for additional format options.

## Examples

In our example below, we’re keeping all the default time formats but adding a new one that will appear on the page as **16:04:37** when using the `H:i:s` format.

```

/**
 * Filters the time field formats available for the Date Picker in the form builder.
 * 
 * @link   https://wpforms.com/developers/wpforms_datetime_time_formats/
 *
 * @param  array $time_formats Time format options.
 * @return array
 */

function  wpf_dev_date_field_time_formats ( $time_formats ) {

        // Displays 2-digit hour, 2-digit minute, and 2-digit seconds
	$time_formats[ 'H:i:s' ] = 'HH:MM:SS';

	return $time_formats;
}
add_filter( 'wpforms_datetime_time_formats', 'wpf_dev_date_field_time_formats', 10, 1 );

```

## Related

Article Reference: [How to Create Additional Formats for the Date Time Field Time Picker](https://wpforms.com/developers/how-to-create-additional-formats-for-the-date-time-field-time-picker/ "How to Create Additional Formats for the Date Time Field Time Picker")

**Categories:** Filters Hooks

**Tags:** Date Time Field, PHP

---

