I am exporting order data from woocommerce. For the order date, I am using:
// Get order
$order = wc_get_order($id);
// Get order date
$orderdate = $order->order_date;
Now the order date appears in de xml file as "2020-10-15 06:53:36". I would only like to display the date and not the time. I have tried adding format(‘Y-m-d’):
// Get order date
$orderdate = $order->format('Y-m-d')->order_date;
Doesnt work either.
2
Answers
You should make use of
get_date_created()
You should try
echo date('Y-m-d', strtotime($orderdate));