We can get
the current day of week easily by using “System.DateTime”
control.
We cannot
get the current Day of week using “DateTimeControl”
directly but there is an option to get the day of week indirectly by using the “SelectedDate” property of SharePoint
DateTimeControl.
Namespace: Microsoft.SharePoint.WebControls
DateTimeControl
spDateTimeControl = new DateTimeControl();
string dayOfWeek =
spDateTimeControl.SelectedDate.DayOfWeek.ToString();
|
Note: If the user has not selected any date in the SharePoint DateTime control, the SelectedDate property of the SharePoint DateTime control returns current dateTime [means DateTime.Now]
DayOfWeek
comparison:
if
(spDateTimeControl.SelectedDate.DayOfWeek == DayOfWeek.Monday)
{
//Code
}
|
No comments:
Post a Comment