Support

Account

Home Forums Backend Issues (wp-admin) date & time picker wrong date & time issue

Unread

date & time picker wrong date & time issue

  • Hi

    we have installed ACF date & time picker.

    the problem we have now is we need to click on “NOW” to get the correct current date & time for our posts.

    if we do not click on “NOW” it will wrongly publish the post date & time

    example of what happens:
    we published the post at “September 16, 2020 09:09 pm” in our city.

    but unfortunately the post published at: “September 16, 2020 10:09 am”

    pls note that the server date & time and location are correct.

    thanks

    we are using this code now:

    add_action( ‘acf/save_post’, ‘set_submit_time’ );
    function set_submit_time($post_id) {
    update_field(‘entry_post_date’, date(‘Y-m-d H:i:s’), $post_id);
    }

    add_action(‘save_post’, ‘change_content’);
    global $post;
    global $wpdb;
    function change_content($post_id) {
    $datefield = get_post_meta($post_id,’entry_post_date’,true);
    $post_date = date(“Y-m-d H:i:s”, strtotime($datefield));
    $my_post = array();
    $my_post[‘ID’] = $post_id;
    $my_post[‘post_date’] = $post_date;

    remove_action(‘save_post’, ‘change_content’);
    wp_update_post( $my_post );
    add_action(‘save_post’, ‘change_content’);
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.