Home / Admin / Creating Additional Format for the Date / Time field
Duplicate Snippet

Embed Snippet on Your Site

Creating Additional Format for the Date / Time field

This snippet is used to add extra formats for the Time interval on the Date / Time field

<10
Code Preview
php
<?php
/**
 * Add additional formats for the Time field Format dropdown.
 *
 * @link https://wpforms.com/developers/how-to-create-additional-formats-for-the-date-time-field-time-picker/
 */
function  wpf_dev_date_field_time_formats1 ( $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_formats1', 10, 1 );

Comments

Add a Comment