How to change the date format in WordPress contact form 7

南笙酒味 提交于 2021-02-04 06:07:27

问题


I am using the wordpress contact form and its field date picker, its default is DD/MM/YYYY, but I want to change its format to MM/DD/YYYY.

Can any one tell me how to do it in contact form 7.

Regards


回答1:


Copy and paste it in your function file and also you can modify the date format as per requirement.

 add_filter('avf_datepicker_dateformat', 'avf_change_datepicker_format');
    function avf_change_datepicker_format($date_format) {
        $date_format = 'mm / dd / yy';
        return $date_format;
    }



回答2:


If above writen code is not working its means: If a value is specified in a date field, the value must be in YYYY-MM-DD format (e.g. 2013-04-08) according to the HTML5 specification.

This is in most cases you don’t need to care about because browser’s date picker UI will set a value in the correct format.




回答3:


I changed the display date format to mm/dd/yy in the front end of my form by using plugin Custom Datepicker NMR for Contact Form 7.

This allows you to use a new input field in your contact form called [datepicker ]

Install/activate the plugin and specify format date to show in the web browser like this:

[datepicker myFirstDatepicker id:myFirstDatepicker format:mm/dd/yy]

This plugin uses jquery-ui datepicker.



来源:https://stackoverflow.com/questions/45980760/how-to-change-the-date-format-in-wordpress-contact-form-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!