0

is there any way to check how old customer in terms of registration like one year old customer like that or we have to write code for the same

$d1 = new DateTime(date('Y-m-d',Mage::getModel('customer/customer')->load(4)->getCreatedAtTimestamp())); $d2 = new DateTime(); echo $yeardifference = $d2->diff($d1); 

but i give blank value

1 Answer 1

1

Your code is fine, please make these changes it should return your result

$yeardifference = $d1->diff($d2); echo $yeardifference->format('%a days'); 

This will return the difference in days. You can use other formats available on your php manual. Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.