Home > Lists > Setting The Default Value Of A DateTime Column

Setting The Default Value Of A DateTime Column

This is a very brief post that addresses the calculated default value of a SharePoint 2010 column. There is a difference between a calculated column (you set the column type to: Calculated (calculation based on other columns)) and a calculated default value (additional column settings: default value). In the latter case, you can use volatile tokens like Today or Me – since they are used only once to initialize the column value. Volatile values should not be used for calculated columns.
So, if we have a column whose type is DateTime and we do need to keep both date and time, and also need to initialize it with current date (including time), the interface will not be very helpful. You can set the default value to Today’s Date but that will not get the time accurately.  It turns out that the Calculated Value option accepts the familiar Now() function. So, just select calculated value and type = NOW() as the formula. In a new form, the date and time controls will be filled automatically with current date and time (to the nearest minute).
If you have access to InfoPath and the list can be customized, you can easily set the default value for the date control (it will also use the Now() function).
Notice that the default value (or whatever is saved in the column) does not change (automatically) if you edit the item later (as opposed to using volatile functions in a calculated column).

Categories: Lists Tags: calculated default value,
  1. Alex
    January 10th, 2012 at 09:25 | #1

    When I filled “calculated value” for my datetime field like “=NOW()”, every user who has different permissions on this list (even contributor) except administrator gets error “Access denied” when they try to add new element to this list.
    Any advises?

    Thanks.

  2. Boris
    March 20th, 2012 at 17:55 | #2

    Alex :
    When I filled “calculated value” for my datetime field like “=NOW()”, every user who has different permissions on this list (even contributor) except administrator gets error “Access denied” when they try to add new element to this list.
    Any advises?
    Thanks.

    We have the same problem. Does anybody has a solution?

  1. No trackbacks yet.