From 666de311efc13ea07abdaf2d3b74b5b3bc5eec26 Mon Sep 17 00:00:00 2001 From: Mohamad Damaj Date: Wed, 28 Jun 2023 22:04:52 +0300 Subject: [PATCH] Fix blog order --- site/blog/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/blog/index.php b/site/blog/index.php index ce12c5a..b5b7cbd 100644 --- a/site/blog/index.php +++ b/site/blog/index.php @@ -26,9 +26,9 @@ $items = iterator_to_array($xml->channel->item); // Sort the items by pubDate usort($items, function($a, $b) { - $a_time = DateTime::createFromFormat('D, d M Y H:i:s O', $a->pubDate)->getTimestamp(); - $b_time = DateTime::createFromFormat('D, d M Y H:i:s O', $b->pubDate)->getTimestamp(); - return $b_time - $a_time; + $a_time = strtotime($a->pubDate); + $b_time = strtotime($b->pubDate); + return $a_time - $b_time; }); // Debugging foreach ($items as $item) {