0

I have a SharePoint 2016 team site with a list that will be used for a shift log.

I want to limit the ability to modify a log to only be editable for 12 hours.

Currently I am using list validation with the following formula, that I thought would limit for 1 day. It doesn't seem to work. Maybe it's a syntax issue. I would like to fix this formula, and change it to be 12 hours instead of 1 day.

=Created<=NOW()+1 

Any advice? I would like it to be simple, just tell me how to fix the formula if you can. I don't want to change the method to JavaScript..

0

You have the correct idea, however the logic isn't quite implemented accordingly.

What you currently have will do the following:

  1. Created = Date/Time that this was created. Let's call it 1000000 (Unix Timestamp for 1/12/1970)
  2. NOW() + 1 = 1524338297 (Unix Timestamp for 4/21/2018).
  3. Compare as (1000000) <= (1524338297). This is true, and always will evaluate to true, so you will never catch anything as failing validation.

What you really want is to flip your comparison to be =Created + 1 >= NOW() so that once the file is more than 24 hours old, users will not be able to update the file.

EDIT As pointed out by u/Mike Smith, the +1 should be applied to the Created timestamp. Using =Created >= NOW() +1 will always eval to false!

  • thanks for your response. I solved the issue by using this formula =NOW()<=Created+0.5 – Mark K. Apr 30 '18 at 15:55
2

A couple of things to consider:

  • today() and now() are current times, and are reevaluated on each item edit.
  • today() (assuming today is 4/19/2018) is as of midnight: 4/19/2018 12:00 AM.
  • Created is a date and a time, not just a date.
  • when doing date math, 1 is 24 hours, and .5 is the 12 hours you stated.
  • if you are displaying your Created column as "Date" and not "Date and Time", these are just formatting options. The full date and time is being stored in Created.

So your equation should look like this:

=Created + .5 <= now()
  • Thank you. I see where i was mistaken. For some reason i was applying the NOW()+1 as if there were parenthesis around it. Applying that as a single variable. As if it were an equation and one side of the equals sign was treated independently.. – Mark K. Apr 21 '18 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.