Blog

23 de March de 2024

How long has it been updated?

Há quanto tempo foi atualizado?

Para ser mostrado quanto tempo tem decorrido desde a última atualização de um post no WordPress, utilizamos usar a função em PHP “human_time_diff()". This function returns a formatted string that represents the time interval between the current date and time and the date and time of the last post update.

Here is an example of how you can use this function:

<?php
    $last_update = get_the_time('U');
    // Obtém a data e hora da última atualização do post em formato UNIX
    
    $time_diff = human_time_diff($last_update, current_time('timestamp'));
    // Calcula a diferença de tempo em uma string formatada

    echo "Este post foi atualizado há $time_diff";
?>
Share:
Others

Tips

Usando Random

Using Random

View more

O que é Senha Forte?

What is Strong Password?

View more

ShortCode

ShortCode

View more