How to programmatically set the user timezone I am programmatically creating a user and wanted to assign a timezone for the user 

I am able to successfully create a user by the following code

$user = \Drupal\user\Entity\User::create();
$user-&gt;setPassword('1233455');
$user-&gt;enforceIsNew();
$user-&gt;setEmail($item['Home - Email']);
$user-&gt;setUsername($item['First Name']);


How do I assign the timezone?
You can use Set method on user Entity like the following:

$user = \Drupal\user\Entity\User::create();
$user-&gt;setPassword('1233455');
$user-&gt;enforceIsNew();
$user-&gt;setEmail($item['Home - Email']);
$user-&gt;setUsername($item['First Name']);
//- Set Time Zone to London 
$user-&gt;set('timezone','Europe/London');
$user-&gt;save();


NOTE : You can set other fields with set method, for example if you can activate the user with $user-&gt;set('status',1); or give him administrator role with $user-&gt;set('roles',['administrator']); .