I'am developing order generating shell script for my developing needs, which allow to generate orders for any period. I've used this comment as template. Unfortunatelly, all orders has today created_at date. I can change this date after order was generated, but this is slow, because I need to load it first and save after. Is it possible to set created_at date before order generation?
On line 192 in your shell script,
$order->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
It will assign the create time as current time. If you need a specific time as a create time:
$order->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', strtotime('<your_date>')));