How change timezone of a meta key type date before the query in wordpress?

I've been trying for days without success. I need change the timezone before the comparision.

The value of meta data:

Mi code:

add_filter('parse_query', 'query_get_eventDay');

function query_get_eventDay($query){

$eventDay = (isset($_GET['eventDay'])  $_GET['eventDay']) ? $_GET['eventDay'] : '';

$args = array(
                    'post_type' = 'eventos',
                    'meta_key' = 'trans_start_time_utc', //I need change the time zone in the value of this meta key, before the comparision
                    'orderby' = 'meta_value_num',
                    'order' = 'ASC',
                    'meta_query' = array(
                        array(
                            'key' = 'trans_start_time_utc',
                            'value' = $eventDay, // I get value in format 2021-07-25 from jquery UI calendar
                            'compare' = 'IN',
                            'type' = 'date'
                        )
                    )
                );

$query-set('meta_query', $args);

}

I need change the timezone in the value of trans_start_time_utc with this:

$timezone_name = $_COOKIE['localDateZone']; // returns America/Mexico City for example.

In the end I get a wrong comparison on the dates :(

any help is welcome. Thanks

Topic wp-query php timezones plugins Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.