0

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?

0

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>')));

Ref: http://php.net/manual/en/function.strftime.php

  • Nope, still today date – Andrew Sh Jan 15 '18 at 6:12
  • See my updated answer – PY Yick Jan 15 '18 at 7:27
  • Sorry, but it's the same as I did. Currently it's working as is, but I want to get rid of load/save order in loop and move it to the createOrder function to speed up this script a little. – Andrew Sh Jan 15 '18 at 7:51
  • I don't think you can prevent it in your case. – PY Yick Jan 15 '18 at 9:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.