Support » Plugin: Flexible PDF Invoices for WordPress » Change date format

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support tomasz_bednarek

    (@tomasz_bednarek)

    Hi Catherine,

    thank you for your message!

    By default, the plugin shows the date format as Y-m-d (e.g. 2020-07-20)

    You may change it by editing your custom invoice template:

    For the date of sale you may change the date format by changing this code line:

    <?php echo $invoice->getDateOfSale(); ?>

    to:

    <?php $dateOfSale = new DateTime($invoice->getDateOfSale());
    $dateOfSaleFormatted = $dateOfSale->format('d/m/Y');
    echo $dateOfSaleFormatted; ?>

    or even simpler:

    <?php echo DateTime::createFromFormat('Y-m-d', $invoice->getDateOfSale())->format('d/m/Y'); ?>

    You may add similar changes for getDateOfIssue and getDateOfPay.

    I hope it will be helpful.

    Best regards,

    Perfect – thanks πŸ™‚

    Plugin Support tomasz_bednarek

    (@tomasz_bednarek)

    Hi Catherine,

    thank you for your reply!

    I am glad it did the job πŸ™‚

    If you have more questions, let me know.

    Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change date format’ is closed to new replies.