Impostare i regional settings (SharePoint)
Ecco come impostare i regional settings di un sito SharePoint 2007 (WSS 3 - MOSS) per l'italia in modo da avere date e numeri correttamente formattati.
nel caso di una webparts (ad esempio all'inizio del CreateChildControls)
C#
public static void SetRegionaSettingIT(SPWeb web)
{
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("it-IT");
web.RegionalSettings.LocaleId = (uint)ci.LCID;
web.RegionalSettings.FirstWeekOfYear = (short)System.Globalization.CalendarWeekRule.FirstFourDayWeek;
web.RegionalSettings.FirstDayOfWeek = (uint)ci.DateTimeFormat.FirstDayOfWeek;
web.RegionalSettings.Time24 = true;
web.RegionalSettings.WorkDayStartHour = 480;
web.RegionalSettings.WorkDayEndHour = 1020;
web.Update();
}
C#
SPWeb web = SPContext.Current.Web;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(web.Locale.LCID);