WRONG TIME DISPLAY
Display universal time but not with the time zone set in wordpress, how can you fix?
Can you tell me which column you’re talking about?
Aside from if we’re going to change anything about the column, you can always alter the value to display what you want by using this hook:
https://github.com/codepress/admin-columns-hooks/blob/master/ac-column-value.php
I used the field Woocommerce -> Date -> Created
We take the timestamp from the WC Order and map this to a display Date.
I believe the date is stored as a GMT date in the database.
If you want to map it to another timezone or display you can alter the value yourself with a hook:
https://github.com/codepress/admin-columns-hooks/blob/master/ac-column-value.php
The base snippet for this specific columns could look something like this:
function ac_column_wc_date_value( $value, $id, AC\Column $column ) {
if( $column instanceof ACA\WC\Column\ShopOrder\OrderDate ){
$value = wp_date( 'd-m-y H:i:s', $column->get_raw_value( $id ) );
}
return $value;
}
add_filter( 'ac/column/value', 'ac_column_wc_date_value', 10, 3 );
What i do show the time to UTC+1 , tell me?
The WP_date method should exactly that.
Or you could use the WooCommerce methods to display the date as it automatically takes the Timezone settings into account.
wc_get_order( $id )->get_date_completed()->date_i18n( 'Y-m-d H:i:s')
i dont understand what i do, please tell step by step what i do. Thanks
You can copy-paste the snippet I posted before (the multi-line snippet) and paste it in a place where you manage your custom code. If you have a custom theme, you could paste it at the end of the function.php file in the root of your theme. If you don’t know how to implement hooks on your website, I recommend hiring a developer who can do that for you.
i add the snippet in the functions.php file of child theme, but after i add this snippet in the orders backend dont show the date
You must be logged in to reply to this topic.