PHP Wordpress Datetime A non-numeric value encountered

Viewed 25

Good morning, I have the following error message in the log:

PHP Warning: A non-numeric value encountered in /var/www/html/wp-content/plugins/coworker/coworker.php on line 137,

I am trying to determine the time zone differences between Germany and UTC time. The result would be +2 Determine difference:

        $tz = 'Europe/Berlin'; // Our Timezone
        $tz_obj = new DateTimeZone($tz);
        $today = new DateTime("now", $tz_obj);
        $ts1 = $today->format($df); // local German Time
        $ts2 = gmdate($df); // UTC Time
        $ts3 = $ts1-$ts2; // Get the difference +2      

I add this time to my variable:

 $person_datum_api = date('Y-m-d H:i:s', strtotime($person_datum_aenderung. ' + ' . $ts3 . 'hours')); //Time from API + difference
1 Answers

Is Working fine, please check this link. http://tpcg.io/_8XDG2R

<?php
    $tz = 'Europe/Berlin'; // Our Timezone
    $df = 'Y-m-d H:i:s';
    $tz_obj = new DateTimeZone($tz);
    $today = new DateTime("now", $tz_obj);
    $ts1 = $today->format($df); // local German Time
    $ts2 = gmdate($df); // UTC Time
    $ts3 = $ts1-$ts2; // Get the difference +2 
    $person_datum_api = date('Y-m-d H:i:s', strtotime($person_datum_aenderung. ' + ' . $ts3 . 'hours')); //Time from API + difference
    echo $person_datum_api;
?>
Related