[RESOLU] date au format ISO 8601 timestamp api instagram en Français

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [RESOLU] date au format ISO 8601 timestamp api instagram en Français

Re: date au format ISO 8601 timestamp api instagram en Français

par Pierre-Yves-35510 » 02 nov. 2020, 23:17

Merci pour la réponse très rapide. Je n'ai pas réussi à installer la solution ci-dessus mais celle-ci m'a permis de continuer mes recherches.
J'ai finalement réussi en utilisant la formule suivante : echo date("d/m/Y", strtotime("$timestamp")), "\n";
Merci encore, très Cordialement,
voici un extrait de mon code pour info:
<div class='ig_post_container2'>";
if($media_type=="VIDEO"){
echo "<video controls style='width:100%; display: block !important;'>
<source src='{$media_url}' type='video/mp4'>
Your browser does not support the video tag.
</video>";
}
else{
echo "<a href='{$permalink}'target='_blank'><img src='{$media_url}' /></a></br>;
}
echo date("d/m/Y", strtotime("$timestamp")), "\n";
echo "</div>

Re: date au format ISO 8601 timestamp api instagram en Français

par or 1 » 02 nov. 2020, 15:02

date au format ISO 8601 timestamp api instagram en Français

par Pierre-Yves-35510 » 02 nov. 2020, 14:53

Bonjour, je recherche depuis longtemps dans tous les sens et n'arrive pas à afficher la date tout simplement en Français et non au format unix iso ISO 8601. (je trouve l'inverse partout !)
Je vous remercie d'avance, Cordialement, Pierre-Yves

(voici un extrait de mon code API instagram )

echo "<div class='ig_feed_container'>";
foreach($contents["data"] as $post){

$username = isset($post["username"]) ? $post["username"] : "";
$caption = isset($post["caption"]) ? $post["caption"] : "";
$media_url = isset($post["media_url"]) ? $post["media_url"] : "";
$permalink = isset($post["permalink"]) ? $post["permalink"] : "";
$media_type = isset($post["media_type"]) ? $post["media_type"] : "";
$timestamp = isset($post["timestamp"]) ? $post["timestamp"] : "";

echo "
<div class='ig_post_container'>
<div class='ig_post_container2'>";
if($media_type=="VIDEO"){
echo "<video controls style='width:100%; display: block !important;'>
<source src='{$media_url}' type='video/mp4'>
Your browser does not support the video tag.
</video>";
}
else{
echo "<a href='{$permalink}'target='_blank'><img src='{$media_url}' /></a>";
}
echo "</div>
<div class='ig_post_details'>
<div>
<img src='//www.aupied.net/images/instagram3BC.png' alt='instagram' style='width:80px;height:22px;'></br>
<strong>@{$username}</strong>
</br>
</br>
</div>
<div>
<strong>{$caption}</strong>
</div>
<div>
{$timestamp} // <------- AFFICHE ICI UNIQUEMENT AU FORMAT ISO
</div>
</div>
</div>
";
}
echo "</div>"
?>
</div>