Setting default expire dates in an announcement list
Today (as I prepare for the launching of the new corporate Intranet), my boss asked if it would be possible to set the default expires date on announcements to 4 in the afternoon of the following day. (This more closely aligns with current newsletter policies.) I said sure we could do that (thinking that there was an option to set the default time as well as date.
I poked into the announcement list settings for the expires column and found that my default options were: (None), Today's Date, or I could type in a hard coded date and time. None of these options would give me tomorrow's date and I time I wanted. So I figured I might be able to use the [Today] keyword in the box next to the time and add one to it to get tomorrow. I tried that and got back a message saying that I could not use [Today] in there.
Then I saw the calculated field and got to thinking that maybe I could create the date using a calculation. I went to my trusty Office site that explains many of the formulas you can use in the calculated fields. I did not see any way to add hours in the day or to get to a certain time in a day.
Then I got to thinking again (scary isn't it). What if I add a fraction of a day to the keyword [Today]. Maybe that would get me the result I was looking for. So I figured out that if I wanted items to expire at 4PM on the following day I would need to add 1 and 2/3 days to today to get that time. So I plugged into the formula (=Today+(1+(2/3))) and clicked the OK button. I went to create a new announcement and looked down at the expires date and time and sure enough it was set for tomorrow at 4PM.
I love working with SharePoint and always finding nice surprises like this that make developing in SharePoint that much easier.
Labels: Default expire date formula, SharePoint default expire date and time
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home