If your Magento is not configured to use the double option (email confirmation) to register customers, you can use what is already posted on @PauGNU:
$created_at = $customer->getCreatedAt();
But when it comes to double selection, Magento immediately creates a client account, that is, sets created_at
to the current system time, but does not activate it (so that the client cannot log in before confirmation) and sends a confirmation mail.
This means an unplanned delay (minutes, days, weeks, etc.) between created_at
and the very first login, so created_at
will no longer be used.
Actually, Magento has a place where the user login is tracked by default: the table field log_customer.login_at
, available, for example, Mage_Log_Model_Customer
.
But if you plan to use it:
- By default, the class has no way to get the very first login. You will need to develop this yourself.
- If Log Cleanup is active (to save the database less), you will lose the saved logon times.
In this case, I would prefer to identify the most suitable event, connect to it and save only the first login time for each client in a separate table.
source share