• Resolved andriiwork

    (@andriiwork)


    Hello All.

    Can anyone help me with the submission in the form. (snippet).

    Now format “10 Jul 2023” I want change to “10.07.2023”

    In settings custom format not work. Thanks.

    • This topic was modified 1 year, 4 months ago by andriiwork.
    • This topic was modified 1 year, 4 months ago by andriiwork.
    • This topic was modified 1 year, 4 months ago by andriiwork.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @andriiwork

    I tried using j.n.Y instead of d.m.Y in the Use custom Date format field. My reference is from this link: https://www.php.net/manual/en/function.date.php

    Thread Starter andriiwork

    (@andriiwork)

    Hi @gelieys

    Not work ??

    @andriiwork

    You can try this code snippet

    add_filter( "um_get_field_date", 'um_get_field_date_custom_format', 10, 1 );
    
    function um_get_field_date_custom_format( $array ) {
        
        $array['js_format'] = 'dd.mm.yyyy';
        $array['format_custom'] = 'd.m.y';
        $array['format'] = 'd.m.y';
    
        return $array;
    }

    Install the code snippet into your active theme’s functions.php file
    or use the “Code Snippets” plugin.

    https://www.ads-software.com/plugins/code-snippets/

    Thread Starter andriiwork

    (@andriiwork)

    Hello @missveronicatv

    Its work! Thanks!

    add_action("um_registration_complete","um_change_date_format", 1, 2 );
    function um_change_date_format( $user_id, $args ){
        $date = get_user_meta( $user_id, "meta_key_!", true );
        update_user_meta( $user_id, "meta_key_!", date_i18n("d.m.Y", strtotime( $date ) ) );
    }
    
    add_action("um_after_user_updated","um_update_date_format", 1, 2 );
    function um_update_date_format( $user_id, $args ){
        $date = get_user_meta( $user_id, "meta_key_!", true );
        update_user_meta( $user_id, "meta_key_!", date_i18n("d.m.Y", strtotime( $date ) ) );
    }
    
    add_filter( "um_get_field_date", 'um_get_field_date_custom_format', 10, 1 );
    function um_get_field_date_custom_format( $array ) {
        $array['js_format'] = 'dd.mm.yyyy';
        $array['format_custom'] = 'd.m.Y';
        $array['format'] = 'd.m.Y';
        return $array;
    }
    • This reply was modified 1 year, 4 months ago by andriiwork.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Date Format (Profile/Register Form)’ is closed to new replies.