0

I've exported reviews from mysql db in a csv format, and I've included created_at field. Now, when I open CSV file, date is in following format: 2014-02-04 13:31:43. So, I now want to import those reviews into different website, and everything works except for created_at date, for which I'm using following code:

// $_row['created_at'] = '2014-02-04 13:31:43';
// $_review is the object I created with
// $_review = Mage::getModel('review/review');
$_created_at = Mage::helper('core')->formatDate($_row['created_at'], 'medium', false);
$_review->setCreatedAt($_created_at);

but that doesn't set created_at properly. What's the correct way of achieving this?

2
  • does $_created_at has value? Commented Feb 21, 2017 at 10:33
  • Yes, string(12) "4. feb. 2014". Commented Feb 21, 2017 at 10:45

1 Answer 1

1

Try this ...

$createdtime = new Zend_Date(strtotime($_row['created_at']));
$_created_at = Mage::getModel('core/date')->date('M d, Y', $createdtime);
$_review->setCreatedAt($_created_at);
Sign up to request clarification or add additional context in comments.

1 Comment

Nope. Still creates a date as if I used time();

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.