• Resolved mrkizg

    (@mrkizg)


    Hi, is it possible to display invoice date and time, default is only date in format dd/mm/yyyy and I need dd/mm/yyyy, HH:mm.
    Where could I change this?

    Thanks and best regards

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! By default, the plugin takes the WordPress date settings, if you want to override this, you co do that with a code snippet:

    
    add_filter( 'wpo_wcpdf_date_format', 'wpo_wcpdf_date_format', 10, 2 );
    function wpo_wcpdf_date_format( $date_format, $document ) {
    	return 'd/m/Y, H:i:s';
    }
    

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Hope that helps!

    Ewout

    Thread Starter mrkizg

    (@mrkizg)

    It works, thank you very much, it is just what we need.

    Is is possible to extend this function (to set same date and time format) to order date?
    Thanks you

    Plugin Contributor Ewout

    (@pomegranate)

    Sure – it’s another filter:

    
    add_filter( 'wpo_wcpdf_order_date', 'wpo_wcpdf_order_date_format', 10, 3 );
    function wpo_wcpdf_order_date_format( $order_date, $order_date_mysql, $document ) {
        return date_i18n( 'd/m/Y, H:i:s', strtotime( $order_date_mysql ) );
    }
    

    Hope that helps. Have a fantastic weekend!

    Ewout

    Cool! Thanks you

    hi

    consider how to change format of invoice_date too … …

    :-/

    sorry! what a fool I am
    solution is above, thanks!

    kustomservices

    (@kustomservices)

    I’m looking at an issue with this as well. The order in the admin console shows June 3, 2018 at 7:38 but then when I click on “Print Invoice” it says: 04/06/2018
    It moved the date ahead and formatted it d/m/yyyy

    You can see an example here:https://cl.ly/s5TD

    Plugin Contributor Ewout

    (@pomegranate)

    @kustomservices judging from the screenshot I don’t think that’s an invoice generated by our plugin, which also doesn’t have a ‘Print invoice’ button (it would say “PDF Invoice”). Can you double check the invoice plugin that you are using? This forum is for “WooCommerce PDF Invoices & Packing Slips”. It also uses the WordPress date format by default already (so should be the same across the board) although the invoice date may be different from the order date, depending when they were created (doesn’t have to be the same day).

    kustomservices

    (@kustomservices)

    You’re right. There are two plugins on this particular site and I mixed up the support contacts. Thanks.

    wow,working great

    Thanks

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Date format on Invoice’ is closed to new replies.