The SharePoint 2010 server is always set to a specific time zone. Users from all over the world can change the time zone by using “My regional settings”. I wanted to achieve this programmatically as a batch operation.
To do this, I have used the following code.
SPRegionalsettings spRegnal= new SPRegionalSettings(web, true); spRegnal.TimeZone.ID = 2 ; // Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London User.RegionalSettings= spRegnal ;
The SPRegionalSettings takes two parameters, the SPWeb and a Boolean. Set the time zone ID and finally get the SPUser object and assign the regional settings to that user.