sharepoint dateandtime field get hours
I am trying to get hours from the DateandTime field of a sharepoint calendar listitem using sharepoint Object Model.
int starttime = Convert.ToInt32(item["Start Time"]);
Obviously which returns type error.
Please throw some light that how i can pick Time value from the field and convert to 开发者_Python百科Int.
Thanks in advance.
Try:
DateTime starttime = Convert.ToDateTime(item["Start Time"]);
From there, you have a number of time properties (Hour, Millisecond, Minute, Second) that are integers.
精彩评论