Title: Order Date incorrect
Last modified: October 31, 2023

---

# Order Date incorrect

 *  [radial](https://wordpress.org/support/users/radial/)
 * (@radial)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/order-date-incorrect/)
 * I just noticed, in my woocommerce, an order is stated there it was made on 10/
   29/2023. however in this plugin print invoice and print receipt page it generates,
   it states the order date is 10/30/2023. i think the plugin is using the server
   timezone. maybe it should use the wordpress configured time zone. I think you
   could change in the file includes\wcdn-template-functions.php the function wcdn_get_order_info
 * where it says:
 *     ```wp-block-code
       $fields['order_date'] = array(
           'label' => __( 'Order Date', 'woocommerce-delivery-notes' ),
           'value' => date_i18n( get_option( 'date_format' ), strtotime( $wdn_order_order_date ) ),
       );
       ```
   
 * 
   replace it with:
 *     ```wp-block-code
       // Get the WordPress timezone
       $timezone = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
   
       // Convert the order's date to the WordPress timezone
       $order_date_object = new DateTime( $wdn_order_order_date, new DateTimeZone( 'UTC' ) );
       $order_date_object->setTimezone( new DateTimeZone( $timezone ) );
       $order_date_formatted = $order_date_object->format( get_option( 'date_format' ) );
   
       $fields['order_date'] = array(
           'label' => __( 'Order Date', 'woocommerce-delivery-notes' ),
           'value' => $order_date_formatted,
       );
       ```
   
 * note that chatgpt helped make that change above, so please check it for yourself
   to see it it is good.
    -  This topic was modified 2 years, 7 months ago by [radial](https://wordpress.org/support/users/radial/).
    -  This topic was modified 2 years, 7 months ago by [radial](https://wordpress.org/support/users/radial/).

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

 *  Thread Starter [radial](https://wordpress.org/support/users/radial/)
 * (@radial)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/order-date-incorrect/#post-17188278)
 * I have not yested this yet, but this might work if you put it into functions.
   php to override the bugged code
 *     ```wp-block-code
       function custom_fix_order_date_timezone($fields, $order_id) {
           // Get the order creation date in the server's timezone
           $wdn_order_order_date = get_post_field('post_date', $order_id, 'raw');
   
           // Get the WordPress timezone
           $timezone = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
   
           // Convert the order's date to the WordPress timezone
           $order_date_object = new DateTime($wdn_order_order_date, new DateTimeZone('UTC'));
           $order_date_object->setTimezone(new DateTimeZone($timezone));
           $order_date_formatted = $order_date_object->format(get_option('date_format'));
   
           $fields['order_date'] = array(
               'label' => __('Order Date', 'woocommerce-delivery-notes'),
               'value' => $order_date_formatted,
           );
   
           return $fields;
       }
   
       add_filter('wcdn_get_order_info', 'custom_fix_order_date_timezone', 10, 2);
       ```
   
 *  [nick1122](https://wordpress.org/support/users/nick1122/)
 * (@nick1122)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/order-date-incorrect/#post-17189198)
 * Hi Radial,
   I have checked the issue in our site, and the plugin appears to be
   working fine with order date.Please create the ticket [here](https://tychesoftwares.freshdesk.com/support/login)
   on our support tool so that we can communicate in detail. Additionally, please
   provide more information about the error and in which order template you are 
   getting the date error.Regards,Nikhil.
 *  Thread Starter [radial](https://wordpress.org/support/users/radial/)
 * (@radial)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/order-date-incorrect/#post-17189469)
 * fyi i think the code snippet i posted above doesnt work, and i dont see how i
   can delete that. what does work is the initial code modification i posted in 
   the OP.
 * I have opened a ticket for you on your portal and included a video of the issue
   thanks
    -  This reply was modified 2 years, 7 months ago by [radial](https://wordpress.org/support/users/radial/).

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

The topic ‘Order Date incorrect’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-delivery-notes/assets/icon-256x256.jpg?rev=2829362)
 * [Print Invoice & Delivery Notes for WooCommerce](https://wordpress.org/plugins/woocommerce-delivery-notes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-delivery-notes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-delivery-notes/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-delivery-notes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-delivery-notes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-delivery-notes/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [radial](https://wordpress.org/support/users/radial/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/order-date-incorrect/#post-17189469)
 * Status: not resolved