Calculate the number of days since the creation date of a user account
This depends on what you need to do with it.  If you truly just need the number of days, then this will work

$user = \Drupal::currentUser();
$created = new \DateTime('@' . $user-&gt;getAccount()-&gt;getCreatedTime());
$interval = $created-&gt;diff(new \DateTime());
$days1 = $interval-&gt;d
$days2 = intval($interval-&gt;format('%d'));


Here $days1 and $days2 should give you the same value.  See the docs for \DateTime and \DateInterval for more information.

If you need a nifty string for output purposes, then check out DateFormatter::formatTimeDiffSince() and friends:

$user = \Drupal::currentUser();
$created = $user-&gt;getAccount()-&gt;getCreatedTime();
/** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
$date_formatter = \Drupal::service('date.formatter');
$created_since = $date_formatter-&gt;formatTimeDiffSince($created);


and then $created_since will be a string like '7 weeks 2 days'.  You can also use the 'Time ago' formatter directly in the entity rendering configuration.  The default view for the accounts listing does this.