dazzclub Posted April 2, 2009 Share Posted April 2, 2009 Hi all, i would like to display my date as day.month.year, ie (my birthday) 29.10.82 here is what i have got so far; function InTheNews() { global $dbc; $query = "SELECT id,title, content,date FROM news_headlines ORDER BY id"; $result = mysqli_query ($dbc, $query)or die(mysqli_error() . "<p>With query:<br>$query"); while ($row = mysqli_fetch_array($result)) //need to format the date on this function $date = $row['date']; { //get NewsID echo "<div class=\"headline\"> <a href=\"news_article.php?news_article=$row[id]\">$row[title]</a> <span class=\"date_of_article\">".date("m.d.y","$date")."</p> <p>$row[content]</p> </div> "; } } Any help would be great Link to comment https://forums.phpfreaks.com/topic/152238-solved-formatting-the-date/ Share on other sites More sharing options...
Salkcin Posted April 2, 2009 Share Posted April 2, 2009 date("m.d.y", strtotime($date)) Link to comment https://forums.phpfreaks.com/topic/152238-solved-formatting-the-date/#findComment-799444 Share on other sites More sharing options...
dazzclub Posted April 2, 2009 Author Share Posted April 2, 2009 Thank you Salkcin Link to comment https://forums.phpfreaks.com/topic/152238-solved-formatting-the-date/#findComment-799503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.