共用方式為


SPRegionalSettings.GlobalTimeZones Property

Gets the time zones that are recognized on the server that is running SharePoint Foundation.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared ReadOnly Property GlobalTimeZones As SPTimeZoneCollection
    Get
'Usage
Dim value As SPTimeZoneCollection

value = SPRegionalSettings.GlobalTimeZones
public static SPTimeZoneCollection GlobalTimeZones { get; }

Property Value

Type: Microsoft.SharePoint.SPTimeZoneCollection
An SPTimeZoneCollection object that represents the time zones that are recognized on the SharePoint Foundation server. This list of time zones is different from the Windows Server time zones.

Examples

The following code example displays all the time zones defined in SharePoint Foundation.

Dim timeZonesList As SPTimeZoneCollection = SPRegionalSettings.GlobalTimeZones
Dim timeZone As SPTimeZone

For Each timeZone In  timeZonesList
    Console.WriteLine(("Time Zone: " + timeZone.Description))
Next timeZone
SPTimeZoneCollection collTimeZonesAvailable = SPRegionalSettings.GlobalTimeZones; 

foreach (SPTimeZone oTimeZoneAvailable in collTimeZonesAvailable) 
{
    Console.WriteLine("Time Zone: " + oTimeZoneAvailable.Description);
} 

See Also

Reference

SPRegionalSettings Class

SPRegionalSettings Members

Microsoft.SharePoint Namespace