Share via


SPRegionalSettings.WorkDayStartHour Property

Gets or sets the default hour at which the work day starts on the calendar that is in use on the server.

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

Syntax

'Declaration
Public Property WorkDayStartHour As Short
    Get
    Set
'Usage
Dim instance As SPRegionalSettings
Dim value As Short

value = instance.WorkDayStartHour

instance.WorkDayStartHour = value
public short WorkDayStartHour { get; set; }

Property Value

Type: System.Int16

  • A 16-bit integer that specifies the default hour at which the work day starts.

Remarks

The following list shows possible values and the hours that they represent:

  • 0 - 12:00 AM

  • 60 - 1:00 AM

  • 120 - 2:00 AM

  • 180 - 3:00 AM

  • 240 - 4:00 AM

  • 300 - 5:00 AM

  • 360 - 6:00 AM

  • 320 - 7:00 AM

  • 480 - 8:00 AM

  • 540 - 9:00 AM

  • 600 - 10:00 AM

  • 660 - 11:00 AM

  • 720 - 12:00 PM

  • 780 - 1:00 PM

  • 840 - 2:00 PM

  • 900 - 3:00 PM

  • 960 - 4:00 PM

  • 1020 - 5:00 PM

  • 1080 - 6:00 PM

  • 1140 - 7:00 PM

  • 1200 - 8:00 PM

  • 1260 - 9:00 PM

  • 1320 - 10:00 PM

  • 1380 - 11:00 PM

Examples

The following code example sets the start time to 9 am and the end time to 6 pm in the regional settings of the root Web site.

Dim siteCollection As New SPSite("https://localhost")
Try
    Dim rootWebSite As SPWeb = siteCollection.RootWeb
    Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
    regionalsettings.WorkDayStartHour = 540
    regionalsettings.WorkDayEndHour = 1080

    rootWebSite.Update()
    rootWebSite.Dispose()
Finally
    siteCollection.Dispose()
End Try
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
    using(SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
    {
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings; 
        oRegionalSettings.WorkDayStartHour = 540; 
        oRegionalSettings.WorkDayEndHour = 1080; 
        oWebsiteRoot.Update(); 
    }
}

Note

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

See Also

Reference

SPRegionalSettings Class

SPRegionalSettings Members

Microsoft.SharePoint Namespace