Showing Week Number to the Date Time Control in SharePoint

By default Date Time Field control will not show the week number on selecting the date / time. But SharePoint have hidden gem on displaying the week number, for this we no need to go for third party options.

This can be achieved by updating some settings from the Regional Settings page.

To update that settings to the specific web site,

  • Open the site in browser, where you want that that feature.
  • Click Setting icon, and click Site Settings
  • On the Settings page, click Region Settings under Site Administration
  • Enable the check box "Show week numbers in the Date Navigator" under Set your Calendar section

  • Click OK to update the settings to the site.
Output



The same settings can be achieve through below Server Object Model code,
  1. using (SPSite site = new SPSite("http://sharepointsite"))  
  2.             {  
  3.                 using (SPWeb web = site.OpenWeb())  
  4.                 {  
  5.       // Get the Regional Settings for the web  
  6.                     SPRegionalSettings regSettings = web.RegionalSettings;  
  7.                     regSettings.ShowWeeks = true;  //Enable the Show Weeks option  
  8.                     web.Update();  
  9.                 }  
  10.             }