Blogs

Time Zones in SharePoint

By Michael Doyle posted 06-06-2012 12:24

  

I recently had to deal with time zones for individuals across the world for their My Sites. Rather than letting people choose their time zone, the goal was to populate the field from a third party human resources app. The concept behind this was fairly straight forward. I would get the field into Active Directory and then use the User Profile Service to populate the Time Zone field. Then I dug into the Profile DB to find out what the values are. That is when I discovered that they are integers. This really didn’t help me since I didn’t know what the integers meant and had to do some digging to find out what the values were. The file that will help you decipher these integers is timezone.xml. It is located in the CONFIG directory in the SharePoint Hive. The version I have has 99 time zones in it. I was going to put an example of the whole file here but it took about 50 pages so I decided against it. Here is the first one along with the zero time zone and the header information.

<?xml version="1.0" encoding="utf-8"?>

<RegionalSettings>

  <TimeZones>

    <TimeZone ID="0" Name="(UTC) Universal Coordinated Time" Hidden="TRUE">

        <Bias>0</Bias>

    </TimeZone>

    <TimeZone ID="1" Name="(UTC) Greenwich Mean Time" Hidden="TRUE">

        <Bias>0</Bias>

        <StandardTime>

            <Bias>0</Bias>

            <Date>

                <Month>10</Month>

                <Day>5</Day>

                <Hour>2</Hour>

            </Date>

        </StandardTime>

        <DaylightTime>

            <Bias>-60</Bias>

            <Date>

                <Month>3</Month>

                <Day>5</Day>

                <Hour>1</Hour>

            </Date>

        </DaylightTime>

    </TimeZone>

 

So given this file you can map the integer to the time zone you want, but you are still going to need a translation table. If you are using the real version of FIM then you are in good shape. You can use FIM to do the translation for you and stick the integer value into Active Directory. If you want to go directly against the database then you will need to determine the property id for time zone which is located in the PropertyList of the Profile database (typically Profile DB). Once you find it you can update the UserProfileValue table (also in the Profile database). Note that updating the table directly is not supported but it may be the only way to accomplish the task. The other way is to write and app that updates Active Directory with the integer needed.



#zone #sharepoint #SharePoint #time
0 comments
313 views