Title: Incorrect time/date
Last modified: September 22, 2020

---

# Incorrect time/date

 *  Resolved [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/)
 * Publication time on AMP version is +2h forward vs real publication time – could
   you please check is it bug?
 * For example:
    [https://mobirank.pl/2020/09/22/najnowsze-dane-z-okazji-dnia-bez-samochodu/](https://mobirank.pl/2020/09/22/najnowsze-dane-z-okazji-dnia-bez-samochodu/)–
   here publication time is 6:25 CET but on [https://mobirank.pl/2020/09/22/najnowsze-dane-z-okazji-dnia-bez-samochodu/amp/](https://mobirank.pl/2020/09/22/najnowsze-dane-z-okazji-dnia-bez-samochodu/amp/)
   at 7:25 CET is displayed 3 hours ago.. it should be 1 hour ago
 * Thx in advance
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fincorrect-time-date%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436836)
 * This issue was supposed to be fixed in 2.0.3 via this pull request: [https://github.com/ampproject/amp-wp/pull/5335](https://github.com/ampproject/amp-wp/pull/5335)
 * What timezone is your WordPress install set to?
 * Do you have any `get_the_date` or `get_post_time` filters added?
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436840)
 * The Schema.org metadata indicates the `publishedDate` is `2020-09-22T04:25:00
   +00:00`. The post says “3 GODZINY TEMU” (3 hours ago). The current time at this
   moment is `2020-09-22T05:33:19.702Z`. So indeed, it should have been 1 hour not
   3.
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436844)
 * Should I check/do something or do you fix it in the future? Thx!
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436846)
 *     ```
       	<time datetime="<?php echo esc_attr( date( 'c', $this->get( 'post_publish_timestamp' ) ) ); ?>">
       		<?php
       		echo esc_html(
       			sprintf(
       				/* translators: %s: the human-readable time difference. */
       				__( '%s temu', 'amp' ),
       				human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp' ) )
       			)
       		);
       		?>
       	</time>
       ```
   
    -  This reply was modified 6 years ago by [Łukasz](https://wordpress.org/support/users/lumay/).
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436851)
 * I just tried to reproduce the issue by setting my timezone to Warsaw, and when
   I publish a post it says “X seconds ago” rather than “2 hours ago”.
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436858)
 * OK I’ve changed code because I’ve got old code in wp-content/theme/my-theme/amp
 * Should I change my amp files in theme catalogue after every update?
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436859)
 * I see. It looks like your custom template is not correct. Please update `human_time_diff()`
   call to be as follows:
 * [https://github.com/ampproject/amp-wp/blob/c6312571e38b0b27258eacfd70cec410e9569ba0/templates/meta-time.php#L29](https://github.com/ampproject/amp-wp/blob/c6312571e38b0b27258eacfd70cec410e9569ba0/templates/meta-time.php#L29)
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436862)
 * With this code is OK:
 *  `<time datetime=”<?php echo esc_attr( gmdate( ‘c’, $this->get( ‘post_publish_timestamp’)));?
   >”>
    <?php echo esc_html( sprintf( /* translators: %s: the human-readable time
   difference. */ __( ‘%s temu’, ‘amp’ ), human_time_diff( $this->get( ‘post_publish_timestamp’),
   time() ) ) ); ?> </time>`
 * I’ve deleted timestamp from this: `current_time( 'timestamp' )` and time is Ok
   now
    -  This reply was modified 6 years ago by [Łukasz](https://wordpress.org/support/users/lumay/).
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436868)
 * Or you could just replace `current_time( 'timestamp' )` with `current_time( '
   timestamp', true )`.
 * The issue is that without the second parameter of `true`, a non-GMT/UTC timestamp
   value is returned.
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436871)
 * Thank you! I’ve got translated meta-time.php in my theme folder – should I chanege
   every copied files from new update?
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436872)
 * It appears you forked the `meta-time.php` template from before 1.5. In that release,
   we fixed the usage of `current_time()`: [https://github.com/ampproject/amp-wp/commit/39473e393dba20af83136f4fef8fa4eb70db58f2](https://github.com/ampproject/amp-wp/commit/39473e393dba20af83136f4fef8fa4eb70db58f2)
 * But since you forked the template, you didn’t get the update.
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436879)
 * Generally the legacy AMP templates are not updated each new release, so you shouldn’t
   have to do that. But it’s not a bad idea to double-check.
 * In 2.0.1 we reduced one area where forked templates would need to make updates
   to a forked `style.php` stylesheet: [https://github.com/ampproject/amp-wp/pull/5282](https://github.com/ampproject/amp-wp/pull/5282)
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436888)
 * OK thx
    When I replace `current_time( 'timestamp' )` with `current_time( 'timestamp',
   true )`. there is
 * Parse error
    : syntax error, unexpected ‘;’, expecting ‘)’ in /wp-content/themes/
   leaf/amp/meta-time.php on line 18
 * W witrynie wystąpił błąd krytyczny.
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436898)
 * It looks like you removed the second closing parenthesis.
 * You can make the whole line look like this:
 * `human_time_diff( $this->get( 'post_publish_timestamp' ), time() )`
 * Just copy what is shown here: [https://github.com/ampproject/amp-wp/blob/c6312571e38b0b27258eacfd70cec410e9569ba0/templates/meta-time.php#L29](https://github.com/ampproject/amp-wp/blob/c6312571e38b0b27258eacfd70cec410e9569ba0/templates/meta-time.php#L29)
 *  Thread Starter [Łukasz](https://wordpress.org/support/users/lumay/)
 * (@lumay)
 * [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436916)
 * OK thx with `current_time( 'timestamp', true )` is ok too
    Thx [@westonruter](https://wordpress.org/support/users/westonruter/)
   so much for your quick help!!!
 *     ```
       <?php
       /**
        * Post date template part.
        *
        * @package AMP
        */
   
       ?>
       <div class="amp-wp-meta amp-wp-posted-on">
       	<time datetime="<?php echo esc_attr( gmdate( 'c', $this->get( 'post_publish_timestamp' ) ) ); ?>">
       		<?php
       		echo esc_html(
       			sprintf(
       				/* translators: %s: the human-readable time difference. */
       				__( '%s ago', 'amp' ),
       				human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp', true ) )
       			)
       		);
       		?>
       	</time>
       </div>
       ```
   

Viewing 15 replies - 1 through 15 (of 15 total)

 The topic ‘Incorrect time/date’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [hour](https://wordpress.org/support/topic-tag/hour/)
 * [time](https://wordpress.org/support/topic-tag/time/)

 * 15 replies
 * 2 participants
 * Last reply from: [Łukasz](https://wordpress.org/support/users/lumay/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/incorrect-time-date/#post-13436916)
 * Status: resolved