1

I am trying to add a timestamp to the Date column of my WooCommerce Orders screen.

Timestamp is needed here!

Anybody know how I can do this? I am using WordPress 4.4.5. and WooCommerce Stable tag: 2.6.4.

techraf
  • 64,883
  • 27
  • 193
  • 198
  • Alright, I think I should post this at the WooCommerce support website...(an hour later). I posted here for some support: https://wordpress.org/support/topic/how-do-i-add-a-timestamp-to-the-date-column-of-my-woocommerce-orders-screen/ – Frankie 'Moodurian' Kam Oct 14 '16 at 04:08

2 Answers2

1

Well,simply by using a filter and little function

Here is the code to paste in functions.php in the theme folder to make this change:

add_filter( 'post_date_column_time' , 'woo_custom_post_date_column_time' );
function woo_custom_post_date_column_time( $post ) {       
        $h_time = get_post_time( __( 'd/m/Y', 'woocommerce' ), $post );
        return $h_time;
}
Smittey
  • 2,475
  • 10
  • 28
  • 35
  • That's the wrong filter for the WooCommerce Orders screen in WC 3.x. The correct filter is now woocommerce_admin_order_date_format. See my answer on the WP support forum: https://wordpress.org/support/topic/show-time-on-order-backend-broken-since-woo-3/#post-9697287 – Professor Falken Nov 18 '17 at 18:59
0

If you would like to print a timestamp, you can use this small pirce of code in your theme functions.php file or in your custom plugin:

add_action( 'manage_posts_custom_column', 'misha_date_clmn' );
function misha_date_clmn( $column_name ) {
    global $post;
    if( $column_name  == 'order_date' ) {

        echo strtotime( $post->post_date ) . '<br />';

    }

}

This code adds a timestamp just before the original date printed by WooCommerce. If you want to print timestamp INSTEAD the date, it is better to

  1. Remove default date column first, about WooCommerce column removals here

  2. Add a custom column with any information you need, a lot of examples here

Misha Rudrastyh
  • 866
  • 10
  • 16