Time on the desktop is correct: enter image description here

This is how it shows the right time, namely 10-47 (file in the root of the site on WordPress locally):

<?php //require_once( 'wp-load.php' ); echo date("Hi"); 

When you connect api WordPress:

 <?php require_once( 'wp-load.php' ); echo date("Hi"); 

the time is three hours less: 7-47

Where can I fix it? enter image description here enter image description here

    2 answers 2

    In the site console Settings - General

    enter image description here

    After connecting the kernel, you need to use the built-in WordPress function current_time() . The second parameter of this function allows you to get GMT time or local. Here is an example that illustrates this:

     <?php echo 'Время php: ' . date( 'Hi' ) . '<br>'; require_once '../wp-load.php'; echo 'Время php после подключения WP: ' . date( 'Hi' ) . '<br>'; echo 'Время WP GMT: ' . current_time( 'H-i', 1 ) . '<br>'; echo 'Время WP local: ' . current_time( 'H-i', 0 ) . '<br>'; 

    Result:

     Время php: 12-24 Время php после подключения WP: 09-24 Время WP GMT: 09-24 Время WP local: 12-24 

    You can check on the test site page http://test.kagg.eu/so/891232.php

    • put Kiev, but nothing has changed - Sergey
    • You must have the current time correct. This is how it is in my picture. - KAGG Design
    • @ KAGG Design added screenshots - Sergey
    • Completed the answer. - KAGG Design
    • And what prompted you to cancel the adoption of this answer as the right one? - KAGG Design

    WordPress may be changing the time zone. Try to track it:

     date_default_timezone_get( void ) 

    To set the desired time zone:

     date_default_timezone_set( string $timezone_identifier )