I want a date and time format as this

$aWebOrder->OrderCreationDate  = '2012-11-08 12:00:00';

what i am doing is this:

$aWebOrder->OrderCreationDate    = $order->getCreatedAt();

I have tried to fix this but no success i just get a weird value which looks like is stamping only the seconds. Anyone experienced same issue? Thank you

2 Answers 2


Actually type of created_at column of sales_flat_order table is datetime, and $order->getCreatedAt() should return formatted datetime. You can try this one also:


When I do the following:

$order = Mage::getModel('sales/order')->getCollection()->getFirstItem();    

It returns:

string(19) "2013-03-28 12:31:17"

Perhaps, then, you have the following issues:

  • Mage_Sales_Model_Order is subclassed and is providing a concrete getCreatedAt method (as opposed to the method being magic)
  • Your data stored in the created_at column for the order in question actually has a Unix timestamp or some other data? This may hint at an illegal schema change.

To test if the model is subclassed, echo out get_class($order) - remove the rewrite if the model has been rewritten to diagnose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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