Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
order_from_past.php
Go to the documentation of this file.
1 <?php
7 
9 $orderRepository = $objectManager->create(\Magento\Sales\Api\OrderRepositoryInterface::class);
11 $dateTime = $objectManager->create(\Magento\Framework\Stdlib\DateTime\DateTimeFactory::class)
12  ->create();
14 $order = $objectManager->create(Magento\Sales\Model\Order::class)->loadByIncrementId('100000001');
15 $newOrderCreatedAtTimestamp = $dateTime->timestamp($order->getCreatedAt()) - 864000;
17 $order->setCreatedAt($newOrderCreatedDate);
$objectManager
$newOrderCreatedAtTimestamp
$newOrderCreatedDate
$orderRepository
$dateTime