How to开发者_运维知识库 format date in Sharepoint DateTime Control?
DateTimeControl.LocaleId = SPContext.Current.RegionalSettings.LocaleId
Or put the LocaleId if it does not work, I encounter that sometimes
i.e
DateTimeControl.LocaleId = 2057 for UK
DateTimeControl.LocaleId = 1031 for German
set DateTimeControl.LocaleId = Convert.ToInt32(SPContext.Current.RegionalSettings.LocaleID)
You can use Custom format property
dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
Reference: https://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat%28v=vs.71%29.aspx
精彩评论