skip to Main Content

I want to change date format in my PHP MySQL but could not change.

echo ($row->PasscreationDate);?> 

PasscreationDate is the date I want to change it appear default as YYYY-MM-DD HH-MM-SS, I want to change that date format as DD-MM-YYYY.

2

Answers


  1. You can try

    echo date('D-M-Y', strtotime($row->PasscreationDate));
    
    Login or Signup to reply.
  2. Have you tried date_format?

    Example:

    <?php
    $date = date_create('2000-01-01');
    echo date_format($date, 'd-m-Y');
    ?>
    

    Source: https://www.php.net/manual/datetime.format.php

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search