Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I convert it to display as mm/dd/yy H:M (AM/PM) using PHP?

How can I convert it to display as mm/dd/yy H:M (AM/PM) using PHP?

Currently, the date comes out to me as such numbers
enter image description here

    $sql = "SELECT news_title, news_date, news_description, news_views, news_image FROM tbl_news ORDER BY id DESC" ;
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
     

         
    

    


                     ?>        

                            <div class="news-feed news-feed-post">
                                <div class="post-header d-flex justify-content-between align-items-center">
                                    <div class="image">
                                        <img src="assets/images/user/photo.png"  class="rounded-circle" alt="image">
                                    </div>
                                    <div class="info ms-3">
                                        <span class="name">test</span><img class=""  src="assets/images/user/Verified.png" "height="25px" width="25px"/>
                                        <span class="small-text">   <?php  echo " ".$row["news_date"]."  ";?>  </span>
                                    </div>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

echo date('Y/m/d H:i', $row['news_date']);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading