How to Get Dob Value by the customer id Magento 2?

You can retrieve the date of birth (dob) value by the customer id or email in Magento 2. Birthdate value needs to disable by default so you can’t able to see on the register page.

You can enable it from the Configuration setting to display the Dob field in the Customer Registration page.

Dob returns the date value as Y-m-d(1990-10-10) format.

Retrieve the DOB value by template,
$customerId = “5”;
echo $countryName = $this->getCustomerDob($customerId);

Output:
1990-10-10 (If Dob is set from the backend)

One Reply to “How to Get Dob Value by the customer id Magento 2?”

Leave a Reply