1
I’m displaying a date of a post I’m pulling from instagram, but it displays like this:
Thu, 26 Sep 2019 13:47:05 GMT
It ta resulting in English names of each day of the week, but I want to remove it and take the name of the month 'Sep' and leave only the number of the month along with the date and remove the word GMT, would be equal:
26/09/2019 h:13:47:05
What I tried was:
<?php
$instaResult = simplexml_load_file('https://rss.app/feeds/wUySUmu0Kiy1c3uL.xml', NULL, LIBXML_NOCDATA) or die("error");
$instagram_photos = $instaResult->channel->item[0]->enclosure['url'];
//data da publicacao
$instagram_date = $instaResult->channel->item[0]->pubDate;
//Trocando nome do mes de ingles para portugues
echo str_replace("Thu", "Quinta", $instagram_date);
// descricao do instagram
$instagram_description = htmlentities((string)$instaResult[0]->channel->item[0]->description);
echo "</br>";
$result = trim(strip_tags(str_replace(array("<![CDATA[","]]>"),array("",""),(string)$instaResult[0]->channel->item[0]->description)));
echo $result;
echo "<meta http-equiv='refresh' content='1800'; url='index.php'>"; //atualiza a cada 30 minutos
echo "<link rel='stylesheet' type='text/css' href='style.css?version=700'>";
echo "<div class='fundo'>";
echo "</div>";
// DEFINE O FUSO HORARIO COMO O HORARIO DE BRASILIA
date_default_timezone_set('America/Sao_Paulo');
// CRIA UMA VARIAVEL E ARMAZENA A HORA ATUAL DO FUSO-HORÀRIO DEFINIDO (BRASÍLIA)
$hour = (int)date('G');
if ($hour >= 0 && $hour < 10)
{
// 00:00 até 09:59
$resp = "<img class='logo' src='logo.jpg' alt=''/>";
}
else
{
// 10:00 até 23:59
$resp = "<img class='img-responsive' src='{$instagram_photos}'/>";
}
echo $resp;
?>
If you can help me, I’d appreciate it!
Thank you very much! It helped me a lot!
– jose113