How to match exact day with the database?

I had created the post 2 days before, however, the date is showing but I want to add the Monday when the post is published on site, this is my code:

$query = "SELECT * FROM posts WHERE post_id = $the_post_id ";
            $select_all_posts_query = mysqli_query($connection, $query);
            while ($row = mysqli_fetch_assoc($select_all_posts_query)){
              
                $post_title = $row['post_title'];
                $post_author = $row['post_author'];
                $post_date = $row['post_date'];
}

Then I called this over here in bootstap code -
<p><span class="glyphicon glyphicon-time"></span><?php echo $post_date; ?></p>

// I want to add a day when this post is published, just after the date.
Format: 30-1-2017, Saturday

Kindly help :wave:

http://php.net/date

Somewhat similar, you could try using the MySQL DATE_FORMAT function.
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format

It would mean you would need to SELECT the individual fields instead of using “*”
(which IMHO you should probably be doing anyway)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.